[CMake] add_test( WORKING_DIRECTORY ) does not actua
Hi there The following message in cmTest.cxx doesn't seem to be accurate for Visual Studio 9. 200 cm->DefineProperty 201 ("WORKING_DIRECTORY", cmProperty::TEST, 202 "The directory from which the test executable will be called.", 203 "If this is not set it is called from the directory the test executable " 204 "is located in."); The test process is actually run from ${PROJECT_BINARY_DIR} I create the test project with the following: SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/../targets" CACHE PATH "Single Directory for all Executables.") add_executable(${mod_name} ${src_files} ${inc_files}) add_test(NAME ${mod_name} COMMAND ${mod_name} --log_file=${mod_name}.xml) The above --log_file parameter tells the exe (a Boost Test exe) to create ${mod_name}.xml in the current directory. I would be happy to use add_test(WORKING_DIRECTORY) but I can't figure out how to construct the path. Has anyone managed to piece these two together in a simple way? Thanks in advance! -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_test WORKING_DIRECTORY
You are calling add_test correctly. Now you need to call ctest like this: ctest -C Release or ctest -C Debug to test a particular configuration... HTH, David On Fri, Nov 25, 2011 at 11:21 AM, W Eryk Wolski wrote: > I am testing against reference data in the source directory. > However, I would like to perform out of source builds. > > > With > add_test(SpoofTest ${BinOut}/SpoofTest ) > the test dont find's the data, because the data path is hard coded in the > tests and the build directory location is arbitrary. > > > My Idea is to use the WORKING_DIRECTORY option to execute the tests in the > Source directory. > > add_test(NAME SpoofTest > WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} > COMMAND ${BinOut}/SpoofTest) > > However, I do not understand the COMMAND parameter. > > This is what I am getting when I run ctest: > Checking test dependency graph end > test 1 > Start 1: SpoofTest > > 1: Test command: NOT_AVAILABLE > Test not available without configuration. (Missing "-C "?) > 1/1 Test #1: SpoofTest ***Not Run 0.00 sec > > 0% tests passed, 1 tests failed out of 1 > > Total Test time (real) = 2.29 sec > > The following tests FAILED: > 1 - SpoofTest (Not Run) > Errors while running CTest > > Can anyone please explain the COMMAND parameter to me! > > Regards > Eryk > > > > > > > > -- > Witold Eryk Wolski > > Heidmark str 5 > D-28329 Bremen > tel.: 04215261837 > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] add_test WORKING_DIRECTORY
I am testing against reference data in the source directory. However, I would like to perform out of source builds. With add_test(SpoofTest ${BinOut}/SpoofTest ) the test dont find's the data, because the data path is hard coded in the tests and the build directory location is arbitrary. My Idea is to use the WORKING_DIRECTORY option to execute the tests in the Source directory. add_test(NAME SpoofTest WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${BinOut}/SpoofTest) However, I do not understand the COMMAND parameter. This is what I am getting when I run ctest: Checking test dependency graph end test 1 Start 1: SpoofTest 1: Test command: NOT_AVAILABLE Test not available without configuration. (Missing "-C "?) 1/1 Test #1: SpoofTest ***Not Run 0.00 sec 0% tests passed, 1 tests failed out of 1 Total Test time (real) = 2.29 sec The following tests FAILED: 1 - SpoofTest (Not Run) Errors while running CTest Can anyone please explain the COMMAND parameter to me! Regards Eryk -- Witold Eryk Wolski Heidmark str 5 D-28329 Bremen tel.: 04215261837 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_test WORKING_DIRECTORY option
On Mon, Mar 14, 2011 at 6:54 PM, Belcourt, Kenneth wrote: > > On Mar 14, 2011, at 4:19 PM, Belcourt, Kenneth wrote: > >> Hi David, > > Oops, busted. The modules I loaded inserted an older version of CMake, > v2.8.1. When I run with my local copy of CMake 2.8.4, the error goes away. > > Sorry about the noise. > > -- Noel > > > Whew. You had me going there... ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_test WORKING_DIRECTORY option
On Mar 14, 2011, at 4:19 PM, Belcourt, Kenneth wrote: Hi David, Oops, busted. The modules I loaded inserted an older version of CMake, v2.8.1. When I run with my local copy of CMake 2.8.4, the error goes away. Sorry about the noise. -- Noel ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_test WORKING_DIRECTORY option
Hi David, On Mar 14, 2011, at 3:34 PM, David Cole wrote: What is the cwd when your test starts? The directory where the executable runs from (/scratch/trunk/tools), not the directory containing the test input. It should be ${Bwr_Dir} according to your email's WORKING_DIRECTORY arg. (write a little code that prints it out right at the top of the program's main before doing anything else...) I've confirmed with a getcwd() call at the top of the program. What version of ctest is this? (I assume 2.8.4?) Yes. always cd to the working directory beforehand, then run the test, (pushd / popd behavior) etc... It sets the WorkingDirectory in the process execution data structures before launching the process. How this translates into process launching behavior varies from platform to platform, but it should be working essentially the same way as what you suggest. No, doesn't seem to be. Perhaps: are you also setting the WORKING_DIRECTORY test property? Is that being set to a different value? Don't think so, here's what CMake is writing to the CTestTestfile.cmake ADD_TEST(bwr_melgen "/scratch/trunk/tools/melgen.x" "/scratch/ trunk_tests/_ShorterRuns/Plant Decks/BWR/_BWR_v2-0.inp") SET_TESTS_PROPERTIES(bwr_melgen PROPERTIES WORKING_DIRECTORY "/ scratch/trunk_tests/_ShorterRuns/Plant Decks/BWR") -- Noel Here's the expected output when I cd to the input test directory and run the executable. [kbelco@wsblade001 BWR]$ /scratch/trunk/tools/melgen.x _BWR_v2-0.inp cwd = /scratch/trunk_tests/_ShorterRuns/Plant Decks/BWR Here's what I get when I run ctest. [kbelco@wsblade001 tools]$ ctest --verbose UpdateCTestConfiguration from :/scratch/trunk/tools/ DartConfiguration.tcl UpdateCTestConfiguration from :/scratch/trunk/tools/ DartConfiguration.tcl Test project /scratch/trunk/tools Constructing a list of tests Done constructing a list of tests Checking test dependency graph... test 1 Start 1: bwr_melgen 1: Test command: /scratch/trunk/tools/melgen.x /scratch/trunk_tests/ _ShorterRuns/Plant\ Decks/BWR/_BWR_v2-0.inp 1: Test timeout computed to be: 9.99988e+06 1: cwd = /scratch/trunk/tools ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_test WORKING_DIRECTORY option
What is the cwd when your test starts? It should be ${Bwr_Dir} according to your email's WORKING_DIRECTORY arg. (write a little code that prints it out right at the top of the program's main before doing anything else...) What version of ctest is this? (I assume 2.8.4?) > always cd to the working directory beforehand, then run the test, (pushd / > popd behavior) etc... It sets the WorkingDirectory in the process execution data structures before launching the process. How this translates into process launching behavior varies from platform to platform, but it should be working essentially the same way as what you suggest. Perhaps: are you also setting the WORKING_DIRECTORY test property? Is that being set to a different value? On Mon, Mar 14, 2011 at 5:19 PM, Belcourt, Kenneth wrote: > 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 > > > ___ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] add_test WORKING_DIRECTORY option
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 ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake