Allow ctest to pass arguments to command that executes test
Allow ctest arguments to be given at test time instead of compile time (cmake)
Let's say we create a test like so
add_test(NAME foo
COMMAND python3 ./test.py
--fixed-variable ${CMAKE_CACHE_VARIABLE}
--dynamic-variable ${CMAKE_DINAMIC_VARIABLE}
)
Calling ctest with ctest -R foo -DCMAKE_DINAMIC_VARIABLE=bar
will not actually run the test with --dynamic-variable bar
.
It will run the test as: python3 ./test.py --fixed-variable ${CMAKE_CACHE_VARIABLE} --dynamic-variable ${CMAKE_DINAMIC_VARIABLE}
I propose that ctest can support -- CTEST_EXTRA-ARGS
. Which would instead look like so:
add_test(NAME foo
COMMAND python3 ./test.py
--fixed-variable ${CMAKE_CACHE_VARIABLE}
CTEST_EXTRA_ARGS
)
then I can run the command: ctest -R foo -- --dynamic-variable bar
which would call the test command:
python3 ./test.py --fixed-variable ${CMAKE_CACHE_VARIABLE} --dynamic-variable bar
Edited by Nuno Mendes