tests: parametrize strace-k.test

Prepare for the check of strace -k symbol names demangling.

* tests/strace-k.test: Parametrize $test_prog and $expected.
* tests/stack-fcall.h: New file.
* tests/stack-fcall.c: Include "stack-fcall.h"
* tests/stack-fcall-0.c: Likewise.
* tests/stack-fcall-1.c: Likewise.
* tests/stack-fcall-2.c: Likewise.
* tests/stack-fcall-3.c: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add stack-fcall.h.
This commit is contained in:
Дмитрий Левин 2017-12-29 15:20:21 +00:00
parent f9c8e8a5b6
commit 23af76cc12
8 changed files with 14 additions and 8 deletions

View File

@ -363,6 +363,7 @@ EXTRA_DIST = \
setugid.c \
sigaltstack.expected \
sockname.c \
stack-fcall.h \
strace-C.expected \
strace-E.expected \
strace-T.expected \

View File

@ -1,4 +1,4 @@
int f1(int i);
#include "stack-fcall.h"
int f0(int i)
{

View File

@ -1,4 +1,4 @@
int f2(int i);
#include "stack-fcall.h"
int f1(int i)
{

View File

@ -1,4 +1,4 @@
int f3(int i);
#include "stack-fcall.h"
int f2(int i)
{

View File

@ -1,4 +1,5 @@
#include <unistd.h>
#include "stack-fcall.h"
int f3(int i)
{

View File

@ -1,4 +1,4 @@
int f0(int i);
#include "stack-fcall.h"
int main(int argc, char **argv)
{

4
tests/stack-fcall.h Normal file
View File

@ -0,0 +1,4 @@
int f0(int i);
int f1(int i);
int f2(int i);
int f3(int i);

View File

@ -38,10 +38,12 @@
check_prog sed
check_prog tr
run_prog ../stack-fcall
: ${test_prog=../stack-fcall}
: ${expected='getpid f3 f2 f1 f0 main '}
run_prog "$test_prog"
run_strace -e getpid -k $args
expected='getpid f3 f2 f1 f0 main '
result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^.*\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" |
tr '\n' ' ')
@ -50,5 +52,3 @@ test "$result" = "$expected" || {
echo "result: \"$result\""
dump_log_and_fail_with "$STRACE $args output mismatch"
}
exit 0