Re: [CMake] add_test WORKING_DIRECTORY

2011-11-26 Thread David Cole
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 wewol...@gmail.com 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 config?)
 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


Re: [CMake] add_test WORKING_DIRECTORY option

2011-03-15 Thread David Cole
On Mon, Mar 14, 2011 at 6:54 PM, Belcourt, Kenneth kbe...@sandia.gov 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

2011-03-14 Thread David Cole
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 kbe...@sandia.gov 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


Re: [CMake] add_test WORKING_DIRECTORY option

2011-03-14 Thread Belcourt, Kenneth

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

2011-03-14 Thread Belcourt, Kenneth


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