From 6e7e71e9b97b7041f283b4a755c6baffeabca12f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 9 Feb 2010 13:31:40 -0500 Subject: Teach CTest.UpdateGIT test to fake file timestamp We wrap the git executable in a shell script that touches one source file after 'git pull'. This makes the file newer than the index even though it has not actually changed. If CTest does not refresh the index properly then the test will fail with a bogus modified file. --- Tests/CTestUpdateGIT.cmake.in | 6 ++++++ Tests/CTestUpdateGIT.sh.in | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100755 Tests/CTestUpdateGIT.sh.in diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 8b10600..c721bb4 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -25,6 +25,12 @@ set(AUTHOR_CONFIG "[user] message("Creating test directory...") init_testing() +if(UNIX) + set(src "@CMAKE_CURRENT_SOURCE_DIR@") + configure_file(${src}/CTestUpdateGIT.sh.in ${TOP}/git.sh @ONLY) + set(GIT ${TOP}/git.sh) +endif() + #----------------------------------------------------------------------------- # Create the repository. message("Creating repository...") diff --git a/Tests/CTestUpdateGIT.sh.in b/Tests/CTestUpdateGIT.sh.in new file mode 100755 index 0000000..4761d32 --- /dev/null +++ b/Tests/CTestUpdateGIT.sh.in @@ -0,0 +1,6 @@ +#!/bin/sh +if test "x$1" = "xpull"; then + "@GIT@" "$@" && sleep 1 && touch foo.txt +else + exec "@GIT@" "$@" +fi -- cgit v0.12