Skip to content

Commit 68ac70b

Browse files
pks-tgitster
authored andcommitted
t: don't set ICONV prereq when iconv(1) is missing
We've got a couple of tests that exercise Git with different encodings, typically around commit messages. All of these tests depend on the ICONV prerequisite, which is set when Git was built with support for iconv. Many of those tests also end up using the iconv(1) executable to reencode text. But while tests can rely on the fact that Git does have support for iconv, they cannot assume that the iconv(1) executable exists. The consequence is thus that tests will break in case Git is built with iconv, but the executable doesn't exist. In fact, some of the tests even use the iconv(1) executable unconditionally, regardless of whether or not the ICONV prerequisite is set. Git for Windows has recently (unintentionally) shipped a change where the iconv(1) binary is not getting installed anymore [1]. And as we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has caused such tests to break. The missing iconv(1) binary is considered a bug that will be fixed in Git for Windows. But regardless of that it makes sense to not assume the binary to always exist so that our test suite passes on platforms that don't have iconv at all. Extend the ICONV prerequisite so that we know to skip tests in case the iconv(1) binary doesn't exist. We'll adapt tests that are currently broken in subsequent commits. [1]: git-for-windows#6083 Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9a2fb14 commit 68ac70b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

t/test-lib.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,6 @@ esac
17191719
( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
17201720
test -z "$NO_CURL" && test_set_prereq LIBCURL
17211721
test -z "$NO_GITWEB" && test_set_prereq GITWEB
1722-
test -z "$NO_ICONV" && test_set_prereq ICONV
17231722
test -z "$NO_PERL" && test_set_prereq PERL
17241723
test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
17251724
test -z "$NO_PYTHON" && test_set_prereq PYTHON
@@ -1730,6 +1729,17 @@ test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
17301729
test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
17311730
test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
17321731

1732+
test_lazy_prereq ICONV '
1733+
# We require Git to be built with iconv support, and we require the
1734+
# iconv binary to exist.
1735+
#
1736+
# NEEDSWORK: We might eventually want to split this up into two
1737+
# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
1738+
# some tests only depend on either of these.
1739+
test -z "$NO_ICONV" &&
1740+
iconv -f utf8 -t utf8 </dev/null
1741+
'
1742+
17331743
if test -z "$GIT_TEST_CHECK_CACHE_TREE"
17341744
then
17351745
GIT_TEST_CHECK_CACHE_TREE=true

0 commit comments

Comments
 (0)