aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-06-13 15:07:24 +0000
committerDmitry V. Levin <ldv@altlinux.org>2014-06-13 15:58:01 +0000
commitc588b205be19f84f757dec6f2e6ed2a157750f97 (patch)
tree202fe57a176d7bbceb23b93ffb4546dc6aeeb9f4
parent73741d2e2ee0f9d446b0dc2fbc70be3f5b10521b (diff)
downloadstrace-c588b205be19f84f757dec6f2e6ed2a157750f97.tar.gz
tests: enhance -k test
Add two more function calls to the stack. Suggested by Masatake YAMATO. * tests/stack-fcall.c (f1): Rename to f3. (f1, f2): New functions. * tests/strace-k.test: Update.
-rw-r--r--tests/stack-fcall.c14
-rwxr-xr-xtests/strace-k.test2
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/stack-fcall.c b/tests/stack-fcall.c
index 1c66fefa..7329bdc6 100644
--- a/tests/stack-fcall.c
+++ b/tests/stack-fcall.c
@@ -3,12 +3,24 @@
/* Use "volatile" to avoid compiler optimization. */
-int f1(int i)
+int f3(int i)
{
static pid_t (* volatile g)(void) = getpid;
return g() + i;
}
+int f2(volatile int i)
+{
+ static int (* volatile g)(int) = f3;
+ return g(i) - i;
+}
+
+int f1(volatile int i)
+{
+ static int (* volatile g)(int) = f2;
+ return g(i) + i;
+}
+
int f0(volatile int i)
{
static int (* volatile g)(int) = f1;
diff --git a/tests/strace-k.test b/tests/strace-k.test
index 3845c8ce..f757fb91 100755
--- a/tests/strace-k.test
+++ b/tests/strace-k.test
@@ -23,7 +23,7 @@ $STRACE $args > $LOG 2>&1 || {
fail_ "$STRACE $args failed"
}
-expected='getpid f1 f0 main '
+expected='getpid f3 f2 f1 f0 main '
result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' $LOG |
tr '\n' ' ')