Merge branch 'sk/mingw-tests-workaround'
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 Jul 2014 21:21:12 +0000 (14:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Jul 2014 21:21:12 +0000 (14:21 -0700)
Make tests pass on msysgit by mostly disabling ones that are
infeasible on that platform.

* sk/mingw-tests-workaround:
t800[12]: work around MSys limitation
t9902: mingw-specific fix for gitfile link files
t4210: skip command-line encoding tests on mingw
MinGW: disable legacy encoding tests
t0110/MinGW: skip tests that pass arbitrary bytes on the command line
MinGW: Skip test redirecting to fd 4

t/annotate-tests.sh
t/t0081-line-buffer.sh
t/t0110-urlmatch-normalization.sh
t/t3901-i18n-patch.sh
t/t4201-shortlog.sh
t/t4210-log-i18n.sh
t/t8005-blame-i18n.sh
t/t9902-completion.sh
index 304c7b7d8714f9f985cddcc91ba3006f668de127..071e4d7d3ee9729b5caeb34ffd54ae88b7e1e0d8 100644 (file)
@@ -1,6 +1,17 @@
 # This file isn't used as a test script directly, instead it is
 # sourced from t8001-annotate.sh and t8002-blame.sh.
 
+if test_have_prereq MINGW
+then
+  sanitize_L () {
+       echo "$1" | sed 'sX\(^-L\|,\)\^\?/X&\\;*Xg'
+  }
+else
+  sanitize_L () {
+       echo "$1"
+  }
+fi
+
 check_count () {
        head= &&
        file='file' &&
@@ -10,6 +21,7 @@ check_count () {
                case "$1" in
                -h) head="$2"; shift; shift ;;
                -f) file="$2"; shift; shift ;;
+               -L*) options="$options $(sanitize_L "$1")"; shift ;;
                -*) options="$options $1"; shift ;;
                *) break ;;
                esac
index bd83ed371acb5075b2b3cbb7866d36aa4bd48519..25dba008f3e4904cfe3100d9745a9b324622d779 100755 (executable)
@@ -29,7 +29,7 @@ test_expect_success '0-length read, send along greeting' '
        test_cmp expect actual
 '
 
-test_expect_success 'read from file descriptor' '
+test_expect_success NOT_MINGW 'read from file descriptor' '
        rm -f input &&
        echo hello >expect &&
        echo hello >input &&
index 8d6096d4d15606465d6e2e1abb96e50c6c77f88c..410d5768ca11b1d7e322c135cf18f60f41685b68 100755 (executable)
@@ -117,7 +117,7 @@ test_expect_success 'url general escapes' '
        test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
 '
 
-test_expect_success 'url high-bit escapes' '
+test_expect_success !MINGW 'url high-bit escapes' '
        test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
        test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
        test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
@@ -127,7 +127,10 @@ test_expect_success 'url high-bit escapes' '
        test "$(test-urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
        test "$(test-urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
        test "$(test-urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
-       test "$(test-urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF" &&
+       test "$(test-urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
+'
+
+test_expect_success 'url utf-8 escapes' '
        test "$(test-urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
 '
 
index 31a5770b34466c9ed52a9f00bac27b71fd6e0deb..55c8a2f57677085fe1185cd2e3e6d9a2021fd744 100755 (executable)
@@ -54,10 +54,13 @@ test_expect_success setup '
        git add yours &&
        git commit -s -m "Second on side" &&
 
-       # the second one on the side branch is ISO-8859-1
-       git config i18n.commitencoding ISO8859-1 &&
-       # use author and committer name in ISO-8859-1 to match it.
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       if test_have_prereq NOT_MINGW
+       then
+               # the second one on the side branch is ISO-8859-1
+               git config i18n.commitencoding ISO8859-1 &&
+               # use author and committer name in ISO-8859-1 to match it.
+               . "$TEST_DIRECTORY"/t3901-8859-1.txt
+       fi &&
        test_tick &&
        echo Yet another >theirs &&
        git add theirs &&
@@ -119,7 +122,7 @@ test_expect_success 'rebase (U/L)' '
        check_encoding 2
 '
 
-test_expect_success 'rebase (L/L)' '
+test_expect_success NOT_MINGW 'rebase (L/L)' '
        # In this test we want ISO-8859-1 encoded commits as the result
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding ISO8859-1 &&
@@ -131,7 +134,7 @@ test_expect_success 'rebase (L/L)' '
        check_encoding 2 8859
 '
 
-test_expect_success 'rebase (L/U)' '
+test_expect_success NOT_MINGW 'rebase (L/U)' '
        # This is pathological -- use UTF-8 as intermediate form
        # to get ISO-8859-1 results.
        git config i18n.commitencoding ISO8859-1 &&
@@ -159,7 +162,7 @@ test_expect_success 'cherry-pick(U/U)' '
        check_encoding 3
 '
 
-test_expect_success 'cherry-pick(L/L)' '
+test_expect_success NOT_MINGW 'cherry-pick(L/L)' '
        # Both the commitencoding and logoutputencoding is set to ISO-8859-1
 
        git config i18n.commitencoding ISO8859-1 &&
@@ -189,7 +192,7 @@ test_expect_success 'cherry-pick(U/L)' '
        check_encoding 3
 '
 
-test_expect_success 'cherry-pick(L/U)' '
+test_expect_success NOT_MINGW 'cherry-pick(L/U)' '
        # Again, the commitencoding is set to ISO-8859-1 but
        # logoutputencoding is set to UTF-8.
 
index 97fcb31d6eb516b195e9e26a8716dbf484fcc616..565c020c45434bf151d7a142ebe1a1cca3299ab4 100755 (executable)
@@ -93,7 +93,7 @@ test_expect_success 'output from user-defined format is re-wrapped' '
        test_cmp expect log.predictable
 '
 
-test_expect_success 'shortlog wrapping' '
+test_expect_success NOT_MINGW 'shortlog wrapping' '
        cat >expect <<\EOF &&
 A U Thor (5):
       Test
@@ -114,7 +114,7 @@ EOF
        test_cmp expect out
 '
 
-test_expect_success 'shortlog from non-git directory' '
+test_expect_success NOT_MINGW 'shortlog from non-git directory' '
        git log HEAD >log &&
        GIT_DIR=non-existing git shortlog -w <log >out &&
        test_cmp expect out
@@ -159,7 +159,7 @@ $DSCHO (2):
 
 EOF
 
-test_expect_success 'shortlog encoding' '
+test_expect_success NOT_MINGW 'shortlog encoding' '
        git reset --hard "$commit" &&
        git config --unset i18n.commitencoding &&
        echo 2 > a1 &&
index 52a74729ba54105756956f52ff1442a1bd8e649f..9110404e55eaacd10a73d7d4b2bae7f288a031b1 100755 (executable)
@@ -34,7 +34,7 @@ test_expect_success 'log --grep searches in log output encoding (utf8)' '
        test_cmp expect actual
 '
 
-test_expect_success 'log --grep searches in log output encoding (latin1)' '
+test_expect_success NOT_MINGW 'log --grep searches in log output encoding (latin1)' '
        cat >expect <<-\EOF &&
        latin1
        utf8
@@ -43,7 +43,7 @@ test_expect_success 'log --grep searches in log output encoding (latin1)' '
        test_cmp expect actual
 '
 
-test_expect_success 'log --grep does not find non-reencoded values (utf8)' '
+test_expect_success NOT_MINGW 'log --grep does not find non-reencoded values (utf8)' '
        >expect &&
        git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
        test_cmp expect actual
index cb390559f947fe3cd89a99b9bd473d60c7083307..a6e73d063544a5856647d5cb9dc1260a0454f7ff 100755 (executable)
@@ -33,7 +33,7 @@ author $SJIS_NAME
 summary $SJIS_MSG
 EOF
 
-test_expect_success \
+test_expect_success NOT_MINGW \
        'blame respects i18n.commitencoding' '
        git blame --incremental file | \
                egrep "^(author|summary) " > actual &&
@@ -49,7 +49,7 @@ author $EUC_JAPAN_NAME
 summary $EUC_JAPAN_MSG
 EOF
 
-test_expect_success \
+test_expect_success NOT_MINGW \
        'blame respects i18n.logoutputencoding' '
        git config i18n.logoutputencoding eucJP &&
        git blame --incremental file | \
@@ -66,7 +66,7 @@ author $UTF8_NAME
 summary $UTF8_MSG
 EOF
 
-test_expect_success \
+test_expect_success NOT_MINGW \
        'blame respects --encoding=UTF-8' '
        git blame --incremental --encoding=UTF-8 file | \
                egrep "^(author|summary) " > actual &&
@@ -82,7 +82,7 @@ author $UTF8_NAME
 summary $UTF8_MSG
 EOF
 
-test_expect_success \
+test_expect_success NOT_MINGW \
        'blame respects --encoding=none' '
        git blame --incremental --encoding=none file | \
                egrep "^(author|summary) " > actual &&
index 1d1c1063a38866f1792f9b451a4942d06c91edb4..f10a75290e6e854763d10fa571b8c50901dce981 100755 (executable)
@@ -212,9 +212,18 @@ test_expect_success '__gitdir - non-existing $GIT_DIR' '
        )
 '
 
+function pwd_P_W () {
+       if test_have_prereq MINGW
+       then
+               pwd -W
+       else
+               pwd -P
+       fi
+}
+
 test_expect_success '__gitdir - gitfile in cwd' '
-       echo "$(pwd -P)/otherrepo/.git" >expected &&
-       echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
+       echo "$(pwd_P_W)/otherrepo/.git" >expected &&
+       echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
        test_when_finished "rm -f subdir/.git" &&
        (
                cd subdir &&
@@ -224,8 +233,8 @@ test_expect_success '__gitdir - gitfile in cwd' '
 '
 
 test_expect_success '__gitdir - gitfile in parent' '
-       echo "$(pwd -P)/otherrepo/.git" >expected &&
-       echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
+       echo "$(pwd_P_W)/otherrepo/.git" >expected &&
+       echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
        test_when_finished "rm -f subdir/.git" &&
        (
                cd subdir/subsubdir &&