]> granicus.if.org Git - strace/commitdiff
tests: parametrize strace-k.test
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 29 Dec 2017 15:20:21 +0000 (15:20 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 29 Dec 2017 15:20:21 +0000 (15:20 +0000)
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.

tests/Makefile.am
tests/stack-fcall-0.c
tests/stack-fcall-1.c
tests/stack-fcall-2.c
tests/stack-fcall-3.c
tests/stack-fcall.c
tests/stack-fcall.h [new file with mode: 0644]
tests/strace-k.test

index 3def7304009bc3acee183eb7227c70fb2cb808ac..a6703e69fdbbfd4fe8ae6038ca85a4a91fb983d3 100644 (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 \
index 12a260deb31fab282e805084cadd530d9adaa254..edd6d326c5a360611dededf13ab5a696b9e50954 100644 (file)
@@ -1,4 +1,4 @@
-int f1(int i);
+#include "stack-fcall.h"
 
 int f0(int i)
 {
index 8716702dfc3ccd02770d396737d9c7b575c7f72c..5d0bf0e6cd255357451add3fe1de292ab919db9a 100644 (file)
@@ -1,4 +1,4 @@
-int f2(int i);
+#include "stack-fcall.h"
 
 int f1(int i)
 {
index 19f8cf83cb290b3b1ca25e5bfe7e1c7f935102d8..e1643207862a465ad529c39ddb658b88b609b58c 100644 (file)
@@ -1,4 +1,4 @@
-int f3(int i);
+#include "stack-fcall.h"
 
 int f2(int i)
 {
index 3af1667f43c08be9949f1193d84e0a2bec2c4217..98726d8f3f22acfee4bd1de3cfbde130cbce5a1f 100644 (file)
@@ -1,4 +1,5 @@
 #include <unistd.h>
+#include "stack-fcall.h"
 
 int f3(int i)
 {
index fc9ee5f9d6e2e98d4b54e68b9e958f7bf17bf4e5..e0ec3b1ae3b62824f75d2976654785e31a558138 100644 (file)
@@ -1,4 +1,4 @@
-int f0(int i);
+#include "stack-fcall.h"
 
 int main(int argc, char **argv)
 {
diff --git a/tests/stack-fcall.h b/tests/stack-fcall.h
new file mode 100644 (file)
index 0000000..afe0bfa
--- /dev/null
@@ -0,0 +1,4 @@
+int f0(int i);
+int f1(int i);
+int f2(int i);
+int f3(int i);
index e68951e8f1a567b35fa42ebfc3ded175b54efeee..9d8934dd7387cdfbdd23290118b500bfcbcac5dc 100755 (executable)
 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