Skip to content

Commit

Permalink
Tell CTest about skipped tests
Browse files Browse the repository at this point in the history
Return code 125 is chosen for familiarity with what “git bisect” uses.
  • Loading branch information
jrosdahl committed Jun 14, 2020
1 parent 7bfae20 commit f6e2965
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ function(addtest name)
add_test(NAME "producttest.${name}"
COMMAND test/run ${name}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
set_tests_properties("producttest.${name}" PROPERTIES ENVIRONMENT CCACHE=${CMAKE_BINARY_DIR}/ccache)
set(
environment
CCACHE=${CMAKE_BINARY_DIR}/ccache
EXIT_IF_SKIPPED=true
)
set_tests_properties(
"producttest.${name}"
PROPERTIES
ENVIRONMENT "${environment}"
SKIP_RETURN_CODE 125)
endfunction()

addtest(base)
Expand Down
3 changes: 3 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ run_suite() {
rm -rf $ABS_TESTDIR/probe
if [ -n "$skip_reason" ]; then
echo "Skipped test suite $suite_name [$skip_reason]"
if [ -n "$EXIT_IF_SKIPPED" ]; then
exit 125
fi
return
fi
fi
Expand Down

0 comments on commit f6e2965

Please sign in to comment.