# 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
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
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