#1621 Don't build executables on make test
|Reported by||Timo Koch (firstname.lastname@example.org)|
|Reported at||Apr 17, 2015 12:07|
|Operating System||Unspecified / All|
|Last edited by||Christoph Grüninger (email@example.com)|
|Last edited at||Oct 29, 2015 08:36|
|Closed by||Christoph Grüninger (firstname.lastname@example.org)|
|Closed at||Oct 29, 2015 08:36|
|Closed in version||Unknown|
|Comment||by Domoinic. The macro to build all tests on make is DUNE_BUILD_TESTS_ON_MAKE_ALL. Thanks again, Dominic!|
The CMake default way to build and execute tests is
make all make test
where "make all" builds all executables (in the current directory), "make test" (only) runs all the tests (in the current directory).
In Dune some magic (that I didn't look into) is used to compile all tests on make test. This has the disadvantage that all tests build also if only one test is desired to run (with ctest -R my_test). Furthermore it checks all dependencies of all the tests (in the current directory) and not just the one I want to run. This is a problem when there are more than one test in the same directory and I want to just build and/or run one.
The CMake way has advantages that get lost by contracting build and execution:
- In an automated build the compilation and execution can fail/pass separately
- One test can be build and executed separately if desired (make my_test, ctest -R my_test)
This is particularly bothering if a ctest consists of more than just the execution of one executable, e.g. 5 runs of the executable and an output check, or comparison of an output file with a reference file through a python script, a cmake macro, ... Then I can't just run ./exec instead of ctest -R my_test.