[CMake] ctest 'magic string' -> failure

Matthew Woehlke mw_triad at users.sourceforge.net
Thu Aug 14 14:30:33 EDT 2008


David Cole wrote:
> On Wed, Aug 13, 2008 at 9:20 PM, 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.)
>
> I use:
> 
>   SET_TESTS_PROPERTIES(${name} PROPERTIES
>     FAIL_REGULAR_EXPRESSION "(ERROR|Warning): In"
>   )
> 
> which will cause the test to fail if the string "ERROR: In" or "Warning: In"
> occurs in the test output.

Thank you David (and Bill)! That's what I needed; works great!

-- 
Matthew
"Who wants to sing?" -- Orcs (Warcraft II)



More information about the CMake mailing list