diff options
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/bz6905.c | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6905.exp | 25 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6905.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/cmd_parse.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.base/crash.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.base/pointer_array.stp | 11 | ||||
-rw-r--r-- | testsuite/systemtap.base/utrace_p4.exp | 19 | ||||
-rw-r--r-- | testsuite/systemtap.base/utrace_p5.exp | 22 |
8 files changed, 81 insertions, 11 deletions
diff --git a/testsuite/systemtap.base/bz6905.c b/testsuite/systemtap.base/bz6905.c new file mode 100644 index 00000000..bb3f524e --- /dev/null +++ b/testsuite/systemtap.base/bz6905.c @@ -0,0 +1,7 @@ +int main() +{ + int a; + + a = a + 1; + return 0; +} diff --git a/testsuite/systemtap.base/bz6905.exp b/testsuite/systemtap.base/bz6905.exp new file mode 100644 index 00000000..8119159e --- /dev/null +++ b/testsuite/systemtap.base/bz6905.exp @@ -0,0 +1,25 @@ +set test bz6905 + +catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err +if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" } + +if {![utrace_p]} { + catch {exec rm -f $test} + untested "$test -p2" + return +} + +set stapexe [exec /usr/bin/which stap] +spawn sudo $stapexe -p2 $srcdir/$subdir/$test.stp +set hint 0 +set probes 0 +expect { + -timeout 60 + -re "# probes" { incr hint; exp_continue } + -re {process.*statement.*} { incr probes; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if { $hint == 1 && $probes > 0 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" } +exec rm -f $test diff --git a/testsuite/systemtap.base/bz6905.stp b/testsuite/systemtap.base/bz6905.stp new file mode 100644 index 00000000..73c7d50c --- /dev/null +++ b/testsuite/systemtap.base/bz6905.stp @@ -0,0 +1,4 @@ +#! stap -p2 +probe process("./bz6905").statement("main@bz6905.c:*") { + printf("ok") +} diff --git a/testsuite/systemtap.base/cmd_parse.exp b/testsuite/systemtap.base/cmd_parse.exp index c6b098a4..b97d9448 100644 --- a/testsuite/systemtap.base/cmd_parse.exp +++ b/testsuite/systemtap.base/cmd_parse.exp @@ -116,7 +116,7 @@ wait;close spawn stap -L syscall.a* expect { -timeout 60 - -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:(string|long|unknown|stats))*\r\n)+} { pass "cmd_parse13" } + -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:[^:]+?)+\r\n)+} { pass "cmd_parse13" } timeout {fail "cmd_parse13: unexpected timeout"} eof {fail "cmd_parse13: unexpected EOF"} } diff --git a/testsuite/systemtap.base/crash.exp b/testsuite/systemtap.base/crash.exp index 9c3e5e05..59c8dadd 100644 --- a/testsuite/systemtap.base/crash.exp +++ b/testsuite/systemtap.base/crash.exp @@ -5,7 +5,7 @@ if {![installtest_p]} { untested $test; return } if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return } # Load a test script -spawn stap $srcdir/$subdir/testlog.stp -m testlog +spawn stap -e {probe begin {print("HelloWorld\n")}} -m testlog expect { -timeout 120 "HelloWorld\r\n" { diff --git a/testsuite/systemtap.base/pointer_array.stp b/testsuite/systemtap.base/pointer_array.stp index 1d15ebf4..cd420604 100644 --- a/testsuite/systemtap.base/pointer_array.stp +++ b/testsuite/systemtap.base/pointer_array.stp @@ -2,15 +2,8 @@ probe syscall.execve { if (pid() == target()) { println(user_string($argv[0])) - printf("%c\n", $argv[0][0]) - printf("%c\n", $argv[0][1]) - printf("%c\n", $argv[0][2]) - printf("%c\n", $argv[0][3]) - printf("%c\n", $argv[0][4]) - printf("%c\n", $argv[0][5]) - printf("%c\n", $argv[0][6]) - printf("%c\n", $argv[0][7]) - printf("%c\n", $argv[0][8]) + for (i=0; i<9; ++i) + printf("%c\n", $argv[0][i]) println($argv[0][9]) } } diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 8d323a8a..c76503cb 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -10,6 +10,7 @@ set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"} set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"} set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"} +set syscall_parms_script {"probe process(\"/bin/ls\").syscall { printf(\"|%s\", \$\$parms) }"} set syscall_return_script {"probe process(\"/bin/ls\").syscall.return { printf(\"|%d\", \$syscall) }"} set thread_begin_script {"probe process(\"/bin/ls\").thread.begin { print(\"ls thread.begin\") }"} set thread_end_script {"probe process(\"/bin/ls\").thread.end { print(\"ls thread.end\") }"} @@ -18,6 +19,7 @@ set all_begin_script {"probe process.begin { print(\"begin\") }"} set pid_begin_script {"probe process(123).begin { print(\"123 begin\") }"} set pid_end_script {"probe process(123).end { print(\"123 end\") }"} set pid_syscall_script {"probe process(123).syscall { printf(\"|%d\", \$syscall) }"} +set pid_parms_script {"probe process(123).syscall { printf(\"|%s\", \$\$parms) }"} set pid_syscall_return_script {"probe process(123).syscall.return { printf(\"|%d\", \$syscall) }"} set pid_thread_begin_script {"probe process(123).thread.begin { print(\"123 thread.begin\") }"} set pid_thread_end_script {"probe process(123).thread.end { print(\"123 thread.end\") }"} @@ -129,3 +131,20 @@ if {![utrace_p]} { # Try compiling an system-wide begin script stap_compile $TEST_NAME 1 $all_begin_script } + +set TEST_NAME "UTRACE_P4_08" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} else { + # Try compiling a syscall parms script using a path + stap_compile $TEST_NAME 1 $syscall_parms_script +} + +set TEST_NAME "UTRACE_P4_09" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} else { + # Try compiling a syscall parms script using a pid + stap_compile $TEST_NAME 1 $pid_parms_script +} + diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index 3d432dc3..7062bc0d 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -89,6 +89,18 @@ set bz6841_script { } set bz6841_script_output ".+ issues syscall \\d+ times\r\n" +set syscall_parms_script { + global syscall_parms_string + probe begin { printf("systemtap starting probe\n") } + probe process.syscall { syscall_parms_string = $$parms exit() } + probe end { printf("systemtap ending probe\n") + printf("%s\n",syscall_parms_string) + delete syscall_parms_string + } +} +set syscall_parms_script_output "(.+arg\[1-6\]=0x\[0-9a-f\]+)+\r\n" + + # Set up our own copy of /bin/cat, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating # a cross-device link. We can't use 'ln -s' here, since the kernel @@ -202,5 +214,15 @@ if {![utrace_p]} { -e $bz6841_script } +set TEST_NAME "UTRACE_P5_08" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} elseif {![installtest_p]} { + untested "$TEST_NAME" +} else { + set script [format $syscall_parms_script "%s"] + stap_run $TEST_NAME no_load $syscall_parms_script_output -e $script +} + # Cleanup exec rm -f $exepath $multi_exepath |