<div dir="ltr">I use:<br><br> SET_TESTS_PROPERTIES(${name} PROPERTIES<br> FAIL_REGULAR_EXPRESSION "(ERROR|Warning): In"<br> )<br><br>which will cause the test to fail if the string "ERROR: In" or "Warning: In" occurs in the test output.<br>
<br>${name} should be the name of the test as passed to ADD_TEST, and the argument after FAIL_REGULAR_EXPRESSION should be a regex that matches the text that you want to cause a failure...<br><br><br>HTH,<br>David<br><br>
<br><div class="gmail_quote">On Wed, Aug 13, 2008 at 9:20 PM, Matthew Woehlke <span dir="ltr"><<a href="mailto:mw_triad@users.sourceforge.net">mw_triad@users.sourceforge.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.)<br>
<br>
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'?<br>
<font color="#888888">
<br>
-- <br>
Matthew<br>
That said, if this is coming out of your posterior then you should consider your diet. -- Richard Moore, in response to Aaron Seigo's stated source of suggested enum values.<br>
<br>
_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org" target="_blank">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></blockquote></div><br></div>