blob: 90d56dc2a6e4b2b64ddc6772e739a1fbe0c54e83 [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
Dmitry V. Levin8f546642015-03-17 17:07:57 +00007$STRACE -h | grep '^-k' > /dev/null ||
8 skip_ 'strace -k is not available'
9
Masatake YAMATO96821072014-05-14 13:16:29 +090010# strace -k is implemented using /proc/$pid/maps
11[ -f /proc/self/maps ] ||
12 framework_skip_ '/proc/self/maps is not available'
13
14check_prog sed
15check_prog tr
16
Dmitry V. Levin8f546642015-03-17 17:07:57 +000017run_prog ./stack-fcall
18run_strace -e getpid -k $args
Masatake YAMATO96821072014-05-14 13:16:29 +090019
Dmitry V. Levinc588b202014-06-13 15:07:24 +000020expected='getpid f3 f2 f1 f0 main '
Dmitry V. Levin8f546642015-03-17 17:07:57 +000021result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' "$LOG" |
Masatake YAMATO96821072014-05-14 13:16:29 +090022 tr '\n' ' ')
23
24test "$result" = "$expected" || {
Masatake YAMATO96821072014-05-14 13:16:29 +090025 echo "expected: \"$expected\""
26 echo "result: \"$result\""
Dmitry V. Levin8f546642015-03-17 17:07:57 +000027 dump_log_and_fail_with "$STRACE $args output mismatch"
Masatake YAMATO96821072014-05-14 13:16:29 +090028}
29
30exit 0