# Check strace -k symbol names demangling.
test_prog=../stack-fcall-mangled
-expected='getpid ns::f3(int) ns::f2(int) ns::f1(int) ns::f0(int) main '
. "${srcdir=.}"/strace-k.test
[ -f /proc/self/maps ] ||
framework_skip_ '/proc/self/maps is not available'
+check_prog grep
check_prog sed
check_prog tr
-: ${test_prog=../stack-fcall}
-: ${expected='getpid f3 f2 f1 f0 main '}
-
-run_prog "$test_prog"
+run_prog "${test_prog=../stack-fcall}"
run_strace -e getpid -k $args
-result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" |
- tr '\n' ' ')
+expected="$srcdir/$NAME.expected"
+sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" |
+ tr '\n' ' ' |sed 's/ $//' > "$OUT"
-test "$result" = "$expected" || {
- echo "expected: \"$expected\""
- echo "result: \"$result\""
+LC_ALL=C grep -E -x -f "$expected" < "$OUT" > /dev/null || {
+ cat >&2 <<__EOF__
+Failed pattern of expected output: $(cat "$expected")
+Actual output: $(cat "$OUT")
+__EOF__
dump_log_and_fail_with "$STRACE $args output mismatch"
}