diff options
author | ddomingo <ddomingo@redhat.com> | 2008-10-06 16:19:08 +1000 |
---|---|---|
committer | ddomingo <ddomingo@redhat.com> | 2008-10-06 16:19:08 +1000 |
commit | 56bf4a62d293f8a353a63833cf945024d1d77ae8 (patch) | |
tree | 66d37792213c0e3b7cf5d6a11cdc3800c45bac87 /testsuite | |
parent | d77fecabffb83a90c7ef7b6ad81a183beb345330 (diff) | |
parent | 5311c037f83f66967f9de4cc66815f93940bb005 (diff) | |
download | systemtap-steved-56bf4a62d293f8a353a63833cf945024d1d77ae8.tar.gz systemtap-steved-56bf4a62d293f8a353a63833cf945024d1d77ae8.tar.xz systemtap-steved-56bf4a62d293f8a353a63833cf945024d1d77ae8.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.c | 87 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.exp | 21 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.stp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/debugpath.exp | 12 | ||||
-rw-r--r-- | testsuite/systemtap.base/global_end.exp | 8 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/ChangeLog | 8 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/access.c | 18 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/chmod.c | 3 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/link.c | 13 |
10 files changed, 170 insertions, 16 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 4825cd27..5ddee32c 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2008-10-04 Mark Wielaard <mjw@redhat.com> + + * systemtap.base/debugpath.exp: Guess a bit more intelligently + where debuginfo is installed. + +2008-10-03 Mark Wielaard <mjw@redhat.com> + + * systemtap.base/global_end.exp: Adjust expected foreach ordering. + 2008-10-01 Mark Wielaard <mjw@redhat.com> * semok/thirtythree.stp: Use page->mapping instead of page->inuse diff --git a/testsuite/systemtap.base/bz6850.c b/testsuite/systemtap.base/bz6850.c new file mode 100644 index 00000000..a8b78110 --- /dev/null +++ b/testsuite/systemtap.base/bz6850.c @@ -0,0 +1,87 @@ +/* Regression test for bugzilla 6850 */ + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> + +#define PASS_MARKER "./bz6850_pass" + +/* All this in an attempt to defeat gcc's over-aggressive inlining... */ +typedef pid_t (*forker)(int); +static forker call_chain[]; + +/* + * Both parent and child return from fork2() and fork1(). Both + * processes will hit the uretprobe trampolines. The handlers should + * run in the parent. With the bug fix in place, the child will return + * correctly and do the exec (but won't run the handlers). + */ +static pid_t fork2(int ignored) +{ + return fork(); +} + +static pid_t fork1(int func_index) +{ + ++func_index; + return call_chain[func_index](func_index); /* fork2() */ +} + +static pid_t fork_and_exec2(int func_index) +{ + pid_t child; + ++func_index; + child = call_chain[func_index](func_index); /* fork1() */ + if (child == 0) { + /* I'm the child. Create the marker file. */ + char *child_args[] = { "/bin/touch", PASS_MARKER, NULL }; + char *child_env[] = { NULL }; + execve(child_args[0], child_args, child_env); + perror("execve"); + fprintf(stderr, "FAIL: child couldn't exec.\n"); + exit(2); + } + return child; +} + +static pid_t fork_and_exec1(int func_index) +{ + ++func_index; + return call_chain[func_index](func_index); /* fork_and_exec2() */ +} + +static forker call_chain[] = { + fork_and_exec1, + fork_and_exec2, + fork1, + fork2, + NULL +}; + +main() +{ + pid_t child, wait_child; + int status = 0; + + (void) unlink(PASS_MARKER); + child = call_chain[0](0); /* fork_and_exec1() */ + if (child < 0) { + fprintf(stderr, "FAIL: fork_and_exec1() failed.\n"); + exit(1); + } + wait_child = wait(&status); + if (wait_child != child) { + fprintf(stderr, "FAIL: waited for %d but got %d\n", + child, wait_child); + exit(1); + } + if (WEXITSTATUS(status) != 0) { + fprintf(stderr, "FAIL: child died with status = %d\n", + WEXITSTATUS(status)); + exit(1); + } + exit(0); +} diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp new file mode 100644 index 00000000..cd56ddce --- /dev/null +++ b/testsuite/systemtap.base/bz6850.exp @@ -0,0 +1,21 @@ +set test bz6850 + +catch {exec gcc -g -o bz6850 $srcdir/$subdir/bz6850.c} err +if {$err == "" && [file exists bz6850]} then { pass "$test compile" } else { fail "$test compile" } + +set rc [stap_run_batch $srcdir/$subdir/bz6850.stp] +if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } + +if {! [installtest_p]} { untested "$test -p5"; return } + +spawn sudo stap $srcdir/$subdir/bz6850.stp -c ./bz6850 +expect { + -timeout 60 + -re {[^\r\n]*called\r\n} { exp_continue } + -re {[^\r\n]*returns\r\n} { exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {[file exists bz6850_pass]} then { pass "$test -p5" } else { fail "$test -p5" } +exec rm -f bz6850_pass bz6850 diff --git a/testsuite/systemtap.base/bz6850.stp b/testsuite/systemtap.base/bz6850.stp new file mode 100644 index 00000000..d6f41862 --- /dev/null +++ b/testsuite/systemtap.base/bz6850.stp @@ -0,0 +1,7 @@ +#! stap -p4 +probe process("./bz6850").function("*").call { + printf("%s called\n", probefunc()) +} +probe process("./bz6850").function("*").return { + printf("%s returns\n", probefunc()) +} diff --git a/testsuite/systemtap.base/debugpath.exp b/testsuite/systemtap.base/debugpath.exp index 9c42295d..bc92c081 100644 --- a/testsuite/systemtap.base/debugpath.exp +++ b/testsuite/systemtap.base/debugpath.exp @@ -11,7 +11,17 @@ wait set test "debugpath-good" set uname [exec /bin/uname -r] -spawn env SYSTEMTAP_DEBUGINFO_PATH=/lib/modules/$uname/build stap -e "probe kernel.function(\"sys_open\") {}" -p2 + +# Guess where debuginfo is installed +if [file isdirectory /usr/lib/debug/lib/modules/$uname] { + set debuginfo_path "/usr/lib/debug/lib/modules/$uname" +} elseif [file isdirectory /lib/modules/$uname/build] { + set debuginfo_path "/lib/modules/$uname/build" +} else { + set debuginfo_path "/lib/modules/$uname" +} + +spawn env SYSTEMTAP_DEBUGINFO_PATH=$debuginfo_path stap -e "probe kernel.function(\"sys_open\") {}" -p2 expect { -re {kernel.function.*pc=} { pass $test } timeout { fail "$test (timeout2)" } diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp index cd5c6f83..b6b9fd30 100644 --- a/testsuite/systemtap.base/global_end.exp +++ b/testsuite/systemtap.base/global_end.exp @@ -9,13 +9,13 @@ set ok 0 expect { -timeout 180 -re {one,0x1.*one,0x2.*two,0x1.*two,0x2} { incr ok; exp_continue } - -re {alpha."one".1.=0x1} { incr ok; exp_continue } - -re {alpha."one".2.=0x2} { incr ok; exp_continue } - -re {alpha."two".1.=0x3} { incr ok; exp_continue } -re {alpha."two".2.=0x4} { incr ok; exp_continue } + -re {alpha."two".1.=0x3} { incr ok; exp_continue } + -re {alpha."one".2.=0x2} { incr ok; exp_continue } + -re {alpha."one".1.=0x1} { incr ok; exp_continue } -re {gamma="abcdefghijklmnopqrstuvwxyz"} { incr ok; exp_continue } - -re {iota."one".="eleven"} { incr ok; exp_continue } -re {iota."two".="twelve"} { incr ok; exp_continue } + -re {iota."one".="eleven"} { incr ok; exp_continue } -re {epsilon."one",1. @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue } -re {epsilon."two",2. @count=0x4 @min=0xa @max=0x28 @sum=0x64 @avg=0x19} { incr ok; exp_continue } -re {phi @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue } diff --git a/testsuite/systemtap.syscall/ChangeLog b/testsuite/systemtap.syscall/ChangeLog index 772f980a..7cb97dff 100644 --- a/testsuite/systemtap.syscall/ChangeLog +++ b/testsuite/systemtap.syscall/ChangeLog @@ -1,3 +1,11 @@ +2008-10-04 Mark Wielaard <mjw@redhat.com> + + * access.c: sys_access() calls through to sys_faccessat(). + * chmod.c: sys_chmod() calls through to sys_fchmodat(). + * link.c: sys_link() calls through to sys_linkat(), + sys_symlink() calls through to sys_symlinkat(), + sys_readlink() calls through to sys_readlinkat(). + 2008-09-17 Mark Wielaard <mjw@redhat.com> * forkwait.c: Low byte of flags is always set to SIGCHLD. diff --git a/testsuite/systemtap.syscall/access.c b/testsuite/systemtap.syscall/access.c index 065206b7..682424d4 100644 --- a/testsuite/systemtap.syscall/access.c +++ b/testsuite/systemtap.syscall/access.c @@ -13,22 +13,28 @@ int main() fd1 = creat("foobar1",S_IREAD|S_IWRITE); access("foobar1", F_OK); - // access ("foobar1", F_OK) = 0 + // access ("foobar1", F_OK) + // faccessat (AT_FDCWD, "foobar1", F_OK) = 0 access("foobar1", R_OK); - // access ("foobar1", R_OK) = 0 + // access ("foobar1", R_OK) + // faccessat (AT_FDCWD, "foobar1", R_OK) = 0 access("foobar1", W_OK); - // access ("foobar1", W_OK) = 0 + // access ("foobar1", W_OK) + // faccessat (AT_FDCWD, "foobar1", W_OK) = 0 access("foobar1", X_OK); - // access ("foobar1", X_OK) = -NNNN (EACCES) + // access ("foobar1", X_OK) + // faccessat (AT_FDCWD, "foobar1", X_OK) = -NNNN (EACCES) access("foobar1", R_OK|W_OK); - // access ("foobar1", W_OK |R_OK) = 0 + // access ("foobar1", W_OK |R_OK) + // faccessat (AT_FDCWD, "foobar1", W_OK |R_OK) = 0 access("foobar1", R_OK|W_OK|X_OK); - // access ("foobar1", X_OK |W_OK |R_OK) = -NNNN (EACCES) + // access ("foobar1", X_OK |W_OK |R_OK) + // faccessat (AT_FDCWD, "foobar1", X_OK |W_OK |R_OK) = -NNNN (EACCES) return 0; } diff --git a/testsuite/systemtap.syscall/chmod.c b/testsuite/systemtap.syscall/chmod.c index 671c74bc..9b0c58e1 100644 --- a/testsuite/systemtap.syscall/chmod.c +++ b/testsuite/systemtap.syscall/chmod.c @@ -14,7 +14,8 @@ int main() // open ("foobar", O_WRONLY|O_CREAT, 0666) = NNNN chmod("foobar", 0644); - // chmod ("foobar", 0644) = 0 + // chmod ("foobar", 0644) + // fchmodat (AT_FDCWD, "foobar", 0644) = 0 fchmod(fd, 0444); // fchmod (NNNN, 0444) = 0 diff --git a/testsuite/systemtap.syscall/link.c b/testsuite/systemtap.syscall/link.c index 89d7545d..81280bf2 100644 --- a/testsuite/systemtap.syscall/link.c +++ b/testsuite/systemtap.syscall/link.c @@ -13,19 +13,24 @@ int main() close(fd); link("foobar", "foobar2"); - // link ("foobar", "foobar2") = 0 + // link ("foobar", "foobar2") + // linkat (AT_FDCWD, "foobar", AT_FDCWD, "foobar2", 0x0) = 0 link("foobar", "foobar"); - // link ("foobar", "foobar") = -NNNN (EEXIST) + // link ("foobar", "foobar") + // linkat (AT_FDCWD, "foobar", AT_FDCWD, "foobar", 0x0) = -NNNN (EEXIST) link("nonexist", "foo"); - // link ("nonexist", "foo") = -NNNN (ENOENT) + // link ("nonexist", "foo") + // linkat (AT_FDCWD, "nonexist", AT_FDCWD, "foo", 0x0) = -NNNN (ENOENT) symlink("foobar", "Sfoobar"); - // symlink ("foobar", "Sfoobar") = 0 + // symlink ("foobar", "Sfoobar") + // symlinkat ("foobar", AT_FDCWD, "Sfoobar") = 0 readlink("Sfoobar", buf, sizeof(buf)); // readlink ("Sfoobar", XXXX, 128) + // readlinkat (AT_FDCWD, "Sfoobar", XXXX, 128) return 0; } |