]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failures on darwin 19.2.0
authorPádraig Brady <P@draigBrady.com>
Sat, 29 Feb 2020 20:23:44 +0000 (20:23 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 29 Feb 2020 22:45:00 +0000 (22:45 +0000)
With these adjustments, all tests pass on macOS Catalina.

* tests/dd/sparse.sh: Adjust so that systems like apfs that
don't create holes < 16 MiB do not fail erroneously.
* tests/touch/trailing-slash.sh: Darwin was seen to dereference
symlinks to files when given a trailing slash, so avoid
that particular case.

tests/dd/sparse.sh
tests/touch/trailing-slash.sh

index 6b84aef55b3adde18bdebc93540cd014f556e842..58cedf24abc976370b261662b2790d027f7bfa20 100755 (executable)
@@ -77,7 +77,16 @@ if test $(kb_alloc file.in) -gt 3000; then
 
   # Ensure that this 1MiB *output* block of NULs *is* converted to a hole.
   dd if=file.in of=file.out ibs=2M obs=1M conv=sparse,notrunc
-  test $(kb_alloc file.out) -lt 2500 || fail=1
+  if test $(kb_alloc file.out) -ge 2500; then
+    # Double check the failure by creating a sparse file in
+    # the traditional manner for comparison, as we're not guaranteed
+    # that seek=1M will create a hole.  apfs on darwin 19.2.0 for example
+    # was seen to not to create holes < 16MiB.
+    dd if=file.in of=manual.out bs=1M count=1 || fail=1
+    dd if=file.in of=manual.out bs=1M count=1 seek=2 conv=notrunc || fail=1
+
+    test $(kb_alloc file.out) -eq $(kb_alloc manual.out) || fail=1
+  fi
 
 fi
 
index f87fe22cab718a7f7d4e1b2fcd07a95876a922f9..8f21546d0fc5a832576bfb8ee4254da9e9cb0679 100755 (executable)
@@ -33,7 +33,9 @@ returns_ 1 touch no-file/ || fail=1
 returns_ 1 touch file/ || fail=1
 returns_ 1 touch dangling/ || fail=1
 returns_ 1 touch loop/ || fail=1
-returns_ 1 touch link1/ || fail=1
+if returns_ 2 ls link1/; then  # darwin allows trailing slash to files
+  returns_ 1 touch link1/ || fail=1
+fi
 touch dir/ || fail=1
 
 # -c silences ENOENT, but not ENOTDIR or ELOOP
@@ -41,7 +43,9 @@ touch -c no-file/ || fail=1
 returns_ 1 touch -c file/ || fail=1
 touch -c dangling/ || fail=1
 returns_ 1 touch -c loop/ || fail=1
-returns_ 1 touch -c link1/ || fail=1
+if returns_ 2 ls link1/; then
+  returns_ 1 touch -c link1/ || fail=1
+fi
 touch -c dir/ || fail=1
 returns_ 1 test -f no-file || fail=1
 returns_ 1 test -f nowhere || fail=1