summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2023-03-19 23:35:12 +0000
committerPádraig Brady <P@draigBrady.com>2023-03-19 23:44:51 +0000
commit445f502839b6b13d051612e989a02a36f8b9176e (patch)
treecf6fa4181fda30087e607a62ce60414386ca4ac9
parenteb745e3b95a79bdad98aaa9c4e753145f995c313 (diff)
downloadcoreutils-445f502839b6b13d051612e989a02a36f8b9176e.tar.gz
tests: avoid false failure on systems without statx
* tests/ls/stat-free-symlinks.sh: Filter out syscalls that return ENOSYS, as that was seen with statx() on Debian 10.13 on mips64, and resulted in overcounting of stat calls.
-rwxr-xr-xtests/ls/stat-free-color.sh5
-rwxr-xr-xtests/ls/stat-free-symlinks.sh5
2 files changed, 6 insertions, 4 deletions
diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh
index b7da43f89..b02c06bb7 100755
--- a/tests/ls/stat-free-color.sh
+++ b/tests/ls/stat-free-color.sh
@@ -63,8 +63,9 @@ eval $(dircolors -b color-without-stat)
# the invocation under test.
mkdir d || framework_failure_
+count_stats() { grep -vE '\+\+\+|ENOSYS|NOTSUP' "$1" | wc -l; }
strace -q -o log1 -e $stats ls -a --color=always d || fail=1
-n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
+n_stat1=$(count_stats log1) || framework_failure_
test $n_stat1 = 0 \
&& skip_ 'No stat calls recognized on this platform'
@@ -79,7 +80,7 @@ mkdir d/subdir \
# Invocation under test.
strace -q -o log2 -e $stats ls --color=always d || fail=1
-n_stat2=$(grep -vF '+++' log2 | wc -l) || framework_failure_
+n_stat2=$(count_stats log2) || framework_failure_
# Expect the same number of stat calls.
test $n_stat1 = $n_stat2 \
diff --git a/tests/ls/stat-free-symlinks.sh b/tests/ls/stat-free-symlinks.sh
index c9ab67ec4..27f3414ab 100755
--- a/tests/ls/stat-free-symlinks.sh
+++ b/tests/ls/stat-free-symlinks.sh
@@ -34,9 +34,10 @@ done
# To avoid counting those, first get a baseline count for running
# ls with one empty directory argument. Then, compare that with the
# invocation under test.
+count_stats() { grep -vE '\+\+\+|ENOSYS|NOTSUP' "$1" | wc -l; }
mkdir d || framework_failure_
strace -q -o log1 -e $stats ls -F --color=always d || fail=1
-n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
+n_stat1=$(count_stats log1) || framework_failure_
test $n_stat1 = 0 \
&& skip_ 'No stat calls recognized on this platform'
@@ -55,7 +56,7 @@ ln -s x link-to-x || framework_failure_
LS_COLORS='or=0:mi=0:ex=01;32:ln=01;35' \
strace -qe $stats -o log2 ls -F --color=always x link-to-x > out.tmp || fail=1
-n_stat2=$(grep -vF '+++' log2 | wc -l) || framework_failure_
+n_stat2=$(count_stats log2) || framework_failure_
# Expect one more stat call,
# which failed with coreutils 6.9 and earlier, which had 2.