summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/alternatives.exp8
-rw-r--r--testsuite/systemtap.base/cast.exp2
-rw-r--r--testsuite/systemtap.base/cast.stp24
-rw-r--r--testsuite/systemtap.base/flightrec2.exp17
-rw-r--r--testsuite/systemtap.base/flightrec2.stp4
-rw-r--r--testsuite/systemtap.base/maxactive.exp16
-rw-r--r--testsuite/systemtap.base/onoffprobe.stp4
-rw-r--r--testsuite/systemtap.base/optionalprobe.exp9
-rw-r--r--testsuite/systemtap.base/optionalprobe.stp6
-rw-r--r--testsuite/systemtap.base/overload.exp2
-rw-r--r--testsuite/systemtap.base/stmtvars.exp6
-rw-r--r--testsuite/systemtap.base/system_func.stp4
12 files changed, 60 insertions, 42 deletions
diff --git a/testsuite/systemtap.base/alternatives.exp b/testsuite/systemtap.base/alternatives.exp
index deaf3bf8..fb263d7a 100644
--- a/testsuite/systemtap.base/alternatives.exp
+++ b/testsuite/systemtap.base/alternatives.exp
@@ -14,11 +14,11 @@
# listed, but that some alternatives are listed.
set local1_script {
- probe kernel.function("sys_getrlimit") { x = $z; }
+ probe kernel.funtion("vfs_write") { ret = $z; }
}
set struct1_script {
- probe kernel.function("sys_getrlimit") { rlim_cur = $rlim->rlim_cud; }
+ probe kernel.function("vfs_write") { f_pos = $file->f_po; }
}
proc stap_run_alternatives {args} {
@@ -38,8 +38,8 @@ proc stap_run_alternatives {args} {
set test "LOCAL1"
set rc [stap_run_alternatives stap -vu -p2 -e $local1_script]
-if {$rc == 1} { pass $test } else { fail "$test ($rc)" }
+if {$rc >= 1} { pass $test } else { fail "$test ($rc)" }
set test "STRUCT1"
set rc [stap_run_alternatives stap -vu -p2 -e $struct1_script]
-if {$rc == 1} { pass $test } else { fail "$test ($rc)" }
+if {$rc >= 1} { pass $test } else { fail "$test ($rc)" }
diff --git a/testsuite/systemtap.base/cast.exp b/testsuite/systemtap.base/cast.exp
index 74c4d72a..374132f0 100644
--- a/testsuite/systemtap.base/cast.exp
+++ b/testsuite/systemtap.base/cast.exp
@@ -2,5 +2,5 @@ set test "cast"
set ::result_string {PID OK
PID2 OK
execname OK
-tv_sec OK}
+sa_data OK}
stap_run2 $srcdir/$subdir/$test.stp -g
diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp
index 6298a06d..e2505000 100644
--- a/testsuite/systemtap.base/cast.stp
+++ b/testsuite/systemtap.base/cast.stp
@@ -25,19 +25,23 @@ probe begin
else
printf("execname \"%s\" != \"%s\"\n", name, cast_name)
- // Compare tv_sec using a generated user module
- sec = 42
- cast_sec = @cast(get_timeval(sec), "timeval", "<sys/time.h>")->tv_sec
- if (sec == cast_sec)
- println("tv_sec OK")
+ // Compare sa_data using a generated user module
+ data = 42
+ cast_data = @cast(get_sockaddr(data), "sockaddr", "<sys/socket.h>")->sa_data[0]
+ if (data == cast_data)
+ println("sa_data OK")
else
- printf("tv_sec %d != %d\n", sec, cast_sec)
+ printf("sa_data %d != %d\n", data, cast_data)
exit()
}
-function get_timeval:long(sec:long) %{
- static struct timeval mytime = {0};
- mytime.tv_sec = THIS->sec;
- THIS->__retvalue = (long)&mytime;
+%{
+#include <linux/socket.h>
+%}
+
+function get_sockaddr:long(data:long) %{
+ static struct sockaddr sa = {0};
+ sa.sa_data[0] = THIS->data;
+ THIS->__retvalue = (long)&sa;
%}
diff --git a/testsuite/systemtap.base/flightrec2.exp b/testsuite/systemtap.base/flightrec2.exp
index a22ef415..d4481db4 100644
--- a/testsuite/systemtap.base/flightrec2.exp
+++ b/testsuite/systemtap.base/flightrec2.exp
@@ -26,13 +26,12 @@ exec sleep 4
set scnt 0
set cnt1 0
# wait for log files
-spawn ls -sk1
+eval spawn stat -c %s [glob flightlog.out.*]
expect {
-timeout 100
- -re {([0-9]+) flightlog\.out\.[0-9]+} {
+ -re {[0-9]+} {
incr cnt1;
- if {$expect_out(1,string) <= 1028} {incr scnt}
- # 1024 + 4(for inode blocks?)
+ if {$expect_out(buffer) <= 1048576 } {incr scnt}
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
@@ -40,12 +39,12 @@ wait
exec sleep 3
set cnt2 0
# wait for log files
-spawn ls -sk1
+eval spawn stat -c %s [glob flightlog.out.*]
expect {
-timeout 100
- -re {([0-9]+) flightlog\.out\.[0-9]+} {
+ -re {[0-9]+} {
incr cnt2;
- if {$expect_out(1,string) <= 1028} {incr scnt}
+ if {$expect_out(buffer) <= 1048576 } {incr scnt}
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
@@ -57,10 +56,10 @@ if {$cnt1 == 3 && $cnt2 == 3} {
fail "$test (log file numbers ($cnt1, $cnt2))"
}
# check logfile size
-if {$scnt == 6} {
+if {$scnt == $cnt1 + $cnt2 } {
pass "$test (log file size limitation)"
} else {
- fail "$test (log file size ($scnt))"
+ fail "$test (log file size ($scnt != $cnt1 + $cnt2))"
}
exec kill -TERM $pid
# wait for exiting...
diff --git a/testsuite/systemtap.base/flightrec2.stp b/testsuite/systemtap.base/flightrec2.stp
index 9d745f4b..f42c9b8e 100644
--- a/testsuite/systemtap.base/flightrec2.stp
+++ b/testsuite/systemtap.base/flightrec2.stp
@@ -1,5 +1,5 @@
-probe timer.ms(1)
+probe timer.ms(10)
{
- for (j = 0; j < 100; j++)
+ for (j = 0; j < 1000; j++)
printf("1234567890\n")
}
diff --git a/testsuite/systemtap.base/maxactive.exp b/testsuite/systemtap.base/maxactive.exp
index 7c03a1bf..79ede897 100644
--- a/testsuite/systemtap.base/maxactive.exp
+++ b/testsuite/systemtap.base/maxactive.exp
@@ -10,12 +10,12 @@ proc sleep_five_sec {} {
return 0;
}
-# Script1. For 5 seconds, probe the return of "sys_select" and
-# "sys_read". See if we skip any probes.
+# Script1. For 5 seconds, probe the return of "vfs_read" and
+# "do_select". See if we skip any probes.
set script1 {
global foo
- probe kernel.function("sys_select").return,
- kernel.function("sys_read").return { foo++ }
+ probe kernel.function("vfs_read").return,
+ kernel.function("do_select").return { foo++ }
probe timer.ms(5000) { exit(); }
probe begin { log("systemtap starting probe"); log("systemtap ending probe");}
@@ -26,13 +26,13 @@ set script1 {
stap_run "MAXACTIVE01" sleep_five_sec "" -e $script1
set skipped1 $skipped_probes
-# Script2. For 5 seconds, probe the return of "sys_select" and
-# "sys_read", with a limit of 1 probe active at a time. See if we
+# Script2. For 5 seconds, probe the return of "vfs_read" and
+# "do_select", with a limit of 1 probe active at a time. See if we
# skip any probes.
set script2 {
global foo
- probe kernel.function("sys_select").return.maxactive(1),
- kernel.function("sys_read").return.maxactive(1) { foo++ }
+ probe kernel.function("vfs_read").return.maxactive(1),
+ kernel.function("do_select").return.maxactive(1) { foo++ }
probe timer.ms(5000) { exit(); }
probe begin { log("systemtap starting probe"); log("systemtap ending probe");}
diff --git a/testsuite/systemtap.base/onoffprobe.stp b/testsuite/systemtap.base/onoffprobe.stp
index f7169039..79c41a3c 100644
--- a/testsuite/systemtap.base/onoffprobe.stp
+++ b/testsuite/systemtap.base/onoffprobe.stp
@@ -10,13 +10,13 @@ probe begin if (switch==0) {
}
#dwarf probe (return)
-probe kernel.function("sys_write").return if (switch == 1) {
+probe kernel.function("vfs_write").return if (switch == 1) {
log("function return probed")
switch = 0
}
#dwarf probe (entry)
-probe kernel.function("sys_write") if (switch == 2) {
+probe kernel.function("vfs_write").return if (switch == 2) {
log("function entry probed")
switch = 0
}
diff --git a/testsuite/systemtap.base/optionalprobe.exp b/testsuite/systemtap.base/optionalprobe.exp
new file mode 100644
index 00000000..5484003c
--- /dev/null
+++ b/testsuite/systemtap.base/optionalprobe.exp
@@ -0,0 +1,9 @@
+set test "optionalprobe"
+spawn stap -p2 -w $srcdir/$subdir/$test.stp
+expect {
+ -timeout 60
+ -re "# probes\r\n" { exp_continue }
+ -re "^begin" { pass $test }
+ eof { fail $test }
+ timeout { fail "$test unexpected timeout" }
+}
diff --git a/testsuite/systemtap.base/optionalprobe.stp b/testsuite/systemtap.base/optionalprobe.stp
new file mode 100644
index 00000000..239cf6e3
--- /dev/null
+++ b/testsuite/systemtap.base/optionalprobe.stp
@@ -0,0 +1,6 @@
+#! stap
+
+# test optional probe
+
+probe foo ?, bar !, foo* ?, bar* !, begin {
+}
diff --git a/testsuite/systemtap.base/overload.exp b/testsuite/systemtap.base/overload.exp
index cbcbe817..ac9ceb24 100644
--- a/testsuite/systemtap.base/overload.exp
+++ b/testsuite/systemtap.base/overload.exp
@@ -8,7 +8,7 @@ set script {
k["foo"] = 0
}
- probe kernel.function("sys_read"), kernel.function("sys_write") {
+ probe kernel.function("vfs_read"), kernel.function("vfs_write") {
k["foo"]++
}
probe end {
diff --git a/testsuite/systemtap.base/stmtvars.exp b/testsuite/systemtap.base/stmtvars.exp
index 822e0d7e..c0099f2d 100644
--- a/testsuite/systemtap.base/stmtvars.exp
+++ b/testsuite/systemtap.base/stmtvars.exp
@@ -3,9 +3,9 @@ set test "stmtvars"
set pc 0
set vars ""
-spawn stap -e "probe kernel.function(\"sys_open\") {\$foo}" -p4 -vv -u
+spawn stap -e "probe kernel.function(\"do_sys_open\") {\$foo}" -p4 -vv -u
expect {
- -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue }
+ -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue }
-re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars $expect_out(1,string); exp_continue }
timeout { fail "$test (timeout)" }
eof
@@ -18,7 +18,7 @@ set pc2 0
set vars2 ""
spawn stap -e "probe kernel.statement($pc) {\$foo}" -p4 -vv -u
expect {
- -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue }
+ -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue }
-re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars2 $expect_out(1,string); exp_continue }
timeout { fail "$test (timeout)" }
eof
diff --git a/testsuite/systemtap.base/system_func.stp b/testsuite/systemtap.base/system_func.stp
index d14fb25b..6a6bb04a 100644
--- a/testsuite/systemtap.base/system_func.stp
+++ b/testsuite/systemtap.base/system_func.stp
@@ -4,10 +4,10 @@
global saw_echo, did_cat
-probe kernel.function("sys_open") {
+probe kernel.function("do_sys_open") {
if (!saw_echo) {
# very inefficient. Testing only. DO NOT DO THIS
- msg="echo sys_open"
+ msg="echo do_sys_open"
system(msg)
saw_echo = 1
}