diff options
author | Brad King <brad.king@kitware.com> | 2020-04-22 12:38:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-22 12:38:33 (GMT) |
commit | f9fbc78cd638c1bb874ffd24531f98c095ca1377 (patch) | |
tree | 75df921366553c93063bbec443fe207a48767ae6 /Tests | |
parent | 370def7b3e3205ba47c0634ab99f8cdf28ff4dae (diff) | |
parent | e89aeba5c4733964db15e0d147e063af34205d54 (diff) | |
download | CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.zip CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.tar.gz CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.tar.bz2 |
Merge topic 'ctest_stop_on_failure_16628'
e89aeba5c4 ctest: add option --stop-on-failure
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4630
Diffstat (limited to 'Tests')
6 files changed, 51 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index c76314a..e05ad79 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\)$ 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\)$ |