Under cmake, the following commands in a CMakeList.txt
enable_testing()
add_test(<test_name> <test_command>)
suffice to create a test that can be executed through the shell command ctest
.
Unfortunately, the cmake docs give not the least indication of what constitutes a valid test executable (<test_command>
). Usually, test executables are generated using a framework like google-test. It's a bit involved, but there are good examples in the web that show how to make tests under google-test under cmake.
Now I want to extend my use of cmake/ctest to functional test scripts that need not to be compiled, and therefore cannot be run under google-test. Thence my question: what constitutes a valid hand-written test executable to be directly activated through add_test
:
- Shall my test executable generate output? Shall it write to stdout or stderr?
- Shall my test executable return certain values to indicate success or failure?
- Or where in the cmake docs can I find the answer?