From: Bernhard Voelker Date: Tue, 20 Apr 2021 22:12:00 +0000 (+0200) Subject: tests: fix FP in ls/stat-free-color.sh X-Git-Tag: v9.0~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7091093bb6505c33279f9bc940b2e94763a6e5d;p=thirdparty%2Fcoreutils.git tests: fix FP in ls/stat-free-color.sh On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls newfstatat(STDOUT_FILENO, ...), but only when there is something to output. * tests/ls/stat-free-color.sh: Add -a option to the reference invocation of ls, thus enforcing something gets output. --- diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh index 13f41a0907..fac609f910 100755 --- a/tests/ls/stat-free-color.sh +++ b/tests/ls/stat-free-color.sh @@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat) # The system may perform additional stat-like calls before main. # Furthermore, underlying library functions may also implicitly # add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d. -# 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. +# Finally, ls(1) makes a stat call for stdout, but only in the case +# when there is something to output. +# To get the comparison right, first get a baseline count for running +# 'ls -a' with one empty directory argument. Then, compare that with +# the invocation under test. mkdir d || framework_failure_ -strace -q -o log1 -e $stats ls --color=always d || fail=1 +strace -q -o log1 -e $stats ls -a --color=always d || fail=1 n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_ test $n_stat1 = 0 \