* defs.h (xlat_search): New prototype. * util.c (xlat_bsearch_compare, xlat_search): New functions. * file.c (sprintfstype): Use xlat_search for fsmagic lookup. * xlat/fsmagic.in: Sort by value and mark as not NULL-terminated. * tests/statfs.c: New file. * tests/statfs.test: New test. * tests/Makefile.am (check_PROGRAMS): Add statfs. (statfs_CFLAGS): Define. (TESTS): Add statfs.test. * tests/.gitignore: Add statfs.
35 lines
836 B
Bash
Executable File
35 lines
836 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Check how statfs/statfs64 syscalls are traced.
|
|
|
|
. "${srcdir=.}/init.sh"
|
|
|
|
check_prog grep
|
|
|
|
# this test probes /proc/self/status
|
|
[ -f /proc/self/status ] ||
|
|
framework_skip_ '/proc/self/status is not available'
|
|
|
|
./statfs ||
|
|
fail_ 'statfs failed'
|
|
|
|
args="-efile ./statfs"
|
|
$STRACE $args > $LOG 2>&1 || {
|
|
cat $LOG
|
|
fail_ "$STRACE $args failed"
|
|
}
|
|
|
|
grep_log()
|
|
{
|
|
local syscall="$1"; shift
|
|
|
|
LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || {
|
|
cat $LOG
|
|
fail_ "$STRACE $args failed to trace \"$syscall\" properly"
|
|
}
|
|
}
|
|
|
|
grep_log 'statfs(64)?' '\("/proc/self/status"(, [1-9][0-9]*)?, {f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid={[0-9]+, [0-9]+}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?}\) += 0'
|
|
|
|
exit 0
|