summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_test
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2020-04-20 21:05:15 (GMT)
committerJohnny Jazeix <jazeix@gmail.com>2020-04-20 21:05:15 (GMT)
commite89aeba5c4733964db15e0d147e063af34205d54 (patch)
tree2b5e1da00d132d9e60b8355f6de72427b44faa62 /Tests/RunCMake/ctest_test
parentdf2d39bc512bd09ae808e8a2a6c7523737bb26c0 (diff)
downloadCMake-e89aeba5c4733964db15e0d147e063af34205d54.zip
CMake-e89aeba5c4733964db15e0d147e063af34205d54.tar.gz
CMake-e89aeba5c4733964db15e0d147e063af34205d54.tar.bz2
ctest: add option --stop-on-failure
To stop the tests once one has failed Fixes: #16628
Diffstat (limited to 'Tests/RunCMake/ctest_test')
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt13
2 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 84d1d66..34d4020 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -95,3 +95,15 @@ endfunction()
run_TestRepeat(UntilFail REPEAT UNTIL_FAIL:3)
run_TestRepeat(UntilPass REPEAT UNTIL_PASS:3)
run_TestRepeat(AfterTimeout REPEAT AFTER_TIMEOUT:3)
+
+# test --stop-on-failure
+function(run_stop_on_failure)
+ set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME StoppingTest COMMAND ${CMAKE_COMMAND} -E false)
+add_test(NAME NotRunTest COMMAND ${CMAKE_COMMAND} -E true)
+ ]])
+
+ run_ctest_test(stop-on-failure STOP_ON_FAILURE)
+endfunction()
+run_stop_on_failure()
diff --git a/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt b/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt
new file mode 100644
index 0000000..fa4bce0
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt
@@ -0,0 +1,13 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/stop-on-failure-build
+ Start 1: RunCMakeVersion
+1/3 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
+ Start 2: StoppingTest
+2/3 Test #2: StoppingTest .....................\*\*\*Failed +[0-9.]+ sec
++
+50% tests passed, 1 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests FAILED:
+[ ]+2 - StoppingTest \(Failed\)$