Dmitry V. Levin | 4176d53 | 2014-09-21 22:42:45 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Check how statfs/statfs64 syscalls are traced. |
| 4 | |
| 5 | . "${srcdir=.}/init.sh" |
| 6 | |
| 7 | check_prog grep |
| 8 | |
| 9 | # this test probes /proc/self/status |
| 10 | [ -f /proc/self/status ] || |
| 11 | framework_skip_ '/proc/self/status is not available' |
| 12 | |
| 13 | ./statfs || |
| 14 | fail_ 'statfs failed' |
| 15 | |
| 16 | args="-efile ./statfs" |
| 17 | $STRACE $args > $LOG 2>&1 || { |
| 18 | cat $LOG |
| 19 | fail_ "$STRACE $args failed" |
| 20 | } |
| 21 | |
| 22 | grep_log() |
| 23 | { |
| 24 | local syscall="$1"; shift |
| 25 | |
| 26 | LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || { |
| 27 | cat $LOG |
| 28 | fail_ "$STRACE $args failed to trace \"$syscall\" properly" |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | 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' |
| 33 | |
| 34 | exit 0 |