Dmitry V. Levin
8f54664d68
Factor out shell code used in several tests to common functions. * tests/fanotify_mark.expected: New file. * tests/ioctl.expected: New file. * tests/net-fd.expected: New file. * tests/net.expected: New file. * tests/statfs.expected: New file. * tests/sun_path.expected: New file. * tests/uio.expected: New file. * tests/ipc.sh: New file. * tests/Makefile.am (EXTRA_DIST): Add them. * tests/init.sh (dump_log_and_fail_with, run_prog, run_prog_skip_if_failed, run_strace, run_strace_merge, match_awk, match_diff, match_grep): New functions. * tests/*.test: Use them.
62 lines
1.2 KiB
Bash
Executable File
62 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Check how ftruncate, lseek and stat family syscalls are traced.
|
|
|
|
. "${srcdir=.}/init.sh"
|
|
|
|
check_prog dd
|
|
check_prog find
|
|
|
|
EXPECTED="$LOG.expected"
|
|
size=46118400000
|
|
sample=stat_sample
|
|
|
|
rm -f $sample
|
|
umask 022
|
|
|
|
run_prog_skip_if_failed \
|
|
dd seek=$size bs=1 count=0 if=/dev/null of=$sample
|
|
run_strace -edesc $args
|
|
|
|
r_ftruncate="ftruncate(64)?\\(1, $size\\) += 0"
|
|
r_lseek="lseek\\(1, $size, SEEK_CUR\\) += $size"
|
|
r_llseek="_llseek\\(1, $size, \\[$size\\], SEEK_CUR\\) += 0"
|
|
|
|
cat > "$EXPECTED" << __EOF__
|
|
$r_ftruncate
|
|
$r_lseek|$r_llseek
|
|
__EOF__
|
|
|
|
match_grep "$LOG" "$EXPECTED"
|
|
|
|
run_prog_skip_if_failed \
|
|
find -L $sample -quit
|
|
run_strace -efile $args
|
|
|
|
stat="\\{st_mode=S_IFREG\\|0644, st_size=$size, \\.\\.\\.\\}"
|
|
r_stat="stat(64)?\\(\"$sample\", $stat\\) += 0"
|
|
r_fstatat="(new)?fstatat(64)?\\(AT_FDCWD, \"$sample\", $stat, 0\\) += 0"
|
|
|
|
cat > "$EXPECTED" << __EOF__
|
|
$r_stat|$r_fstatat
|
|
__EOF__
|
|
|
|
match_grep "$LOG" "$EXPECTED"
|
|
|
|
run_prog_skip_if_failed \
|
|
find $sample -quit
|
|
run_strace -efile $args
|
|
|
|
r_lstat="lstat(64)?\\(\"$sample\", $stat\\) += 0"
|
|
r_lfstatat="(new)?fstatat(64)?\\(AT_FDCWD, \"$sample\", $stat, AT_SYMLINK_NOFOLLOW\\) += 0"
|
|
|
|
cat > "$EXPECTED" << __EOF__
|
|
$r_lstat|$r_lfstatat
|
|
__EOF__
|
|
|
|
match_grep "$LOG" "$EXPECTED"
|
|
|
|
rm -f "$EXPECTED" $sample
|
|
|
|
exit 0
|