[CMake] Skip(ped) test with CTest?

Eric Noulard eric.noulard at gmail.com
Fri Jun 8 11:36:07 EDT 2012


2012/6/8 Christoph Grüninger <christoph.grueninger at iws.uni-stuttgart.de>:
> Hi CMake,
> can I skip a test with CTest? Currently I do not add a test which is
> dependent on a not found feature, like:
>
> if(feature_found)
>  add_test(..)
> endif(feature_found)
>
> If all tests pass, I still don't know whether everything is fine, because
> the not added tests are not shown.
>
> Has CMake the possibility to mark tests "to skip".
> Or the other way round, if my test detects that the feature is not available
> it exits with status code not zero, let's say 77. And CMake does not throw
> an error but marks the test neither as passed nor failed, but as skipped.

Then may be:
if(feature_found)
  add_test(NormalTestName ..)
else(feature_found)
  add_test(NormalTestName-Skipped SkippedTest NormalTestName)
endif(feature_found)

SkippedTest would be a script, eexcutable etc... which shall always succeed.
that way you can easily spot your "skipped" test with ctest or CDash.

Of course this does not work for skipped test "at test time".


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list