[CMake] Fwd: generating CTest tests
David Cole
david.cole at kitware.com
Fri Aug 28 15:27:43 EDT 2009
On Fri, Aug 28, 2009 at 3:11 PM, Alex H <aditya15417 at hotmail.com> wrote:
> Hello,
> So where do we specify/put in the CMakeLists.txt where test1 is expected to
> fail or pass?
> How does CTest knows this...
>
If your program returns a 0, it passes. If it does not, it fails.
If you want to invert this logic, set the test property "WILL_FAIL".
If you want to base the pass/fail value on test output, set the test
property "PASS_REGULAR_EXPRESSION" or "FAIL_REGULAR_EXPRESSION" : if the
output matches the regex, it passes or fails accordingly.
i.e.:
set_property(TEST test1 PROPERTY WILL_FAIL TRUE)
would invert the pass/fail logic
see also:
$ cmake --help-property WILL_FAIL
$ cmake --help-property PASS_REGULAR_EXPRESSION
$ cmake --help-property FAIL_REGULAR_EXPRESSION
$ cmake --help-command set_property
> Just to clarify the add_test command should be put inside a CMakeLists.txt?
>
Yes, that's correct.
> What if I want to invoke
> ctest using the following command:
>
> ctest -R testpage
>
> What should testpage have inside of it?
>
testpage should be the name of a test added using add_test. It can have
*anything you want to test* inside of it....
ctest -R testpage will execute the test as specified in the add_test
command.
HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090828/a8e86242/attachment.htm>
More information about the CMake
mailing list