* init.cfg (+get_stat_syscalls_): Refactor from ...
* tests/ls/stat-free-color.sh: ... here.
* tests/ls/stat-free-symlinks.sh: ... here.
* tests/misc/traversal-missing.sh: ... here.
* tests/shred/fifo.sh: .. here.
fi
}
+# Output a comma-separated list of file-name stat syscalls recognized
+# by strace. Callers that require strace should invoke require_strace_
+# separately.
+get_stat_syscalls_()
+{
+ local stats=stat
+ local stat
+ for stat in statx lstat stat64 lstat64 newfstatat fstatat64; do
+ strace -qe "$stat" true > /dev/null 2>&1 &&
+ stats="$stats,$stat"
+ done
+ printf '%s\n' "$stats"
+}
+
# Skip the current test if valgrind doesn't work,
# which could happen if not installed,
# or hasn't support for the built architecture,
require_strace_ stat
require_dirent_d_type_
-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
+stats=$(get_stat_syscalls_)
# Disable enough features via LS_COLORS so that ls --color
# can do its job without calling stat (other than the obligatory
print_ver_ ls
require_strace_ stat
-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
+stats=$(get_stat_syscalls_)
# The system may perform additional stat-like calls before main.
# Furthermore, underlying library functions may also implicitly
uid=$(id -u) || framework_failure_
gid=$(id -g) || framework_failure_
-stats='stat'
-# List 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
-
+stats=$(get_stat_syscalls_)
chmods=chmod,fchmodat,fchmodat2
chowns=chown,lchown,fchownat
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
+stats=$(get_stat_syscalls_)
open_stat_fail ()
{