From 4b5bc5454e7399704ad7425b508320e9f94dde48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Sat, 19 Aug 2017 15:36:54 -0700 Subject: [PATCH] tests: fix issues on alpine linux * tests/misc/seq-epipe.sh: Remove stale comment. * tests/misc/sort-debug-warn.sh: musl doesn't indicate a set_locale() failure with missing locales, so avoid a test portion in that case. * tests/misc/wc-files0.sh: Avoid a bug on older ash implementations. Addresses http://bugs.gnu.org/28054 --- tests/misc/seq-epipe.sh | 2 -- tests/misc/sort-debug-warn.sh | 25 ++++++++++++++++--------- tests/misc/wc-files0.sh | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/misc/seq-epipe.sh b/tests/misc/seq-epipe.sh index 69dd75d6a3..f755590f53 100755 --- a/tests/misc/seq-epipe.sh +++ b/tests/misc/seq-epipe.sh @@ -31,8 +31,6 @@ echo 1 > exp || framework_failure_ compare exp out || fail=1 compare exp code || fail=1 -# The error message must begin with "standard output:" -# (but don't hard-code the strerror text) grep '^seq: write error: ' err \ || { warn_ "seq emitted incorrect error on EPIPE"; \ cat err;\ diff --git a/tests/misc/sort-debug-warn.sh b/tests/misc/sort-debug-warn.sh index 8119693496..0096cbdcee 100755 --- a/tests/misc/sort-debug-warn.sh +++ b/tests/misc/sort-debug-warn.sh @@ -70,9 +70,6 @@ sort: using simple byte comparison sort: using simple byte comparison 17 sort: using simple byte comparison -18 -sort: failed to set locale -sort: using simple byte comparison EOF echo 1 >> out @@ -109,15 +106,25 @@ echo 16 >> out sort -rM --debug /dev/null 2>>out #no warning echo 17 >> out sort -rM -k1,1 --debug /dev/null 2>>out #no warning -echo 18 >> out -LC_ALL=missing sort --debug /dev/null 2>>out.t -# musl libc accepts "missing" and implicitly uses UTF8, -# so adjust the expected message accordingly. -sed 's/using .*missing.* sorting rules/using simple byte comparison/' \ - out.t >>out compare exp out || fail=1 + +cat <<\EOF > exp +sort: failed to set locale +sort: using simple byte comparison +EOF + +LC_ALL=missing sort --debug /dev/null 2>out + +# musl libc maps unknown locales to the default utf8 locale +# with no way to determine failures. This is discussed at: +# http://www.openwall.com/lists/musl/2016/04/02/1 +if ! grep -E 'using .*(missing|C.UTF-8).* sorting rules' out; then + compare exp out || fail=1 +fi + + cat <<\EOF > exp sort: using simple byte comparison sort: key 1 is numeric and spans multiple fields diff --git a/tests/misc/wc-files0.sh b/tests/misc/wc-files0.sh index 32d5e63e8b..51ed388db5 100755 --- a/tests/misc/wc-files0.sh +++ b/tests/misc/wc-files0.sh @@ -45,7 +45,7 @@ nlname='1 2' touch "$nlname" || framework_failure_ printf '%s\0' "$nlname" | wc --files0-from=- > out || fail=1 -printf '%s\n' "0 0 0 '1'$'\\n''2'" > exp || framework_failure_ +printf '%s\n' "0 0 0 '1'\$'\\n''2'" > exp || framework_failure_ compare exp out || fail=1 # Ensure correct byte counts, which fails between v8.24 and v8.26 inclusive -- 2.47.2