04161d
From fc6318841f008dadc1e7c93e539f10d24aa83e90 Mon Sep 17 00:00:00 2001
04161d
From: Bernhard Voelker <mail@bernhard-voelker.de>
04161d
Date: Wed, 21 Apr 2021 00:12:00 +0200
04161d
Subject: [PATCH 1/2] tests: fix FP in ls/stat-free-color.sh
04161d
04161d
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
04161d
newfstatat(STDOUT_FILENO, ...), but only when there is something to
04161d
output.
04161d
04161d
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
04161d
of ls, thus enforcing something gets output.
04161d
04161d
Upstream-commit: b7091093bb6505c33279f9bc940b2e94763a6e5d
04161d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
04161d
---
04161d
 tests/ls/stat-free-color.sh | 10 ++++++----
04161d
 1 file changed, 6 insertions(+), 4 deletions(-)
04161d
04161d
diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh
04161d
index 00942f7..87bed1c 100755
04161d
--- a/tests/ls/stat-free-color.sh
04161d
+++ b/tests/ls/stat-free-color.sh
04161d
@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat)
04161d
 # The system may perform additional stat-like calls before main.
04161d
 # Furthermore, underlying library functions may also implicitly
04161d
 # add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d.
04161d
-# To avoid counting those, first get a baseline count for running
04161d
-# ls with one empty directory argument.  Then, compare that with the
04161d
-# invocation under test.
04161d
+# Finally, ls(1) makes a stat call for stdout, but only in the case
04161d
+# when there is something to output.
04161d
+# To get the comparison right, first get a baseline count for running
04161d
+# 'ls -a' with one empty directory argument.  Then, compare that with
04161d
+# the invocation under test.
04161d
 mkdir d || framework_failure_
04161d
 
04161d
-strace -q -o log1 -e $stats ls --color=always d || fail=1
04161d
+strace -q -o log1 -e $stats ls -a --color=always d || fail=1
04161d
 n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
04161d
 
04161d
 test $n_stat1 = 0 \
04161d
-- 
04161d
2.31.1
04161d
04161d
04161d
From c16ca58f17a088e925c0d1c4015c48332c380a00 Mon Sep 17 00:00:00 2001
04161d
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
04161d
Date: Sun, 9 May 2021 23:41:00 +0100
04161d
Subject: [PATCH 2/2] tests: fix tests/cp/sparse-2.sh false failure on some
04161d
 systems
04161d
04161d
* tests/cp/sparse-2.sh: Double check cp --sparse=always,
04161d
with dd conv=sparse, in the case where the former didn't
04161d
create a sparse file.  Now that this test is being newly run
04161d
on macos, we're seeing a failure due to seek() not creating
04161d
holes on apfs unless the size is >= 16MiB.
04161d
04161d
Upstream-commit: 6b499720fecae935dc00e236d6aefe94d9010482
04161d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
04161d
---
04161d
 tests/cp/fiemap-2.sh | 13 ++++++++++---
04161d
 1 file changed, 10 insertions(+), 3 deletions(-)
04161d
04161d
diff --git a/tests/cp/fiemap-2.sh b/tests/cp/fiemap-2.sh
04161d
index 548a376..e20ce54 100755
04161d
--- a/tests/cp/fiemap-2.sh
04161d
+++ b/tests/cp/fiemap-2.sh
04161d
@@ -17,7 +17,7 @@
04161d
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
04161d
 
04161d
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
04161d
-print_ver_ cp
04161d
+print_ver_ cp stat dd
04161d
 
04161d
 # Require a fiemap-enabled FS.
04161d
 touch fiemap_chk # check a file rather than current dir for best coverage
04161d
@@ -46,10 +46,17 @@ dd bs=1k seek=1 of=k count=255 < /dev/zero || framework_failure_
04161d
 
04161d
 # cp should detect the all-zero blocks and convert some of them to holes.
04161d
 # How many it detects/converts currently depends on io_blksize.
04161d
-# Currently, on my F14/ext4 desktop, this K starts off with size 256KiB,
04161d
+# Currently, on my F14/ext4 desktop, this K file starts off with size 256KiB,
04161d
 # (note that the K in the preceding test starts off with size 4KiB).
04161d
 # cp from coreutils-8.9 with --sparse=always reduces the size to 32KiB.
04161d
 cp --sparse=always k k2 || fail=1
04161d
-test $(stat -c %b k2) -lt $(stat -c %b k) || fail=1
04161d
+if test $(stat -c %b k2) -ge $(stat -c %b k); then
04161d
+  # If not sparse, then double check by creating with dd
04161d
+  # as we're not guaranteed that seek will create a hole.
04161d
+  # apfs on darwin 19.2.0 for example was seen to not to create holes < 16MiB.
04161d
+  hole_size=$(stat -c %o k2) || framework_failure_
04161d
+  dd if=k of=k2.dd bs=$hole_size conv=sparse || framework_failure_
04161d
+  test $(stat -c %b k2) -eq $(stat -c %b k2.dd) || fail=1
04161d
+fi
04161d
 
04161d
 Exit $fail
04161d
-- 
04161d
2.31.1
04161d