summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-23 13:18:26 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-23 13:18:26 (GMT)
commitcc8b8cdc751ff2dfa6e77a69da542d6aef066346 (patch)
tree53088db771ef7cebaf89157fe4b081e4417a74b2 /Tests/RunCMake
parentd67196d0e8c5e9feb99d3a609d060f52ad8b9a59 (diff)
parent6bce027662588b972602e2e74c16a1883ed853cf (diff)
downloadCMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.zip
CMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.tar.gz
CMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.tar.bz2
Merge topic 'ctest-repeat-until-fail'
6bce0276 Help: Add notes for topic 'ctest-repeat-until-fail' fde70a1b ctest: Add a new --repeat-until-fail option
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/CTestCommandLine/init.cmake3
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake15
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt30
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/test1.cmake13
14 files changed, 97 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 7cbc9fe..fa249c7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -199,6 +199,7 @@ add_RunCMake_test(CommandLine)
add_RunCMake_test(install)
add_RunCMake_test(CPackInstallProperties)
add_RunCMake_test(ExternalProject)
+add_RunCMake_test(CTestCommandLine)
set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
new file mode 100644
index 0000000..2e5156c
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -0,0 +1,25 @@
+include(RunCMake)
+
+run_cmake_command(repeat-until-fail-bad1
+ ${CMAKE_CTEST_COMMAND} --repeat-until-fail
+ )
+run_cmake_command(repeat-until-fail-bad2
+ ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo
+ )
+run_cmake_command(repeat-until-fail-good
+ ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2
+ )
+
+function(run_repeat_until_fail_tests)
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(repeat-until-fail-cmake)
+ run_cmake_command(repeat-until-fail-ctest
+ ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3
+ )
+endfunction()
+run_repeat_until_fail_tests()
diff --git a/Tests/RunCMake/CTestCommandLine/init.cmake b/Tests/RunCMake/CTestCommandLine/init.cmake
new file mode 100644
index 0000000..a900f67
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/init.cmake
@@ -0,0 +1,3 @@
+# This is run by test initialization in repeat-until-fail-cmake.cmake
+# with cmake -P. It creates TEST_OUTPUT_FILE with a 0 in it.
+file(WRITE "${TEST_OUTPUT_FILE}" "0")
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt
new file mode 100644
index 0000000..5ea8816
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: '--repeat-until-fail' requires an argument$
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt
new file mode 100644
index 0000000..a79faae
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: '--repeat-until-fail' given non-integer value 'foo'$
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake
new file mode 100644
index 0000000..4654416
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake
@@ -0,0 +1,15 @@
+enable_testing()
+
+set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt")
+add_test(NAME initialization
+ COMMAND ${CMAKE_COMMAND}
+ "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake")
+add_test(NAME test1
+ COMMAND ${CMAKE_COMMAND}
+ "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake")
+set_tests_properties(test1 PROPERTIES DEPENDS "initialization")
+
+add_test(hello ${CMAKE_COMMAND} -E echo hello)
+add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye)
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt
new file mode 100644
index 0000000..7593783
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt
@@ -0,0 +1 @@
+^Errors while running CTest$
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt
new file mode 100644
index 0000000..0bc4f70
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt
@@ -0,0 +1,30 @@
+^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build
+ Start 1: initialization
+ Test #1: initialization ................... Passed [0-9.]+ sec
+ Start 1: initialization
+ Test #1: initialization ................... Passed [0-9.]+ sec
+ Start 1: initialization
+1/4 Test #1: initialization ................... Passed [0-9.]+ sec
+ Start 2: test1
+ Test #2: test1 ............................ Passed [0-9.]+ sec
+ Start 2: test1
+ Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec
+ Start 3: hello
+ Test #3: hello ............................ Passed [0-9.]+ sec
+ Start 3: hello
+ Test #3: hello ............................ Passed [0-9.]+ sec
+ Start 3: hello
+3/4 Test #3: hello ............................ Passed [0-9.]+ sec
+ Start 4: goodbye
+ Test #4: goodbye .......................... Passed [0-9.]+ sec
+ Start 4: goodbye
+ Test #4: goodbye .......................... Passed [0-9.]+ sec
+ Start 4: goodbye
+4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec
++
+75% tests passed, 1 tests failed out of 4
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests FAILED:
+[ ]+2 - test1 \(Failed\)$
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt
new file mode 100644
index 0000000..a7c4b11
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt
@@ -0,0 +1 @@
+^No tests were found!!!$
diff --git a/Tests/RunCMake/CTestCommandLine/test1.cmake b/Tests/RunCMake/CTestCommandLine/test1.cmake
new file mode 100644
index 0000000..eeae7a2
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test1.cmake
@@ -0,0 +1,13 @@
+# This is run by test test1 in repeat-until-fail-cmake.cmake with cmake -P.
+# It reads the file TEST_OUTPUT_FILE and increments the number
+# found in the file by 1. When the number is 2, then the
+# code sends out a cmake error causing the test to fail
+# the second time it is run.
+message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}")
+file(READ "${TEST_OUTPUT_FILE}" COUNT)
+message("COUNT= ${COUNT}")
+math(EXPR COUNT "${COUNT} + 1")
+file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}")
+if(${COUNT} EQUAL 2)
+ message(FATAL_ERROR "this test fails on the 2nd run")
+endif()