Skip to content

Commit df383b5

Browse files
pks-tttaylorr
authored andcommitted
t/test-lib: wire up NO_ICONV prerequisite
The iconv library is used by Git to reencode files, commit messages and other things. As such it is a rather integral part, but given that many platforms nowadays use UTF-8 everywhere you can live without support for reencoding in many situations. It is thus optional to build Git with iconv, and some of our platforms wired up in "config.mak.uname" disable it. But while we support building without it, running our test suite with "NO_ICONV=Yes" causes many test failures. Wire up a new test prerequisite ICONV that gets populated via our GIT-BUILD-OPTIONS. Annotate failing tests accordingly. Note that this commit does not do a deep dive into every single test to assess whether the failure is expected or not. Most of the tests do smell like the expected kind of failure though. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent ed7634e commit df383b5

22 files changed

+229
-106
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,6 +3171,7 @@ GIT-BUILD-OPTIONS: FORCE
31713171
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
31723172
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
31733173
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
3174+
@echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
31743175
@echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
31753176
@echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
31763177
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+

contrib/buildsystems/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@ set(DIFF diff)
11091109
set(PYTHON_PATH /usr/bin/python)
11101110
set(TAR tar)
11111111
set(NO_CURL )
1112+
set(NO_ICONV )
11121113
set(NO_EXPAT )
11131114
set(USE_LIBPCRE2 )
11141115
set(NO_PERL )
@@ -1122,6 +1123,10 @@ if(NOT CURL_FOUND)
11221123
set(NO_CURL 1)
11231124
endif()
11241125

1126+
if(NOT Iconv_FOUND)
1127+
SET(NO_ICONV 1)
1128+
endif()
1129+
11251130
if(NOT EXPAT_FOUND)
11261131
set(NO_EXPAT 1)
11271132
endif()
@@ -1145,6 +1150,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
11451150
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
11461151
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
11471152
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
1153+
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
11481154
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
11491155
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
11501156
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")

t/t0028-working-tree-encoding.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ TEST_CREATE_REPO_NO_TEMPLATE=1
1212

1313
GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING
1414

15+
if ! test_have_prereq ICONV
16+
then
17+
skip_all='skipping working tree encoding tests; iconv not available'
18+
test_done
19+
fi
20+
1521
test_expect_success 'setup test files' '
1622
git config core.eol lf &&
1723

t/t2082-parallel-checkout-attributes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_expect_success 'parallel-checkout with ident' '
3434
)
3535
'
3636

37-
test_expect_success 'parallel-checkout with re-encoding' '
37+
test_expect_success ICONV 'parallel-checkout with re-encoding' '
3838
set_checkout_config 2 0 &&
3939
git init encoding &&
4040
(

t/t3434-rebase-i18n.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
2020
TEST_PASSES_SANITIZE_LEAK=true
2121
. ./test-lib.sh
2222

23+
if ! test_have_prereq ICONV
24+
then
25+
skip_all='skipping rebase i18n tests; iconv not available'
26+
test_done
27+
fi
28+
2329
compare_msg () {
2430
iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
2531
git cat-file commit HEAD >raw &&

t/t3900-i18n-commit.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ test_description='commit and log output encodings'
88
TEST_PASSES_SANITIZE_LEAK=true
99
. ./test-lib.sh
1010

11+
if ! test_have_prereq ICONV
12+
then
13+
skip_all='skipping commit i18n tests; iconv not available'
14+
test_done
15+
fi
16+
1117
compare_with () {
1218
git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
1319
case "$3" in

t/t3901-i18n-patch.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1111
TEST_PASSES_SANITIZE_LEAK=true
1212
. ./test-lib.sh
1313

14+
if ! test_have_prereq ICONV
15+
then
16+
skip_all='skipping patch i18n tests; iconv not available'
17+
test_done
18+
fi
19+
1420
check_encoding () {
1521
# Make sure characters are not corrupted
1622
cnt="$1" header="$2" i=1 j=0

t/t4041-diff-submodule-option.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1515
TEST_PASSES_SANITIZE_LEAK=true
1616
. ./test-lib.sh
1717

18-
# Tested non-UTF-8 encoding
19-
test_encoding="ISO8859-1"
18+
# Test non-UTF-8 encoding in case iconv is available.
19+
if test_have_prereq ICONV
20+
then
21+
test_encoding="ISO8859-1"
22+
# String "added" in German (translated with Google Translate), encoded in UTF-8,
23+
# used in sample commit log messages in add_file() function below.
24+
added=$(printf "hinzugef\303\274gt")
25+
else
26+
test_encoding="UTF-8"
27+
added="added"
28+
fi
2029

21-
# String "added" in German (translated with Google Translate), encoded in UTF-8,
22-
# used in sample commit log messages in add_file() function below.
23-
added=$(printf "hinzugef\303\274gt")
2430
add_file () {
2531
(
2632
cd "$1" &&

t/t4059-diff-submodule-not-initialized.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ initialized previously but the checkout has since been removed.
1212
TEST_PASSES_SANITIZE_LEAK=true
1313
. ./test-lib.sh
1414

15-
# Tested non-UTF-8 encoding
16-
test_encoding="ISO8859-1"
1715

18-
# String "added" in German (translated with Google Translate), encoded in UTF-8,
19-
# used in sample commit log messages in add_file() function below.
20-
added=$(printf "hinzugef\303\274gt")
16+
# Test non-UTF-8 encoding in case iconv is available.
17+
if test_have_prereq ICONV
18+
then
19+
test_encoding="ISO8859-1"
20+
# String "added" in German (translated with Google Translate), encoded in UTF-8,
21+
# used in sample commit log messages in add_file() function below.
22+
added=$(printf "hinzugef\303\274gt")
23+
else
24+
test_encoding="UTF-8"
25+
added="added"
26+
fi
2127

2228
add_file () {
2329
(

t/t4060-diff-submodule-option-diff-format.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ This test tries to verify the sanity of --submodule=diff option of git diff.
1313
TEST_PASSES_SANITIZE_LEAK=true
1414
. ./test-lib.sh
1515

16-
# Tested non-UTF-8 encoding
17-
test_encoding="ISO8859-1"
18-
19-
# String "added" in German (translated with Google Translate), encoded in UTF-8,
20-
# used in sample commit log messages in add_file() function below.
21-
added=$(printf "hinzugef\303\274gt")
16+
# Test non-UTF-8 encoding in case iconv is available.
17+
if test_have_prereq ICONV
18+
then
19+
test_encoding="ISO8859-1"
20+
# String "added" in German (translated with Google Translate), encoded in UTF-8,
21+
# used in sample commit log messages in add_file() function below.
22+
added=$(printf "hinzugef\303\274gt")
23+
else
24+
test_encoding="UTF-8"
25+
added="added"
26+
fi
2227

2328
add_file () {
2429
(

0 commit comments

Comments
 (0)