MantisBT - CMake
View Issue Details
0015431CMakeCTestpublic2015-03-05 10:082016-06-10 14:21
hansmi 
 
normalmajoralways
closedduplicate 
 
 
0015431: Skipped tests (SKIP_RETURN_CODE) cause non-zero exit code
Issue 0008466 implemented a property named SKIP_RETURN_CODE for tests. It works as intended, but CTest's exit status is non-zero when one or more tests were skipped. CMake's support for CTest automatically generates a target which relies on the exit code of CTest to indicate success.

There should probably be a flag (and/or environment variable) to indicate that skipped tests are acceptable.
Add a skipped test:

add_test(NAME mytest COMMAND bash -c "exit 77")
set_property(TEST mytest PROPERTY SKIP_RETURN_CODE 77)

Then run “cmake --build . --target test”. At least with GNU make this causes a failure.

1/1 Test #1: mytest ...............***Skipped 0.00 sec

The following tests FAILED:
  1 - mytest (Not Run)
Errors while running CTest
Makefile:117: recipe for target 'test' failed
make: *** [test] Error 8
No tags attached.
duplicate of 0013825closed Kitware Robot ctest shouldn't report skipped tests as failed 
Issue History
2015-03-05 10:08hansmiNew Issue
2016-02-15 06:50Elias PippingNote Added: 0040490
2016-02-16 10:32Brad KingRelationship addedduplicate of 0013825
2016-02-16 10:32Brad KingStatusnew => resolved
2016-02-16 10:32Brad KingResolutionopen => duplicate
2016-06-10 14:21Kitware RobotNote Added: 0041250
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040490)
Elias Pipping   
2016-02-15 06:50   
This looks like a duplicate of bug 0013825 to me.
(0041250)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.