>From dac2dd120b8e3803879bd052ae5517d67337bd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sat, 29 Feb 2020 20:23:44 +0000 Subject: [PATCH] tests: avoid false failures on darwin 19.2.0 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 | 8 +++++++- tests/touch/trailing-slash.sh | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/dd/sparse.sh b/tests/dd/sparse.sh index 6b84aef55..0efc80de5 100755 --- a/tests/dd/sparse.sh +++ b/tests/dd/sparse.sh @@ -77,7 +77,13 @@ 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 + # Create a sparse file in 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 + + test $(kb_alloc file.out) -eq $(kb_alloc manual.out) || fail=1 fi diff --git a/tests/touch/trailing-slash.sh b/tests/touch/trailing-slash.sh index f87fe22ca..8f21546d0 100755 --- a/tests/touch/trailing-slash.sh +++ b/tests/touch/trailing-slash.sh @@ -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 -- 2.24.1