From 7091d288f7e1648314dc984da0c0abb5794834fb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 8 Oct 2016 14:19:01 +0100 Subject: [PATCH] Force C.UTF-8 or C locale for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise several tests fail, for example in this build done in a French locale by Debian's reproducible builds initiative, to check whether the resulting binaries are identical to what was produced in an English locale: (test-basic) # error: Cannot write to repository: Permission non accordée ... File 'error-message' doesn't match regexp 'Permission denied' (test-help) # Utilisation : # ostree [OPTION...] COMMAND ... File 'out' doesn't match regexp '[Uu]sage' (test-pull-metalink) # error: Erreur à la ligne 1, caractère 1 : Le document doit commencer avec un élément (par ex. ) ... File 'err.txt' doesn't match regexp 'Document must begin with an element' Signed-off-by: Simon McVittie Closes: #558 Approved by: cgwalters --- tests/libtest.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/libtest.sh b/tests/libtest.sh index bc114bfa..d16aae70 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -35,6 +35,15 @@ assert_not_reached () { test_tmpdir=$(pwd) +# Some tests look for specific English strings. Use a UTF-8 version +# of the C (POSIX) locale if we have one, or fall back to POSIX +# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8) +if locale -a | grep C.UTF-8 >/dev/null; then + export LC_ALL=C.UTF-8 +else + export LC_ALL=C +fi + # Sanity check that we're in a tmpdir that has # just .testtmp (created by tap-driver for `make check`, # or nothing at all (as ginstest-runner does)