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.
This commit is contained in:
Pádraig Brady committed 2020-02-29 22:45:00 +00:00
1 parent 54bf2c2f1a
commit de73a867ca
2 files changed
+16 -3

No files matched your search

+10 -1
View File
@@ -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
+6 -2
View File
@@ -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