summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/flightrec1.exp43
-rw-r--r--testsuite/systemtap.base/flightrec2.exp69
-rw-r--r--testsuite/systemtap.base/flightrec2.stp5
-rw-r--r--testsuite/systemtap.base/kprobes.exp2
-rw-r--r--testsuite/systemtap.base/kprobes.stp10
-rw-r--r--testsuite/systemtap.base/strftime.exp49
6 files changed, 174 insertions, 4 deletions
diff --git a/testsuite/systemtap.base/flightrec1.exp b/testsuite/systemtap.base/flightrec1.exp
new file mode 100644
index 00000000..c32a77f2
--- /dev/null
+++ b/testsuite/systemtap.base/flightrec1.exp
@@ -0,0 +1,43 @@
+set test "flightrec1"
+if {![installtest_p]} { untested $test; return }
+
+# run stapio in background mode
+spawn stap -F -o $test.out -we {probe begin {}}
+# check whether stap outputs stapio pid
+set pid 0
+expect {
+ -timeout 240
+ -re {([0-9]+)\r\n} {
+ pass "$test (flight recorder option)"
+ set pid $expect_out(1,string)
+ exp_continue}
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+wait
+if {$pid == 0} {
+ fail "$test (no pid)"
+ return -1
+}
+
+# check whether stapio is running in background
+spawn ps -o cmd hc $pid
+expect {
+ -timeout 10
+ "stapio" {pass "$test (stapio in background)"} # don't contine
+ timeout { fail "$test (timeout)"}
+ eof { fail "$test (stapio was not found)" }
+}
+wait
+
+exec kill -TERM $pid
+
+# check output file
+if {[catch {exec rm $test.out}]} {
+ fail "$test (no output file)"
+ return -1
+} else {
+ pass "$test (output file)"
+}
+
+
diff --git a/testsuite/systemtap.base/flightrec2.exp b/testsuite/systemtap.base/flightrec2.exp
new file mode 100644
index 00000000..a22ef415
--- /dev/null
+++ b/testsuite/systemtap.base/flightrec2.exp
@@ -0,0 +1,69 @@
+set test "flightrec2"
+if {![installtest_p]} { untested $test; return }
+
+# cleanup
+system "rm -f flightlog.out*"
+
+set pid 0
+# check -S option
+spawn stap -F -o flightlog.out -S 1,3 $srcdir/$subdir/$test.stp
+expect {
+ -timeout 240
+ -re {([0-9]+)\r\n} {
+ pass "$test (-S option)"
+ set pid $expect_out(1,string)
+ exp_continue}
+ timeout { fail "$test (timeout)"}
+ eof { }
+}
+wait
+if {$pid == 0} {
+ fail "$test (no pid)"
+ return -1
+}
+
+exec sleep 4
+set scnt 0
+set cnt1 0
+# wait for log files
+spawn ls -sk1
+expect {
+ -timeout 100
+ -re {([0-9]+) flightlog\.out\.[0-9]+} {
+ incr cnt1;
+ if {$expect_out(1,string) <= 1028} {incr scnt}
+ # 1024 + 4(for inode blocks?)
+ exp_continue}
+ timeout { fail "$test (logfile timeout)"}
+}
+wait
+exec sleep 3
+set cnt2 0
+# wait for log files
+spawn ls -sk1
+expect {
+ -timeout 100
+ -re {([0-9]+) flightlog\.out\.[0-9]+} {
+ incr cnt2;
+ if {$expect_out(1,string) <= 1028} {incr scnt}
+ exp_continue}
+ timeout { fail "$test (logfile timeout)"}
+}
+wait
+# check logfile number
+if {$cnt1 == 3 && $cnt2 == 3} {
+ pass "$test (log file numbers limitation)"
+} else {
+ fail "$test (log file numbers ($cnt1, $cnt2))"
+}
+# check logfile size
+if {$scnt == 6} {
+ pass "$test (log file size limitation)"
+} else {
+ fail "$test (log file size ($scnt))"
+}
+exec kill -TERM $pid
+# wait for exiting...
+exec sleep 1
+system "rm -f flightlog.out*"
+
diff --git a/testsuite/systemtap.base/flightrec2.stp b/testsuite/systemtap.base/flightrec2.stp
new file mode 100644
index 00000000..9d745f4b
--- /dev/null
+++ b/testsuite/systemtap.base/flightrec2.stp
@@ -0,0 +1,5 @@
+probe timer.ms(1)
+{
+ for (j = 0; j < 100; j++)
+ printf("1234567890\n")
+}
diff --git a/testsuite/systemtap.base/kprobes.exp b/testsuite/systemtap.base/kprobes.exp
index 240ecd82..635930f8 100644
--- a/testsuite/systemtap.base/kprobes.exp
+++ b/testsuite/systemtap.base/kprobes.exp
@@ -1,2 +1,2 @@
set test "kprobes"
-stap_run $srcdir/$subdir/$test.stp
+stap_run $srcdir/$subdir/$test.stp no_load "probe point hit"
diff --git a/testsuite/systemtap.base/kprobes.stp b/testsuite/systemtap.base/kprobes.stp
index 62c18347..884b321c 100644
--- a/testsuite/systemtap.base/kprobes.stp
+++ b/testsuite/systemtap.base/kprobes.stp
@@ -3,19 +3,23 @@
* Probe to test the functionality of kprobe-based probes
* (Dwarfless Probing)
*/
+global hit_str
probe begin
{
- println("\n Systemtap starting probe");
+ println("systemtap starting probe");
+ hit_str = ""
}
probe kprobe.function("vfs_read")
{
- printf("\n probe point hit");
+ hit_str = "probe point hit"
exit();
}
probe end
{
- println("\n Systemtap starting probe");
+ println("systemtap ending probe");
+ println(hit_str);
+ delete hit_str;
}
diff --git a/testsuite/systemtap.base/strftime.exp b/testsuite/systemtap.base/strftime.exp
new file mode 100644
index 00000000..ad9e471d
--- /dev/null
+++ b/testsuite/systemtap.base/strftime.exp
@@ -0,0 +1,49 @@
+set test "strftime"
+if {![installtest_p]} { untested $test; return }
+# cleanup
+system "rm -f %*"
+
+# check %S and %T
+set format %%%S_%T
+exec stap -o $format -we {probe begin {println("hello");exit()}}
+
+spawn ls -1
+set ok 0
+expect {
+ -re {%([0-9][0-9])_[0-9][0-9]:[0-9][0-9]:\1} {incr ok}
+ eof { }
+}
+wait
+
+if {$ok == 1} {
+ pass "$test (%S and %T)"
+} else {
+ fail "$test (%S and %T)"
+}
+
+# check except for %S and %T
+set format %%,%C,%Y,%y,%m,%d,%e,%F,%H,%I,%j,%k,%l,%M,%R,%u,%w
+
+set date1 [exec date +$format]
+# run stapio with strftime
+exec stap -o $format -we {probe begin {println("hello");exit()}}
+# check whether stap outputs stapio pid
+set date2 [exec date +$format]
+
+spawn ls -1
+set ok 0
+expect {
+ $date1 {incr ok}
+ $date2 {incr ok}
+ eof { }
+}
+wait
+
+if {$ok == 1} {
+ pass "$test (except %S and %T)"
+} else {
+ fail "$test (except %S and %T)"
+}
+
+# cleanup
+system "rm -f %*"