[CMake] Testing exceptions through CTest
Bill Hoffman
bill.hoffman at kitware.com
Wed Nov 7 21:50:02 EST 2007
Kedzierski, Artur CIV NSWC Corona, PA53 wrote:
> Hi,
>
> I am writing CTest unit tests for a library I've created.
> I've utilized CREATE_TEST_SOURCELIST as described in Mastering CMake book.
> In one of the test, I pass an invalid value to make sure that an
> exception is thrown.
> In my test program I have a try-catch around the function call that
> passes that invalid
> value and inside of the 'catch' I simple return EXIT_FAILURE. For that
> test, I've
> used SET_TESTS_PROPERTIES(… PROPERTIES WILL_FAIL TRUE). Now,
> when I run 'make test', the test doesn't pass with a message
> '***Exception: Other'.
> How can I tell ctest that the exception is expected? I.e. I need
> something like
> 'WILL_EXCEPT' property that I could pass to set_tests_properties.
>
If you are catching the exception, then cmake should not know about it.
This sounds like an un-caught exception or some sort of crash.
-Bill
More information about the CMake
mailing list