diff options
author | Brad King <brad.king@kitware.com> | 2023-05-23 15:06:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-05-23 15:06:19 (GMT) |
commit | d491ea197332abec3fe082397904bc12175d1044 (patch) | |
tree | 861e4b2f804ff15fdbe85c4aac2f83baef17e070 /Tests | |
parent | 6503ce94349e30b0ca5bba76ba0dd2279126fd92 (diff) | |
parent | 8cc45e150a8b95067a5ef09a2350dcd6f3124c7a (diff) | |
download | CMake-d491ea197332abec3fe082397904bc12175d1044.zip CMake-d491ea197332abec3fe082397904bc12175d1044.tar.gz CMake-d491ea197332abec3fe082397904bc12175d1044.tar.bz2 |
Merge topic 'ep-update-disconnected'
8cc45e150a ExternalProject: Make hg download method respect UPDATE_DISCONNECTED
1512dc43cb ExternalProject: Avoid reconfigure when updates are disconnected
1d29cf37a1 Tests: Reduce warning noise in ExternalProjectUpdate test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8498
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ExternalProjectUpdate/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake | 42 |
2 files changed, 30 insertions, 17 deletions
diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt index 1b84ff3..e8c67b8 100644 --- a/Tests/ExternalProjectUpdate/CMakeLists.txt +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -70,7 +70,9 @@ if(NOT TEST_GIT_TAG) endif() if(do_git_tests) - set(local_git_repo "../../LocalRepositories/GIT") + cmake_path(SET local_git_repo NORMALIZE + "${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT" + ) # Unzip/untar the git repository in our source folder so that other # projects below may use it to test git args of ExternalProject_Add @@ -79,6 +81,7 @@ if(do_git_tests) ExternalProject_Add(${proj} SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz + DOWNLOAD_EXTRACT_TIMESTAMP NO BUILD_COMMAND "" CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version INSTALL_COMMAND "" diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index 394df87..08e533b 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -1,8 +1,14 @@ # Set the ExternalProject GIT_TAG to desired_tag, and make sure the # resulting checked out version is resulting_sha and rebuild. # This check's the correct behavior of the ExternalProject UPDATE_COMMAND. -# Also verify that a fetch only occurs when fetch_expected is 1. -macro(check_a_tag desired_tag resulting_sha fetch_expected update_strategy) +# Also verify that a fetch only occurs when fetch_expected_tsX is 1. +macro(check_a_tag + desired_tag + resulting_sha + fetch_expected_ts1 # TutorialStep1-GIT + fetch_expected_ts2 # TutorialStep2-GIT + update_strategy +) message( STATUS "Checking ExternalProjectUpdate to tag: ${desired_tag}" ) # Remove the FETCH_HEAD file, so we can check if it gets replaced with a 'git @@ -12,7 +18,11 @@ macro(check_a_tag desired_tag resulting_sha fetch_expected update_strategy) # Give ourselves a marker in the output. It is difficult to tell where we # are up to without this - message(STATUS "===> check_a_tag ${desired_tag} ${resulting_sha} ${fetch_expected} ${update_strategy}") + message(STATUS "===> check_a_tag: " + "${desired_tag} ${resulting_sha} " + "${fetch_expected_ts1} ${fetch_expected_ts2} " + "${update_strategy}" + ) # Configure execute_process(COMMAND ${CMAKE_COMMAND} @@ -58,10 +68,10 @@ was expected." ) endif() - if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected}) + if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected_ts1}) message( FATAL_ERROR "Fetch did NOT occur when it was expected.") endif() - if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected}) + if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected_ts1}) message( FATAL_ERROR "Fetch DID occur when it was not expected.") endif() @@ -154,10 +164,10 @@ was expected." ) endif() - if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected}) + if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected_ts2}) message( FATAL_ERROR "Fetch did NOT occur when it was expected.") endif() - if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected}) + if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected_ts2}) message( FATAL_ERROR "Fetch DID occur when it was not expected.") endif() endmacro() @@ -179,16 +189,16 @@ endif() file(REMOVE_RECURSE ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals) if(do_git_tests) - check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) - check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE) + check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 1 0 REBASE) # With the Git UPDATE_COMMAND performance patch, this will not require a # 'git fetch' - check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 0 REBASE) - check_a_tag(tag2 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) - check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 0 REBASE) - check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) + check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 0 0 REBASE) + check_a_tag(tag2 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 0 REBASE) + check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 0 0 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE) # This is a remote symbolic ref, so it will always trigger a 'git fetch' - check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE) foreach(strategy IN ITEMS CHECKOUT REBASE_CHECKOUT) # Move local master back, then apply a change that will cause a conflict @@ -222,7 +232,7 @@ if(do_git_tests) message(FATAL_ERROR "Could not commit conflicting change.") endif() # This should discard our commit but leave behind an annotated tag - check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 ${strategy}) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 ${strategy}) endforeach() # This file matches a .gitignore rule that the last commit defines. We can't @@ -232,7 +242,7 @@ if(do_git_tests) # doesn't choke on it. set(ignoredFile ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT/ignored_item) file(TOUCH ${ignoredFile}) - check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE) if(NOT EXISTS ${ignoredFile}) message(FATAL_ERROR "Ignored file is missing") endif() |