[CMake] CTest dependencies on tests
Neil Chittenden
neilchittenden at quintessa.org
Thu May 5 12:06:24 EDT 2011
On 05/05/11 16:46, David Cole wrote:
>
>
> On Thu, May 5, 2011 at 11:10 AM, Neil Chittenden
> <neilchittenden at quintessa.org <mailto:neilchittenden at quintessa.org>> wrote:
>
> Hi
>
> Using CTest, it is possible to set a dependency on another test using:
>
> add_test(test1 test1.sh this is test 1)
> add_test(test2 test2.sh this is test 2)
> set_tests_properties(test1 PROPERTIES DEPENDS test2)
>
> Is it possible to:
> a) only run a test (test1 in my example) if the test it depends on
> (test2) is successful rather than always running the test
>
>
> No. The DEPENDS clause simply indicates the order of the test runs. But
> ctest will always attempt to run all tests. (Unless you limit it from
> the ctest command line via index, label or name matching, i.e., with -I
> or -L or -R)
>
>
> b) set an expected return code for the test. e.g. test1 is only
> successful if it returns 1 and returning 0 or 2 is a fail.
>
>
> No. ctest uses 0 == no error == pass, and non-0 == error == fail. You
> can invert the sense of it with the WILL_FAIL property. But there is
> currently no mechanism for specifying an exact expected return value.
>
>
> I know I could handle these in my test scripts but was just
> wondering if there was a more elegant solution using CTest.
>
> Cheers
> ---
> Neil
>
>
> Handling it in your scripts is the best way to go right now.
>
>
> HTH,
> David
OK, thanks for the info.
---
Neil
More information about the CMake
mailing list