summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorKevin Puetz <PuetzKevinA@JohnDeere.com>2020-04-03 20:07:01 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-26 15:27:05 (GMT)
commit6a6f1d1edd73902053d215ce3dc12267f05501e2 (patch)
tree9485d231fb1020279f1bc5bba862c33881bdf9be /Tests/RunCMake
parent6cbaa8eb931950b8a834acc0c6f78a7290c4d3d9 (diff)
downloadCMake-6a6f1d1edd73902053d215ce3dc12267f05501e2.zip
CMake-6a6f1d1edd73902053d215ce3dc12267f05501e2.tar.gz
CMake-6a6f1d1edd73902053d215ce3dc12267f05501e2.tar.bz2
CTest: exit nonzero after message(SEND_ERROR|FATAL_ERROR)
Fixes: #21004
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CTest/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/CTest/TestfileErrors-Script.cmake4
-rw-r--r--Tests/RunCMake/CTest/TestfileErrors-test-result.txt1
-rw-r--r--Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt11
-rw-r--r--Tests/RunCMake/CTest/TestfileErrors.cmake3
-rw-r--r--Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt1
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt1
-rw-r--r--Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt1
-rw-r--r--Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt1
-rw-r--r--Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt1
-rw-r--r--Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt1
15 files changed, 38 insertions, 3 deletions
diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake
index 761224a..62606f8 100644
--- a/Tests/RunCMake/CTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake
@@ -18,3 +18,12 @@ function(run_CMakeCTestArguments)
run_cmake_command(CMakeCTestArguments-test ${CMAKE_COMMAND} --build . --config Debug --target "${test}")
endfunction()
run_CMakeCTestArguments()
+
+function(run_TestfileErrors)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestfileErrors-build)
+ run_cmake(TestfileErrors)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(TestfileErrors-build ${CMAKE_COMMAND} --build . --config Debug)
+ run_cmake_command(TestfileErrors-test ${CMAKE_CTEST_COMMAND} -C Debug)
+endfunction()
+run_TestfileErrors()
diff --git a/Tests/RunCMake/CTest/TestfileErrors-Script.cmake b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake
new file mode 100644
index 0000000..d9fc7c8
--- /dev/null
+++ b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake
@@ -0,0 +1,4 @@
+message(SEND_ERROR "SEND_ERROR")
+message(FATAL_ERROR "FATAL_ERROR")
+# This shouldn't get printed because the script aborts on FATAL_ERROR
+message(SEND_ERROR "reaching the unreachable")
diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-result.txt b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt
new file mode 100644
index 0000000..a3a476b
--- /dev/null
+++ b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at [^
+]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:1 \(message\):
+ SEND_ERROR
+Call Stack \(most recent call first\):
+ CTestTestfile.cmake:[0-9]+ \(include\)
++
+CMake Error at [^
+]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:2 \(message\):
+ FATAL_ERROR
+Call Stack \(most recent call first\):
+ CTestTestfile.cmake:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CTest/TestfileErrors.cmake b/Tests/RunCMake/CTest/TestfileErrors.cmake
new file mode 100644
index 0000000..676eb47
--- /dev/null
+++ b/Tests/RunCMake/CTest/TestfileErrors.cmake
@@ -0,0 +1,3 @@
+include(CTest)
+add_test(NAME "unreachable" COMMAND ${CMAKE_COMMAND} -E true)
+set_property(DIRECTORY PROPERTY TEST_INCLUDE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TestfileErrors-Script.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
index d95bb33..97e2a10 100644
--- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
+++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
@@ -1,4 +1,4 @@
^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\):
subdirs called with incorrect number of arguments
+
-No tests were found!!!$
+Errors while running CTest$
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
index ba4235d..19310b8 100644
--- a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
@@ -1 +1,2 @@
+^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputSize/DartConfiguration.tcl
Errors while running CTest
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt
index ec2cf2c..296e426 100644
--- a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt
+++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt
@@ -2,4 +2,4 @@ CMake Error at CTestTestfile.cmake:[0-9]+:
Parse error\. Function missing ending "\)"\. End of file reached\.
-No tests were found!!!
+Errors while running CTest
diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt
index ec2cf2c..296e426 100644
--- a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt
+++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt
@@ -2,4 +2,4 @@ CMake Error at CTestTestfile.cmake:[0-9]+:
Parse error\. Function missing ending "\)"\. End of file reached\.
-No tests were found!!!
+Errors while running CTest
diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt
@@ -0,0 +1 @@
+[^0]