]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: shred: improve coverage for stat checks
authorCollin Funk <collin.funk1@gmail.com>
Thu, 21 May 2026 02:31:34 +0000 (19:31 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Thu, 21 May 2026 02:31:34 +0000 (19:31 -0700)
* tests/shred/fifo.sh: Check for more stat system calls. Copied from
tests/ls/stat-free-symlinks.sh.
Suggested by Pádraig Brady.

tests/shred/fifo.sh

index 40af9c2f5810ab778f5170fa60f4283d31736252..c7c3ac235296861eba7ec366cf27cc42a7544c0f 100755 (executable)
@@ -21,10 +21,18 @@ print_ver_ shred
 getlimits_
 uses_strace_
 
+stats='stat'
+# List of other _file name_ stat functions to increase coverage.
+other_stats='statx lstat stat64 lstat64 newfstatat fstatat64'
+for stat in $other_stats; do
+  strace -qe "$stat" true > /dev/null 2>&1 &&
+    stats="$stats,$stat"
+done
+
 open_stat_fail ()
 {
   strace --quiet=all -o /dev/null -P file -e inject=open,openat:error=ENXIO \
-    -e inject=stat,newfstatat:error=ENOSYS "$@"
+    -e inject=$stats:error=ENOSYS "$@"
 }
 
 # If open fails with ENXIO and the subsequent stat fails, e.g., because the