[CMake] ctest meant to be re-entrant?

Convey, Christian J CIV NUWC NWPT christian.convey at navy.mil
Mon Jun 21 13:53:56 EDT 2010


> 	Sorry, that was embarrassing.  Pretend I had said, 
> "CTestTestFile.cmake" instead of "CTestConfig.cmake".
> 	
> 
> 
> Well, in that case.... CMake writes the CTestTestFile.cmake 
> files whenever it configures a build tree. (So, from a ctest 
> -S script, during the "ctest_configure(...)" call.) The ctest 
> executable will read the CTestTestFile.cmake files when it 
> needs to execute tests: when run from the command line to 
> execute tests, or when processing a ctest_test(...) command 
> in a -S script...
> 
> So again: only one writer, at one well-defined time. I don't 
> think there should be any problems with respect to the 
> CTestTestFile.cmake files. The confusion arises perhaps 
> because ctest is used as a "simple" test driver and also as a 
> full configure/build/test/run-a-dashboard driver. The 
> CTestTestFile.cmake files are used when it is acting as a 
> simple test driver. You would write a script to be processed 
> with -S, or run a -D Nightly or -D Experimental dashboard 
> separately: that is not connected to the CTestTestFiles at all.
> 
> I suppose you could probably contrive a case where an 
> executing test actually re-configures the build tree that it 
> is in, but I'd be surprised if that happens in practice. If 
> shown to be problematic, and reported with reasonable steps 
> to reproduce to the CMake bug tracker, we could add code to 
> detect such pathological cases and fail with an error...

Thanks, that does help.  Could you tell me if the following 
approach constent with what you guys intended?

I want some parts of "CTestTestfile.cmake" to be automatically generated from the CMakeLists.txt files in my source directory tree.

OTOH, I also want to supply some additional information ctest.  For example, 'set(CTEST_BUILD_NAME "myBuildName")'.

So I do this:

1. Have a permanent (e.g., non-generated) file 
   "MyCTestScript.cmake" with the following content:

   INCLUDE("CTestTestfile.cmake")
   SET(CTEST_BUILD_NAME "myBuildName")

2. When I want to run tests, I use this command:
   ctest -s MyCTestScript.cmake -D Nightly

- Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5218 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100621/5eef0d0a/attachment-0001.bin>


More information about the CMake mailing list