diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 33 | ||||
-rw-r--r-- | Tests/CMakeTests/CheckSourceTreeTest.cmake.in | 54 | ||||
-rw-r--r-- | Tests/CTestTestParallel/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CTestUpdateBZR.cmake.in | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateCVS.cmake.in | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateCommon.cmake | 18 | ||||
-rw-r--r-- | Tests/CTestUpdateGIT.cmake.in | 77 | ||||
-rwxr-xr-x | Tests/CTestUpdateGIT.sh.in | 2 | ||||
-rw-r--r-- | Tests/CTestUpdateHG.cmake.in | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateSVN.cmake.in | 4 | ||||
-rw-r--r-- | Tests/bootstrap.bat.in | 2 |
11 files changed, 157 insertions, 47 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1b8f4f3..2c7056d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1076,7 +1076,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline - ${CMAKE_COMMAND} -E echo_append "This line has no newline!") + ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!") # A simple test for ctest in script mode CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in" @@ -1470,13 +1470,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log" - ) - # these tests take a long time, make sure they have it # if timeouts have not already been set GET_TEST_PROPERTY(CTestTest TIMEOUT PREVIOUS_TIMEOUT) @@ -1490,12 +1483,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES ( CTestTest2 PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - - GET_TEST_PROPERTY(CTestTest3 TIMEOUT PREVIOUS_TIMEOUT) - IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - SET_TESTS_PROPERTIES ( CTestTest3 - PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) IF(NOT DEFINED CTEST_RUN_CTestSubmitLargeOutput) @@ -1572,16 +1559,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # If there is CMakeLists.txt in the binary tree, assume in-source build SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) ENDIF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt") - IF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) - - + SET(bootstrap "") + IF(CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) + IF(UNIX) + SET(bootstrap ${CMake_SOURCE_DIR}/bootstrap) + ELSEIF(MSYS) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap.bat.in + ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat @ONLY) + SET(bootstrap ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat) + ENDIF() + ENDIF() + IF(bootstrap) ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND} --build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR}/Tests/BootstrapTest --build-nocmake --build-noclean - --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap + --build-makeprogram ${bootstrap} --build-generator "${CMAKE_TEST_GENERATOR}" --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) @@ -1595,7 +1590,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES ( BootstrapTest PROPERTIES TIMEOUT 5400) ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) + ENDIF() # fortran does not work for IDE builds because # CMAKE_STANDARD_LIBRARIES needs to be per language diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 39289f0..9150aef 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -128,6 +128,51 @@ if(is_cvs_checkout AND CVS_EXECUTABLE) endif() +# If no GIT_EXECUTABLE, see if we can figure out which git was used +# for the ctest_update step on this dashboard... +# +if(is_git_checkout AND NOT GIT_EXECUTABLE) + set(ctest_ini_file "") + set(exe "") + + # Use the old name: + if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl") + set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl") + endif() + + # But if it exists, prefer the new name: + if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini") + set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini") + endif() + + # If there is a ctest ini file, read the update command or git command + # from it: + # + if(ctest_ini_file) + file(STRINGS "${ctest_ini_file}" lines REGEX "^GITCommand: (.*)$") + string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" exe "${lines}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + + if(NOT exe) + file(STRINGS "${ctest_ini_file}" lines REGEX "^UpdateCommand: (.*)$") + string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" exe "${lines}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + endif() + endif() + + if(exe) + set(GIT_EXECUTABLE "${exe}") + message("info: set GIT_EXECUTABLE to '${GIT_EXECUTABLE}' based on '${ctest_ini_file}'") + else() + message(FATAL_ERROR "could not determine GIT_EXECUTABLE based on '${ctest_ini_file}'...") + endif() +endif() + + if(is_git_checkout AND GIT_EXECUTABLE) # Check with "git status" if there are any local modifications to the # CMake source tree: @@ -154,6 +199,15 @@ if(is_git_checkout AND GIT_EXECUTABLE) message("=== end output ===") message("") + execute_process(COMMAND ${GIT_EXECUTABLE} log -1 + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE git_log_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'git log -1' ===") + message("${git_log_output}") + message("=== end output ===") + message("") + message("Copy/paste this command to reproduce:") message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status") message("") diff --git a/Tests/CTestTestParallel/CMakeLists.txt b/Tests/CTestTestParallel/CMakeLists.txt index 8fab44b..fc53f68 100644 --- a/Tests/CTestTestParallel/CMakeLists.txt +++ b/Tests/CTestTestParallel/CMakeLists.txt @@ -11,3 +11,5 @@ SET_TESTS_PROPERTIES(TestRunSerial1 TestRunSerial2 PROPERTIES RUN_SERIAL true) ADD_TEST (TestProcessorsGreaterThanMPL1 LockFile) ADD_TEST (TestProcessorsGreaterThanMPL2 LockFile) SET_TESTS_PROPERTIES(TestProcessorsGreaterThanMPL1 PROPERTIES PROCESSORS 10) +SET_TESTS_PROPERTIES(TestProcessorsGreaterThanMPL1 PROPERTIES DEPENDS + TestProcessorsGreaterThanMPL2) diff --git a/Tests/CTestUpdateBZR.cmake.in b/Tests/CTestUpdateBZR.cmake.in index 7f90b50..c654f47 100644 --- a/Tests/CTestUpdateBZR.cmake.in +++ b/Tests/CTestUpdateBZR.cmake.in @@ -142,7 +142,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# bzr command configuration set(CTEST_BZR_COMMAND \"${BZR}\") set(CTEST_CHECKOUT_COMMAND @@ -150,4 +150,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 6f31a2c..a04673e 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -147,7 +147,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# CVS command configuration set(CTEST_CVS_COMMAND \"${CVS}\") set(CTEST_CVS_UPDATE_OPTIONS -dAP) @@ -156,4 +156,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 266f4b3..a52cb14 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -165,15 +165,15 @@ endfunction(create_build_tree) #----------------------------------------------------------------------------- # Function to write the dashboard test script. -function(create_dashboard_script name custom_text) +function(create_dashboard_script bin_dir custom_text) # Write the dashboard script. - file(WRITE ${TOP}/dashboard.cmake + file(WRITE ${TOP}/${bin_dir}.cmake "# CTest Dashboard Script set(CTEST_DASHBOARD_ROOT \"${TOP}\") set(CTEST_SITE test.site) set(CTEST_BUILD_NAME dash-test) set(CTEST_SOURCE_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-source) -set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-binary) +set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) @@ -191,27 +191,31 @@ function(run_dashboard_command_line bin_dir) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir}) + set(_modified Modified{CTestConfig.cmake}) + if(UPDATE_NO_MODIFIED) + set(_modified "") + endif() check_updates(${bin_dir} Updated{foo.txt} Updated{bar.txt} Updated{zot.txt} Updated{subdir/foo.txt} Updated{subdir/bar.txt} - Modified{CTestConfig.cmake} + ${_modified} ) endfunction(run_dashboard_command_line) #----------------------------------------------------------------------------- # Function to run the dashboard through a script -function(run_dashboard_script name) +function(run_dashboard_script bin_dir) run_child( WORKING_DIRECTORY ${TOP} - COMMAND ${CMAKE_CTEST_COMMAND} -S ${name} -V + COMMAND ${CMAKE_CTEST_COMMAND} -S ${bin_dir}.cmake -V ) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir}) - check_updates(dash-binary + check_updates(${bin_dir} Updated{foo.txt} Updated{bar.txt} Updated{zot.txt} diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index f0a5770..f672a52 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -131,6 +131,22 @@ run_child( COMMAND ${GIT} submodule update ) +# Save the first revision name. +execute_process( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${GIT} rev-parse HEAD + OUTPUT_VARIABLE revision1 + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +#----------------------------------------------------------------------------- +# Create an empty commit. +message("Creating empty commit...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${GIT} commit --allow-empty -m "Empty commit" + ) + #----------------------------------------------------------------------------- # Make changes in the working tree. message("Changing content...") @@ -192,15 +208,18 @@ run_child( #----------------------------------------------------------------------------- # Go back to before the changes so we can test updating. -message("Backing up to revision 1...") -run_child( - WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} reset --hard master~2 - ) -run_child( - WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} submodule update - ) +macro(rewind_source src_dir) + message("Backing up to revision 1...") + run_child( + WORKING_DIRECTORY ${TOP}/${src_dir} + COMMAND ${GIT} reset --hard ${revision1} + ) + run_child( + WORKING_DIRECTORY ${TOP}/${src_dir} + COMMAND ${GIT} submodule update + ) +endmacro(rewind_source) +rewind_source(user-source) # Make sure pull does not try to rebase (which does not work with # modified files) even if ~/.gitconfig sets "branch.master.rebase". @@ -224,13 +243,31 @@ UpdateCommand: ${GIT} ") # Run the dashboard command line interface. +set(UPDATE_NO_MODIFIED 1) run_dashboard_command_line(user-binary) +set(UPDATE_NO_MODIFIED 0) + +rewind_source(user-source) +modify_content(user-source) + +message("Running CTest Dashboard Command Line (custom update)...") + +# Create the user build tree. +create_build_tree(user-source user-binary-custom) +file(APPEND ${TOP}/user-binary-custom/CTestConfiguration.ini + "# GIT command configuration +UpdateCommand: ${GIT} +GITUpdateCustom: ${GIT};pull;origin;master +") + +# Run the dashboard command line interface. +run_dashboard_command_line(user-binary-custom) #----------------------------------------------------------------------------- # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) @@ -240,7 +277,7 @@ execute_process( ) execute_process( WORKING_DIRECTORY \"${TOP}/dash-source\" - COMMAND \"${GIT}\" reset --hard master~2 + COMMAND \"${GIT}\" reset --hard ${revision1} ) execute_process( WORKING_DIRECTORY \"${TOP}/dash-source\" @@ -253,4 +290,20 @@ execute_process( ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) + +rewind_source(dash-source) + +#----------------------------------------------------------------------------- +# Test custom update with a dashboard script. +message("Running CTest Dashboard Script (custom update)...") + +create_dashboard_script(dash-binary-custom + "# git command configuration +set(CTEST_GIT_COMMAND \"${GIT}\") +set(CTEST_GIT_UPDATE_OPTIONS) +set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) +") + +# Run the dashboard script with CTest. +run_dashboard_script(dash-binary-custom) diff --git a/Tests/CTestUpdateGIT.sh.in b/Tests/CTestUpdateGIT.sh.in index 4761d32..e7586d6 100755 --- a/Tests/CTestUpdateGIT.sh.in +++ b/Tests/CTestUpdateGIT.sh.in @@ -1,5 +1,5 @@ #!/bin/sh -if test "x$1" = "xpull"; then +if test "x$1" = "xpull" -o "x$1" = "xreset"; then "@GIT@" "$@" && sleep 1 && touch foo.txt else exec "@GIT@" "$@" diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index f2e5f83..543ddd9 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -145,7 +145,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# hg command configuration set(CTEST_HG_COMMAND \"${HG}\") set(CTEST_HG_UPDATE_OPTIONS) @@ -160,4 +160,4 @@ execute_process( ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index 509597b..97b2a07 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -127,7 +127,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# Subversion command configuration set(CTEST_SVN_COMMAND \"${SVN}\") set(CTEST_SVN_UPDATE_OPTIONS @@ -137,4 +137,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/bootstrap.bat.in b/Tests/bootstrap.bat.in new file mode 100644 index 0000000..aeb24b1 --- /dev/null +++ b/Tests/bootstrap.bat.in @@ -0,0 +1,2 @@ +@echo off +sh "@CMake_SOURCE_DIR@/bootstrap" %* |