]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure on cygwin
authorPádraig Brady <P@draigBrady.com>
Sun, 27 Aug 2023 19:22:32 +0000 (20:22 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 27 Aug 2023 19:22:32 +0000 (20:22 +0100)
* 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.

tests/cksum/md5sum-bsd.sh

index 1581b8ac88e5689abc077abc781f96b87ea1e19d..2c7cd4d4f97a1c25af228eda057c011388bdaba9 100755 (executable)
@@ -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