blob: 458d58bd454beb0479dfac13fef2c294f807d3ae [file] [log] [blame]
#!/bin/sh
# Ensure that strace -k works.
. "${srcdir=.}/init.sh"
$STRACE -h | grep '^[[:space:]]*-k[[:space:]]' > /dev/null ||
skip_ 'strace -k is not available'
# strace -k is implemented using /proc/$pid/maps
[ -f /proc/self/maps ] ||
framework_skip_ '/proc/self/maps is not available'
check_prog sed
check_prog tr
run_prog ./stack-fcall
run_strace -e getpid -k $args
expected='getpid f3 f2 f1 f0 main '
result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' "$LOG" |
tr '\n' ' ')
test "$result" = "$expected" || {
echo "expected: \"$expected\""
echo "result: \"$result\""
dump_log_and_fail_with "$STRACE $args output mismatch"
}
exit 0