[CMake] ctest 'magic string' -> failure

Bill Hoffman bill.hoffman at kitware.com
Wed Aug 13 21:45:59 EDT 2008


Matthew Woehlke wrote:
> Is there any way to arrange for running ctest to mark a test as failed 
> if it outputs a particular string? I'm using ctest to write unit tests 
> for a library that has some debugging facilities where if something goes 
> wrong, it dumps an error message, but doesn't cause the function to 
> fail, so I can't detect it in the test program. (And, no, changing the 
> library is NOT an option.)
> 
> Alternatively, there /is/ a hook to make the messages trip an abort()... 
> is there a way to make 'make test'/'ctest' set an environment variable 
> for all tests it runs? Or would I be stuck remembering to set it before 
> calling 'make test'/'ctest'?
> 
You can use a test property to do that:

http://www.cmake.org/HTML/cmake-2.6.html#command:set_tests_properties

http://www.cmake.org/HTML/cmake-2.6.html#section_Properties%20on%20Tests

-Bill



More information about the CMake mailing list