aboutsummaryrefslogtreecommitdiffstats
path: root/t/t6006-rev-list-format.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-16 10:12:53 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-16 17:00:49 -0400
commitdf383b584267d3b7b57fb513bef4a2ff8eb8fe30 (patch)
treef2ffe2b4c22060ad1042537c687c9e3984e06a84 /t/t6006-rev-list-format.sh
parented7634ebcc0cbfb229bc0bf2c74cd3ef4060c096 (diff)
downloadgit-df383b584267d3b7b57fb513bef4a2ff8eb8fe30.tar.gz
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 <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 't/t6006-rev-list-format.sh')
-rwxr-xr-xt/t6006-rev-list-format.sh54
1 files changed, 37 insertions, 17 deletions
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index f1623b1c06..2a01a62a2f 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -13,21 +13,41 @@ TEST_PASSES_SANITIZE_LEAK=true
. "$TEST_DIRECTORY"/lib-terminal.sh
test_tick
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
-
-# String "added" in German
-# (translated with Google Translate),
-# encoded in UTF-8, used as a commit log message below.
-added_utf8_part=$(printf "\303\274")
-added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
-added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
-added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
-# same but "changed"
-changed_utf8_part=$(printf "\303\244")
-changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
-changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
-changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
+
+if test_have_prereq ICONV
+then
+ # Tested non-UTF-8 encoding
+ test_encoding="ISO8859-1"
+
+ # String "added" in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ added_utf8_part=$(printf "\303\274")
+ added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
+ added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
+ added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
+ # same but "changed"
+ changed_utf8_part=$(printf "\303\244")
+ changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
+ changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
+ changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
+else
+ # Tested non-UTF-8 encoding
+ test_encoding="UTF-8"
+
+ # String "added" in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ added_utf8_part="u"
+ added_utf8_part_iso88591="u"
+ added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
+ added_iso88591="$added"
+ # same but "changed"
+ changed_utf8_part="a"
+ changed_utf8_part_iso88591="a"
+ changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
+ changed_iso88591="$changed"
+fi
# Count of char to truncate
# Number is chosen so, that non-ACSII characters
@@ -198,7 +218,7 @@ Thu, 7 Apr 2005 15:13:13 -0700
1112911993
EOF
-test_format encoding %e <<EOF
+test_format ICONV encoding %e <<EOF
commit $head2
$test_encoding
commit $head1
@@ -374,7 +394,7 @@ test_expect_success 'setup complex body' '
head3_short=$(git rev-parse --short $head3)
'
-test_format complex-encoding %e <<EOF
+test_format ICONV complex-encoding %e <<EOF
commit $head3
$test_encoding
commit $head2