Dmitry V. Levin
c588b205be
Add two more function calls to the stack. Suggested by Masatake YAMATO. * tests/stack-fcall.c (f1): Rename to f3. (f1, f2): New functions. * tests/strace-k.test: Update.
38 lines
758 B
Bash
Executable File
38 lines
758 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Ensure that strace -k works.
|
|
|
|
. "${srcdir=.}/init.sh"
|
|
|
|
# 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
|
|
|
|
./stack-fcall ||
|
|
fail_ 'stack-fcall failed'
|
|
|
|
$STRACE -h | grep '^-k' > /dev/null ||
|
|
skip_ 'strace -k is not available'
|
|
|
|
args="-e getpid -k ./stack-fcall"
|
|
$STRACE $args > $LOG 2>&1 || {
|
|
cat $LOG
|
|
fail_ "$STRACE $args failed"
|
|
}
|
|
|
|
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" || {
|
|
cat $LOG
|
|
echo "expected: \"$expected\""
|
|
echo "result: \"$result\""
|
|
fail_ "unexpected output from $STRACE $args"
|
|
}
|
|
|
|
exit 0
|