[CMake] add_test WORKING_DIRECTORY option
Belcourt, Kenneth
kbelco at sandia.gov
Mon Mar 14 17:19:45 EDT 2011
Hi,
The documentation states that the add_test() WORKING_DIRECTORY option
will run the test in the given directory. This add_test rule in my
CMakeLists.txt file:
add_test(
NAME bwr_melgen
WORKING_DIRECTORY ${Bwr_Dir}
COMMAND melgen.x ${Bwr_Dir}/_BWR_v2-0.inp
)
with ${Bwr_Dir} == /scratch/trunk_tests/_ShorterRuns/Plant_Decks/BWR
results in this command line.
1: Test command: /scratch/trunk/tools/melgen.x /scratch/trunk_tests/
_ShorterRuns/Plant_Decks/BWR/_BWR_v2-0.inp
Test #1: bwr_melgen
Due to problems in the code base, the output is not generated in the
test directory and this is a known code problem.
Is there an easy way to change the WORKING_DIRECTORY behavior to have
it always cd to the working directory beforehand, then run the test,
(pushd / popd behavior) etc..., rather than making, in our case the
unsafe assumption, that the program correctly writes the files where
they should be? Frankly, if ctest would always cd into the test
directory, then we'd never have a problem though we would never
uncover the incorrect file handling behavior either.
Anyone know of a way to change the working directory behavior?
-- Noel
More information about the CMake
mailing list