Skip to content

Commit c372e7b

Browse files
committed
Merge branch 'sk/mingw-tests-workaround'
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
2 parents 385e171 + e8d0887 commit c372e7b

8 files changed

+51
-24
lines changed

t/annotate-tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# This file isn't used as a test script directly, instead it is
22
# sourced from t8001-annotate.sh and t8002-blame.sh.
33

4+
if test_have_prereq MINGW
5+
then
6+
sanitize_L () {
7+
echo "$1" | sed 'sX\(^-L\|,\)\^\?/X&\\;*Xg'
8+
}
9+
else
10+
sanitize_L () {
11+
echo "$1"
12+
}
13+
fi
14+
415
check_count () {
516
head= &&
617
file='file' &&
@@ -10,6 +21,7 @@ check_count () {
1021
case "$1" in
1122
-h) head="$2"; shift; shift ;;
1223
-f) file="$2"; shift; shift ;;
24+
-L*) options="$options $(sanitize_L "$1")"; shift ;;
1325
-*) options="$options $1"; shift ;;
1426
*) break ;;
1527
esac

t/t0081-line-buffer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test_expect_success '0-length read, send along greeting' '
2929
test_cmp expect actual
3030
'
3131

32-
test_expect_success 'read from file descriptor' '
32+
test_expect_success NOT_MINGW 'read from file descriptor' '
3333
rm -f input &&
3434
echo hello >expect &&
3535
echo hello >input &&

t/t0110-urlmatch-normalization.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test_expect_success 'url general escapes' '
117117
test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
118118
'
119119

120-
test_expect_success 'url high-bit escapes' '
120+
test_expect_success !MINGW 'url high-bit escapes' '
121121
test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
122122
test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
123123
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' '
127127
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" &&
128128
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" &&
129129
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" &&
130-
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" &&
130+
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"
131+
'
132+
133+
test_expect_success 'url utf-8 escapes' '
131134
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"
132135
'
133136

t/t3901-i18n-patch.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ test_expect_success setup '
5454
git add yours &&
5555
git commit -s -m "Second on side" &&
5656
57-
# the second one on the side branch is ISO-8859-1
58-
git config i18n.commitencoding ISO8859-1 &&
59-
# use author and committer name in ISO-8859-1 to match it.
60-
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
57+
if test_have_prereq NOT_MINGW
58+
then
59+
# the second one on the side branch is ISO-8859-1
60+
git config i18n.commitencoding ISO8859-1 &&
61+
# use author and committer name in ISO-8859-1 to match it.
62+
. "$TEST_DIRECTORY"/t3901-8859-1.txt
63+
fi &&
6164
test_tick &&
6265
echo Yet another >theirs &&
6366
git add theirs &&
@@ -119,7 +122,7 @@ test_expect_success 'rebase (U/L)' '
119122
check_encoding 2
120123
'
121124

122-
test_expect_success 'rebase (L/L)' '
125+
test_expect_success NOT_MINGW 'rebase (L/L)' '
123126
# In this test we want ISO-8859-1 encoded commits as the result
124127
git config i18n.commitencoding ISO8859-1 &&
125128
git config i18n.logoutputencoding ISO8859-1 &&
@@ -131,7 +134,7 @@ test_expect_success 'rebase (L/L)' '
131134
check_encoding 2 8859
132135
'
133136

134-
test_expect_success 'rebase (L/U)' '
137+
test_expect_success NOT_MINGW 'rebase (L/U)' '
135138
# This is pathological -- use UTF-8 as intermediate form
136139
# to get ISO-8859-1 results.
137140
git config i18n.commitencoding ISO8859-1 &&
@@ -159,7 +162,7 @@ test_expect_success 'cherry-pick(U/U)' '
159162
check_encoding 3
160163
'
161164

162-
test_expect_success 'cherry-pick(L/L)' '
165+
test_expect_success NOT_MINGW 'cherry-pick(L/L)' '
163166
# Both the commitencoding and logoutputencoding is set to ISO-8859-1
164167
165168
git config i18n.commitencoding ISO8859-1 &&
@@ -189,7 +192,7 @@ test_expect_success 'cherry-pick(U/L)' '
189192
check_encoding 3
190193
'
191194

192-
test_expect_success 'cherry-pick(L/U)' '
195+
test_expect_success NOT_MINGW 'cherry-pick(L/U)' '
193196
# Again, the commitencoding is set to ISO-8859-1 but
194197
# logoutputencoding is set to UTF-8.
195198

t/t4201-shortlog.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ test_expect_success 'output from user-defined format is re-wrapped' '
9393
test_cmp expect log.predictable
9494
'
9595

96-
test_expect_success 'shortlog wrapping' '
96+
test_expect_success NOT_MINGW 'shortlog wrapping' '
9797
cat >expect <<\EOF &&
9898
A U Thor (5):
9999
Test
@@ -114,7 +114,7 @@ EOF
114114
test_cmp expect out
115115
'
116116

117-
test_expect_success 'shortlog from non-git directory' '
117+
test_expect_success NOT_MINGW 'shortlog from non-git directory' '
118118
git log HEAD >log &&
119119
GIT_DIR=non-existing git shortlog -w <log >out &&
120120
test_cmp expect out
@@ -159,7 +159,7 @@ $DSCHO (2):
159159
160160
EOF
161161

162-
test_expect_success 'shortlog encoding' '
162+
test_expect_success NOT_MINGW 'shortlog encoding' '
163163
git reset --hard "$commit" &&
164164
git config --unset i18n.commitencoding &&
165165
echo 2 > a1 &&

t/t4210-log-i18n.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_expect_success 'log --grep searches in log output encoding (utf8)' '
3434
test_cmp expect actual
3535
'
3636

37-
test_expect_success 'log --grep searches in log output encoding (latin1)' '
37+
test_expect_success NOT_MINGW 'log --grep searches in log output encoding (latin1)' '
3838
cat >expect <<-\EOF &&
3939
latin1
4040
utf8
@@ -43,7 +43,7 @@ test_expect_success 'log --grep searches in log output encoding (latin1)' '
4343
test_cmp expect actual
4444
'
4545

46-
test_expect_success 'log --grep does not find non-reencoded values (utf8)' '
46+
test_expect_success NOT_MINGW 'log --grep does not find non-reencoded values (utf8)' '
4747
>expect &&
4848
git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
4949
test_cmp expect actual

t/t8005-blame-i18n.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ author $SJIS_NAME
3333
summary $SJIS_MSG
3434
EOF
3535

36-
test_expect_success \
36+
test_expect_success NOT_MINGW \
3737
'blame respects i18n.commitencoding' '
3838
git blame --incremental file | \
3939
egrep "^(author|summary) " > actual &&
@@ -49,7 +49,7 @@ author $EUC_JAPAN_NAME
4949
summary $EUC_JAPAN_MSG
5050
EOF
5151

52-
test_expect_success \
52+
test_expect_success NOT_MINGW \
5353
'blame respects i18n.logoutputencoding' '
5454
git config i18n.logoutputencoding eucJP &&
5555
git blame --incremental file | \
@@ -66,7 +66,7 @@ author $UTF8_NAME
6666
summary $UTF8_MSG
6767
EOF
6868

69-
test_expect_success \
69+
test_expect_success NOT_MINGW \
7070
'blame respects --encoding=UTF-8' '
7171
git blame --incremental --encoding=UTF-8 file | \
7272
egrep "^(author|summary) " > actual &&
@@ -82,7 +82,7 @@ author $UTF8_NAME
8282
summary $UTF8_MSG
8383
EOF
8484

85-
test_expect_success \
85+
test_expect_success NOT_MINGW \
8686
'blame respects --encoding=none' '
8787
git blame --incremental --encoding=none file | \
8888
egrep "^(author|summary) " > actual &&

t/t9902-completion.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,18 @@ test_expect_success '__gitdir - non-existing $GIT_DIR' '
212212
)
213213
'
214214

215+
function pwd_P_W () {
216+
if test_have_prereq MINGW
217+
then
218+
pwd -W
219+
else
220+
pwd -P
221+
fi
222+
}
223+
215224
test_expect_success '__gitdir - gitfile in cwd' '
216-
echo "$(pwd -P)/otherrepo/.git" >expected &&
217-
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
225+
echo "$(pwd_P_W)/otherrepo/.git" >expected &&
226+
echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
218227
test_when_finished "rm -f subdir/.git" &&
219228
(
220229
cd subdir &&
@@ -224,8 +233,8 @@ test_expect_success '__gitdir - gitfile in cwd' '
224233
'
225234

226235
test_expect_success '__gitdir - gitfile in parent' '
227-
echo "$(pwd -P)/otherrepo/.git" >expected &&
228-
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
236+
echo "$(pwd_P_W)/otherrepo/.git" >expected &&
237+
echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
229238
test_when_finished "rm -f subdir/.git" &&
230239
(
231240
cd subdir/subsubdir &&

0 commit comments

Comments
 (0)