diff --git a/docs/markdown/Contributing.md b/docs/markdown/Contributing.md index 95324d66e..f545b77fb 100644 --- a/docs/markdown/Contributing.md +++ b/docs/markdown/Contributing.md @@ -33,15 +33,15 @@ remove them. Every new feature requires some extra steps, namely: - - Must include a project test under `test cases/`, or if that's not - possible or if the test requires a special environment, it must go - into `run_unittests.py`. - - Must be registered with the [FeatureChecks framework](Release-notes-for-0.47.0.md#feature-detection-based-on-meson_version-in-project) - that will warn the user if they try to use a new feature while - targeting an older meson version. - - Needs a release note snippet inside `docs/markdown/snippets/` with - a heading and a brief paragraph explaining what the feature does - with an example. +- Must include a project test under `test cases/`, or if that's not + possible or if the test requires a special environment, it must go + into `run_unittests.py`. +- Must be registered with the [FeatureChecks framework](Release-notes-for-0.47.0.md#feature-detection-based-on-meson_version-in-project) + that will warn the user if they try to use a new feature while + targeting an older meson version. +- Needs a release note snippet inside `docs/markdown/snippets/` with + a heading and a brief paragraph explaining what the feature does + with an example. ## Acceptance and merging @@ -68,19 +68,19 @@ require the approval of the project lead. In a simplified list form the split would look like the following: - - members with commit access can do: - - documentation changes (directly to master if warranted) - - bug fixes that don't change functionality - - refactorings - - new dependency types - - new tool support (e.g. a new Doxygen-kind of tool) - - support for new compilers to existing languages - - project leader decision is needed for: - - new modules - - new functions in the Meson language - - syntax changes for Meson files - - changes breaking backwards compatibility - - support for new languages +- members with commit access can do: + - documentation changes (directly to master if warranted) + - bug fixes that don't change functionality + - refactorings + - new dependency types + - new tool support (e.g. a new Doxygen-kind of tool) + - support for new compilers to existing languages +- project leader decision is needed for: + - new modules + - new functions in the Meson language + - syntax changes for Meson files + - changes breaking backwards compatibility + - support for new languages ## Strategy for merging pull requests to trunk @@ -97,14 +97,14 @@ often requires some judgement on part of the person doing the merge. Github provides three different merge options, The rules of thumb for choosing between them goes like this: - - single commit pull requests should always be rebased +- single commit pull requests should always be rebased - - a pull request with one commit and one "fixup" commit (such as - testing something to see if it passes CI) should be squashed +- a pull request with one commit and one "fixup" commit (such as + testing something to see if it passes CI) should be squashed - - large branches with many commits should be merged with a merge - commit, especially if one of the commits does not pass all tests - (which happens in e.g. large and difficult refactorings) +- large branches with many commits should be merged with a merge + commit, especially if one of the commits does not pass all tests + (which happens in e.g. large and difficult refactorings) If in doubt, ask for guidance on IRC. @@ -127,6 +127,17 @@ project tests. To run all tests, execute `./run_tests.py`. Unit tests can be run with `./run_unittests.py` and project tests with `./run_project_tests.py`. +Subsets of project tests can be selected with +`./run_project_tests.py --only` option. This can save a great deal of +time when only a certain part of Meson is being tested. +For example, a useful and easy contribution to Meson is making +sure the full set of compilers is supported. One could for example test +various Fortran compilers by setting `FC=ifort` or `FC=flang` or similar +with `./run_project_test.py --only fortran`. +Some families of tests require a particular backend to run. +For example, all the CUDA project tests run and pass on Windows via +`./run_project_tests.py --only cuda --backend ninja` + Each project test is a standalone project that can be compiled on its own. They are all in `test cases` subdirectory. The simplest way to run a single project test is to do something like `./meson.py test\ @@ -168,7 +179,7 @@ Continuous integration systems currently used: To promote consistent naming policy, use: - - `[skip ci]` in the commit title if you want to disable all integration tests +- `[skip ci]` in the commit title if you want to disable all integration tests ## Documentation @@ -225,8 +236,6 @@ those are simple. - indent 4 spaces, no tabs ever - brace always on the same line as if/for/else/function definition - - ## External dependencies The goal of Meson is to be as easily usable as possible. The user @@ -257,8 +266,8 @@ languages. It has inputs, which include `meson.build` files, values of options, compilers and so on. These are passed to a function, which generates output build definition. This function is pure, which means that: - - for any given input the output is always the same - - running Meson twice in a row _always_ produce the same output in both runs +- for any given input the output is always the same +- running Meson twice in a row _always_ produce the same output in both runs The latter one is important, because it enforces that there is no way for "secret state" to pass between consecutive invocations of diff --git a/run_project_tests.py b/run_project_tests.py index 4f04fb214..5f3c40a38 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -581,7 +581,7 @@ def skippable(suite, test): # Other framework tests are allowed to be skipped on other platforms return True -def skip_csharp(backend): +def skip_csharp(backend) -> bool: if backend is not Backend.ninja: return True if not shutil.which('resgen'): @@ -671,6 +671,7 @@ def detect_tests_to_run(only: typing.List[str]) -> typing.List[typing.Tuple[str, ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or not have_objcpp_compiler()), ('fortran', 'fortran', skip_fortran or backend != Backend.ninja), ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')), + # CUDA tests on Windows: use Ninja backend: python run_project_tests.py --only cuda --backend ninja ('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')), ('python3', 'python3', backend is not Backend.ninja), ('python', 'python', backend is not Backend.ninja), diff --git a/test cases/cuda/1 simple/prog.cu b/test cases/cuda/1 simple/prog.cu index 7eab6738c..b893bd331 100644 --- a/test cases/cuda/1 simple/prog.cu +++ b/test cases/cuda/1 simple/prog.cu @@ -1,6 +1,6 @@ #include -int main(int argc, char **argv) { +int main(void) { int cuda_devices = 0; std::cout << "CUDA version: " << CUDART_VERSION << "\n"; cudaGetDeviceCount(&cuda_devices); diff --git a/test cases/cuda/10 cuda dependency/c/prog.c b/test cases/cuda/10 cuda dependency/c/prog.c index e2429a680..ed9333efb 100644 --- a/test cases/cuda/10 cuda dependency/c/prog.c +++ b/test cases/cuda/10 cuda dependency/c/prog.c @@ -1,7 +1,7 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; diff --git a/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu b/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu index 7c52b3fb7..b4af4d41f 100644 --- a/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu +++ b/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu @@ -2,13 +2,13 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { int n = cuda_devices(); if (n == 0) { std::cout << "No CUDA hardware found. Exiting.\n"; @@ -24,7 +24,7 @@ int main() { } std::cout << "Initialized cuBLAS\n"; - if (cublasDestroy(handle) != CUBLAS_STATUS_SUCCESS) { + if (cublasDestroy(handle) != CUBLAS_STATUS_SUCCESS) { std::cout << "cuBLAS de-initialization failed. Exiting.\n"; return -1; } diff --git a/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu index e3adabfde..56688303f 100644 --- a/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu +++ b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu @@ -1,13 +1,13 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { std::cout << "Compiled against CUDA version: " << CUDART_VERSION << "\n"; int runtime_version = 0; cudaError_t r = cudaRuntimeGetVersion(&runtime_version); diff --git a/test cases/cuda/12 cuda dependency (mixed)/kernel.cu b/test cases/cuda/12 cuda dependency (mixed)/kernel.cu index a7490b59e..7daaa6839 100644 --- a/test cases/cuda/12 cuda dependency (mixed)/kernel.cu +++ b/test cases/cuda/12 cuda dependency (mixed)/kernel.cu @@ -3,6 +3,6 @@ __global__ void kernel (void){ } -void do_cuda_stuff() { +void do_cuda_stuff(void) { kernel<<<1,1>>>(); } diff --git a/test cases/cuda/12 cuda dependency (mixed)/prog.cpp b/test cases/cuda/12 cuda dependency (mixed)/prog.cpp index 85e51481b..50bb156ad 100644 --- a/test cases/cuda/12 cuda dependency (mixed)/prog.cpp +++ b/test cases/cuda/12 cuda dependency (mixed)/prog.cpp @@ -2,7 +2,7 @@ #include #include -void do_cuda_stuff(); +void do_cuda_stuff(void); int cuda_devices(void) { int result = 0; diff --git a/test cases/cuda/2 split/lib.cu b/test cases/cuda/2 split/lib.cu index c0471d048..850d7ddfb 100644 --- a/test cases/cuda/2 split/lib.cu +++ b/test cases/cuda/2 split/lib.cu @@ -4,7 +4,7 @@ __global__ void kernel (void){ } -int do_cuda_stuff() { +int do_cuda_stuff(void) { kernel<<<1,1>>>(); printf("Hello, World!\n"); diff --git a/test cases/cuda/2 split/main.cpp b/test cases/cuda/2 split/main.cpp index e5e6bda06..ce79003e5 100644 --- a/test cases/cuda/2 split/main.cpp +++ b/test cases/cuda/2 split/main.cpp @@ -1,7 +1,7 @@ #include -int do_cuda_stuff(); +int do_cuda_stuff(void); -int main(int argc, char **argv) { +int main(void) { return do_cuda_stuff(); } diff --git a/test cases/cuda/2 split/static/main_static.cpp b/test cases/cuda/2 split/static/main_static.cpp index e5e6bda06..ce79003e5 100644 --- a/test cases/cuda/2 split/static/main_static.cpp +++ b/test cases/cuda/2 split/static/main_static.cpp @@ -1,7 +1,7 @@ #include -int do_cuda_stuff(); +int do_cuda_stuff(void); -int main(int argc, char **argv) { +int main(void) { return do_cuda_stuff(); } diff --git a/test cases/cuda/3 cudamodule/prog.cu b/test cases/cuda/3 cudamodule/prog.cu index 7eab6738c..b893bd331 100644 --- a/test cases/cuda/3 cudamodule/prog.cu +++ b/test cases/cuda/3 cudamodule/prog.cu @@ -1,6 +1,6 @@ #include -int main(int argc, char **argv) { +int main(void) { int cuda_devices = 0; std::cout << "CUDA version: " << CUDART_VERSION << "\n"; cudaGetDeviceCount(&cuda_devices); diff --git a/test cases/cuda/4 shared/main.cu b/test cases/cuda/4 shared/main.cu index d251167b3..12359140e 100644 --- a/test cases/cuda/4 shared/main.cu +++ b/test cases/cuda/4 shared/main.cu @@ -3,7 +3,7 @@ #include "shared/kernels.h" -int main(int argc, char **argv) { +int main(void) { int cuda_devices = 0; cudaGetDeviceCount(&cuda_devices); if(cuda_devices == 0) { diff --git a/test cases/cuda/5 threads/main.cu b/test cases/cuda/5 threads/main.cu index d251167b3..12359140e 100644 --- a/test cases/cuda/5 threads/main.cu +++ b/test cases/cuda/5 threads/main.cu @@ -3,7 +3,7 @@ #include "shared/kernels.h" -int main(int argc, char **argv) { +int main(void) { int cuda_devices = 0; cudaGetDeviceCount(&cuda_devices); if(cuda_devices == 0) { diff --git a/test cases/cuda/6 std/main.cu b/test cases/cuda/6 std/main.cu index a01030789..a2ffba489 100644 --- a/test cases/cuda/6 std/main.cu +++ b/test cases/cuda/6 std/main.cu @@ -1,14 +1,14 @@ #include #include -auto cuda_devices() { +auto cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { int n = cuda_devices(); if (n == 0) { std::cout << "No Cuda hardware found. Exiting.\n"; diff --git a/test cases/cuda/7 static vs runtime/main.cu b/test cases/cuda/7 static vs runtime/main.cu index 4d62e9c96..bd1dbc4a0 100644 --- a/test cases/cuda/7 static vs runtime/main.cu +++ b/test cases/cuda/7 static vs runtime/main.cu @@ -1,14 +1,14 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { int n = cuda_devices(); if (n == 0) { std::cout << "No Cuda hardware found. Exiting.\n"; diff --git a/test cases/cuda/8 release/main.cu b/test cases/cuda/8 release/main.cu index 4d62e9c96..bd1dbc4a0 100644 --- a/test cases/cuda/8 release/main.cu +++ b/test cases/cuda/8 release/main.cu @@ -1,14 +1,14 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { int n = cuda_devices(); if (n == 0) { std::cout << "No Cuda hardware found. Exiting.\n"; diff --git a/test cases/cuda/9 optimize for space/main.cu b/test cases/cuda/9 optimize for space/main.cu index 4d62e9c96..bd1dbc4a0 100644 --- a/test cases/cuda/9 optimize for space/main.cu +++ b/test cases/cuda/9 optimize for space/main.cu @@ -1,14 +1,14 @@ #include #include -int cuda_devices() { +int cuda_devices(void) { int result = 0; cudaGetDeviceCount(&result); return result; } -int main() { +int main(void) { int n = cuda_devices(); if (n == 0) { std::cout << "No Cuda hardware found. Exiting.\n";