summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CTestCommandLine
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/CTestCommandLine
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/CTestCommandLine')
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt10
4 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 9b9ae65..20deb59 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -242,6 +242,20 @@ function(run_TestOutputSize)
endfunction()
run_TestOutputSize()
+# Test --stop-on-failure
+function(run_stop_on_failure)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/stop-on-failure)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(test1 \"${CMAKE_COMMAND}\" -E false)
+add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"not running\")
+")
+ run_cmake_command(stop-on-failure ${CMAKE_CTEST_COMMAND} --stop-on-failure)
+endfunction()
+run_stop_on_failure()
+
function(run_TestAffinity)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestAffinity)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt
new file mode 100644
index 0000000..ba4235d
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt
@@ -0,0 +1 @@
+Errors while running CTest
diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt
new file mode 100644
index 0000000..12c77d0
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt
@@ -0,0 +1,10 @@
+^Test project .*/Tests/RunCMake/CTestCommandLine/stop-on-failure
+ Start 1: test1
+1/2 Test #1: test1 ............................\*\*\*Failed +[0-9.]+ sec
++
+0% tests passed, 1 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests FAILED:
+[ ]+1 - test1 \(Failed\)$