From: Junio C Hamano Date: Tue, 24 Mar 2009 21:42:50 +0000 (-0700) Subject: Merge branch 'js/windows-tests' X-Git-Tag: v1.6.3-rc0~101 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/78360b576acb0ee47c90552cb3f976a3c6ba4d6a?hp=-c Merge branch 'js/windows-tests' * js/windows-tests: t0060: fix whitespace in "wc -c" invocation t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW t7004: Use prerequisite tags to skip tests that need gpg Use prerequisites to skip tests that need unzip t3700: Skip a test with backslashes in pathspec Skip tests that require a filesystem that obeys POSIX permissions t0060: Fix tests on Windows Use prerequisite tags to skip tests that depend on symbolic links t9100, t9129: Use prerequisite tags for UTF-8 tests t5302: Use prerequisite tags to skip 64-bit offset tests Skip tests that fail if the executable bit is not handled by the filesystem t3600: Use test prerequisite tags test-lib: Infrastructure to test and check for prerequisites t0050: Check whether git init detected symbolic link support correctly Tests on Windows: $(pwd) must return Windows-style paths test-lib: Work around missing sum on Windows test-lib: Work around incompatible sort and find on Windows Conflicts: t/t3000-ls-files-others.sh --- 78360b576acb0ee47c90552cb3f976a3c6ba4d6a diff --combined t/t1300-repo-config.sh index 9c81e041b9,64663e1886..43ea283242 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -118,14 -118,7 +118,14 @@@ EO test_expect_success 'multiple unset is correct' 'cmp .git/config expect' -mv .git/config2 .git/config +cp .git/config2 .git/config + +test_expect_success '--replace-all missing value' ' + test_must_fail git config --replace-all beta.haha && + test_cmp .git/config2 .git/config +' + +rm .git/config2 test_expect_success '--replace-all' \ 'git config --replace-all beta.haha gamma' @@@ -733,7 -726,7 +733,7 @@@ echo >>resul test_expect_success '--null --get-regexp' 'cmp result expect' - test_expect_success 'symlinked configuration' ' + test_expect_success SYMLINKS 'symlinked configuration' ' ln -s notyet myconfig && GIT_CONFIG=myconfig git config test.frotz nitfol && diff --combined t/t3000-ls-files-others.sh index 379d963cea,b7e0306316..86291e8399 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@@ -13,13 -13,17 +13,18 @@@ filesystem path2/file2 - a file in a directory path3-junk - a file to confuse things path3/file3 - a file in a directory + path4 - an empty directory ' . ./test-lib.sh date >path0 - ln -s xyzzy path1 + if test_have_prereq SYMLINKS + then + ln -s xyzzy path1 + else + date > path1 + fi -mkdir path2 path3 +mkdir path2 path3 path4 date >path2/file2 date >path2-junk date >path3/file3 @@@ -29,7 -33,6 +34,7 @@@ git update-index --add path3-junk path3 cat >expected1 <expected2 +cat expected3 +echo path4/ >>expected2 test_expect_success \ 'git ls-files --others to show output.' \ @@@ -57,12 -58,4 +62,12 @@@ test_expect_success 'git ls-files --others --directory should not get confused.' \ 'test_cmp expected2 output' +test_expect_success \ + 'git ls-files --others --directory --no-empty-directory to show output.' \ + 'git ls-files --others --directory --no-empty-directory >output' + +test_expect_success \ + '--no-empty-directory hides empty directory' \ + 'test_cmp expected3 output' + test_done diff --combined t/test-lib.sh index 7ff75644c0,b4b626e837..8de5ee1b58 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -247,6 -247,31 +247,31 @@@ test_chmod () git update-index --add "--chmod=$@" } + # Use test_set_prereq to tell that a particular prerequisite is available. + # The prerequisite can later be checked for in two ways: + # + # - Explicitly using test_have_prereq. + # + # - Implicitly by specifying the prerequisite tag in the calls to + # test_expect_{success,failure,code}. + # + # The single parameter is the prerequisite tag (a simple word, in all + # capital letters by convention). + + test_set_prereq () { + satisfied="$satisfied$1 " + } + satisfied=" " + + test_have_prereq () { + case $satisfied in + *" $1 "*) + : yes, have it ;; + *) + ! : nope ;; + esac + } + # You are not expected to call test_ok_ and test_failure_ directly, use # the text_expect_* functions instead. @@@ -293,6 -318,11 +318,11 @@@ test_skip () to_skip=t esac done + if test -z "$to_skip" && test -n "$prereq" && + ! test_have_prereq "$prereq" + then + to_skip=t + fi case "$to_skip" in t) say_color skip >&3 "skipping test: $@" @@@ -306,8 -336,9 +336,9 @@@ } test_expect_failure () { + test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || - error "bug in the test script: not 2 parameters to test-expect-failure" + error "bug in the test script: not 2 or 3 parameters to test-expect-failure" if ! test_skip "$@" then say >&3 "checking known breakage: $2" @@@ -323,8 -354,9 +354,9 @@@ } test_expect_success () { + test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || - error "bug in the test script: not 2 parameters to test-expect-success" + error "bug in the test script: not 2 or 3 parameters to test-expect-success" if ! test_skip "$@" then say >&3 "expecting success: $2" @@@ -340,8 -372,9 +372,9 @@@ } test_expect_code () { + test "$#" = 4 && { prereq=$1; shift; } || prereq= test "$#" = 3 || - error "bug in the test script: not 3 parameters to test-expect-code" + error "bug in the test script: not 3 or 4 parameters to test-expect-code" if ! test_skip "$@" then say >&3 "expecting exit code $1: $3" @@@ -365,8 -398,9 +398,9 @@@ # Usage: test_external description command arguments... # Example: test_external 'Perl API' perl ../path/to/test.pl test_external () { - test "$#" -eq 3 || - error >&5 "bug in the test script: not 3 parameters to test_external" + test "$#" = 4 && { prereq=$1; shift; } || prereq= + test "$#" = 3 || + error >&5 "bug in the test script: not 3 or 4 parameters to test_external" descr="$1" shift if ! test_skip "$descr" "$@" @@@ -457,7 -491,7 +491,7 @@@ test_create_repo () repo="$1" mkdir -p "$repo" cd "$repo" || error "Cannot setup test environment" - "$GIT_EXEC_PATH/git" init "--template=$owd/../templates/blt/" >&3 2>&4 || + "$GIT_EXEC_PATH/git-init" "--template=$owd/../templates/blt/" >&3 2>&4 || error "cannot run git init -- have you built things yet?" mv .git/hooks .git/hooks-disabled cd "$owd" @@@ -517,16 -551,8 +551,16 @@@ test_done () TEST_DIRECTORY=$(pwd) if test -z "$valgrind" then - PATH=$TEST_DIRECTORY/..:$PATH - GIT_EXEC_PATH=$TEST_DIRECTORY/.. + if test -z "$GIT_TEST_INSTALLED" + then + PATH=$TEST_DIRECTORY/..:$PATH + GIT_EXEC_PATH=$TEST_DIRECTORY/.. + else + GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) || + error "Cannot run git from $GIT_TEST_INSTALLED." + PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH + GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH} + fi else make_symlink () { test -h "$2" && @@@ -643,3 -669,33 +677,33 @@@ d test_done esac done + + # Fix some commands on Windows + case $(uname -s) in + *MINGW*) + # Windows has its own (incompatible) sort and find + sort () { + /usr/bin/sort "$@" + } + find () { + /usr/bin/find "$@" + } + sum () { + md5sum "$@" + } + # git sees Windows-style pwd + pwd () { + builtin pwd -W + } + # no POSIX permissions + # backslashes in pathspec are converted to '/' + ;; + *) + test_set_prereq POSIXPERM + test_set_prereq BSLASHPSPEC + ;; + esac + + # test whether the filesystem supports symbolic links + ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS + rm -f y