From: Pádraig Brady
Date: Sun, 27 Aug 2023 19:22:32 +0000 (+0100) Subject: tests: avoid false failure on cygwin X-Git-Tag: v9.4~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3afbcad9ca68863ea3c049f7d5ce0860d07f260;p=thirdparty%2Fcoreutils.git tests: avoid false failure on cygwin * tests/cksum/md5sum-bsd.sh: Avoid part of test dealing with backslashes in file names, on systems where backslash is a directory separator. Issue reported by Bruno Haible on cygwin. --- diff --git a/tests/cksum/md5sum-bsd.sh b/tests/cksum/md5sum-bsd.sh index 1581b8ac88..2c7cd4d4f9 100755 --- a/tests/cksum/md5sum-bsd.sh +++ b/tests/cksum/md5sum-bsd.sh @@ -70,30 +70,32 @@ for i in 'a' ' b' '*c' 'dd' ' '; do done md5sum --strict -c check.md5 || fail=1 -# Ensure we can --check BSD traditional format we produce -# with the GNU extension of escaped newlines -nl=' +if : > 'backslash\is\not\dir\sep'; then + # Ensure we can --check BSD traditional format we produce + # with the GNU extension of escaped newlines + nl=' ' -t=' ' -rm check.md5 -for i in 'a\b' 'a\' '\a' "a${nl}b" "a${t}b"; do - : > "$i" - md5sum --tag "$i" >> check.md5 || fail=1 -done -md5sum --strict -c check.md5 > out || fail=1 -printf '%s: OK\n' '\a\\b' '\a\\' '\\\a' '\a\nb' "a${t}b" > exp || - framework_failure_ -compare exp out || fail=1 - - -# Ensure BSD traditional format with GNU extension escapes -# is in the expected format -ex_file='test + t=' ' + rm check.md5 + for i in 'a\b' 'a\' '\a' "a${nl}b" "a${t}b"; do + : > "$i" + md5sum --tag "$i" >> check.md5 || fail=1 + done + md5sum --strict -c check.md5 > out || fail=1 + printf '%s: OK\n' '\a\\b' '\a\\' '\\\a' '\a\nb' "a${t}b" > exp || + framework_failure_ + compare exp out || fail=1 + + + # Ensure BSD traditional format with GNU extension escapes + # is in the expected format + ex_file='test \\file' -ex_output='\MD5 (test\n\\\\file) = d41d8cd98f00b204e9800998ecf8427e' -touch "$ex_file" -printf "%s\n" "$ex_output" > exp -md5sum --tag "$ex_file" > out || fail=1 -compare exp out || fail=1 + ex_output='\MD5 (test\n\\\\file) = d41d8cd98f00b204e9800998ecf8427e' + touch "$ex_file" + printf "%s\n" "$ex_output" > exp + md5sum --tag "$ex_file" > out || fail=1 + compare exp out || fail=1 +fi Exit $fail