blob: 329f30248f5e2cbdf3436c345c8a7a2f77491e48 [file] [log] [blame]
Masatake YAMATO96821072014-05-14 13:16:29 +09001#!/bin/sh
2
3# Ensure that strace -k works.
4
5. "${srcdir=.}/init.sh"
6
7# strace -k is implemented using /proc/$pid/maps
8[ -f /proc/self/maps ] ||
9 framework_skip_ '/proc/self/maps is not available'
10
11check_prog sed
12check_prog tr
13
14./stack-fcall ||
15 fail_ 'stack-fcall failed'
16
17$STRACE -h | grep '^-k' > /dev/null ||
18 skip_ 'strace -k is not available'
19
20args="-e getuid -k ./stack-fcall"
21$STRACE $args > $LOG 2>&1 || {
22 cat $LOG
23 fail_ "$STRACE $args failed"
24}
25
26expected='getuid f1 f0 main '
27result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' $LOG |
28 tr '\n' ' ')
29
30test "$result" = "$expected" || {
31 cat $LOG
32 echo "expected: \"$expected\""
33 echo "result: \"$result\""
34 fail_ "unexpected output from $STRACE $args"
35}
36
37exit 0