summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-21 16:33:56 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-21 18:57:15 (GMT)
commit1ef444d67819afc43444b7b501543eeca284b177 (patch)
tree694c3fd1bdc9e8e59fbf6ed0f0d8c76f4f9afa20 /Tests
parent94389f6388367aa4d9bfa58c9cde89e33d1858dc (diff)
downloadCMake-1ef444d67819afc43444b7b501543eeca284b177.zip
CMake-1ef444d67819afc43444b7b501543eeca284b177.tar.gz
CMake-1ef444d67819afc43444b7b501543eeca284b177.tar.bz2
Add test case to verify CMake does not re-run on first build
Extend the RunCMake.Configure with a case to verify that the CMake configuration process does not immediately re-run the first time that the generated build system is invoked.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Configure/RerunCMake-build1-check.cmake4
-rw-r--r--Tests/RunCMake/Configure/RerunCMake.cmake4
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake15
3 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake b/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake
new file mode 100644
index 0000000..3fb557f
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake
@@ -0,0 +1,4 @@
+file(READ ${stamp} content)
+if(NOT content STREQUAL 1)
+ set(RunCMake_TEST_FAILED "Expected stamp '1' but got: '${content}'")
+endif()
diff --git a/Tests/RunCMake/Configure/RerunCMake.cmake b/Tests/RunCMake/Configure/RerunCMake.cmake
new file mode 100644
index 0000000..854c9a2
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMake.cmake
@@ -0,0 +1,4 @@
+set(input ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeInput.txt)
+set(stamp ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeStamp.txt)
+file(READ ${input} content)
+file(WRITE ${stamp} "${content}")
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
index 79e4060..e748498 100644
--- a/Tests/RunCMake/Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -2,3 +2,18 @@ include(RunCMake)
run_cmake(ErrorLogs)
run_cmake(FailCopyFileABI)
+
+# Use a single build tree for a few tests without cleaning.
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+set(input "${RunCMake_TEST_BINARY_DIR}/CustomCMakeInput.txt")
+set(stamp "${RunCMake_TEST_BINARY_DIR}/CustomCMakeStamp.txt")
+file(WRITE "${input}" "1")
+run_cmake(RerunCMake)
+execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
+file(WRITE "${input}" "2")
+run_cmake_command(RerunCMake-build1 ${CMAKE_COMMAND} --build .)
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)