summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog13
-rwxr-xr-xtestsuite/buildok/maxactive01.stp6
-rwxr-xr-xtestsuite/parseko/maxactive01.stp7
-rwxr-xr-xtestsuite/parseko/maxactive02.stp9
-rwxr-xr-xtestsuite/parseko/maxactive03.stp9
-rwxr-xr-xtestsuite/parseko/maxactive04.stp7
-rwxr-xr-xtestsuite/semko/maxactive01.stp7
-rwxr-xr-xtestsuite/semko/maxactive02.stp7
-rwxr-xr-xtestsuite/semko/maxactive03.stp7
-rw-r--r--testsuite/systemtap.base/maxactive.exp103
10 files changed, 175 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index ac5c98cb..45be807b 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2006-11-09 David Smith <dsmith@redhat.com>
+
+ * buildok/maxactive01.stp: Added test for "maxactive(N)"
+ return probe processing.
+ * parseko/maxactive01.stp: Ditto.
+ * parseko/maxactive02.stp: Ditto.
+ * parseko/maxactive03.stp: Ditto.
+ * parseko/maxactive04.stp: Ditto.
+ * semko/maxactive01.stp: Ditto.
+ * semko/maxactive02.stp: Ditto.
+ * semko/maxactive03.stp: Ditto.
+ * systemtap.base/maxactive.exp: Ditto.
+
2006-11-06 David Smith <dsmith@redhat.com>
* systemtap.maps/foreach_limit.exp: Added new test for foreach
diff --git a/testsuite/buildok/maxactive01.stp b/testsuite/buildok/maxactive01.stp
new file mode 100755
index 00000000..220e6596
--- /dev/null
+++ b/testsuite/buildok/maxactive01.stp
@@ -0,0 +1,6 @@
+#!./stap -p4
+
+probe kernel.function("sys_read").return.maxactive(3)
+{
+ printf(".");
+}
diff --git a/testsuite/parseko/maxactive01.stp b/testsuite/parseko/maxactive01.stp
new file mode 100755
index 00000000..d0a8c4da
--- /dev/null
+++ b/testsuite/parseko/maxactive01.stp
@@ -0,0 +1,7 @@
+#!./stap -p2
+
+# maxactive with "begin" probe
+
+probe begin.maxactive(3)
+{
+}
diff --git a/testsuite/parseko/maxactive02.stp b/testsuite/parseko/maxactive02.stp
new file mode 100755
index 00000000..e2fdb996
--- /dev/null
+++ b/testsuite/parseko/maxactive02.stp
@@ -0,0 +1,9 @@
+#!./stap -p1
+
+# maxactive with a non-number argument
+
+global N = 2
+
+probe kernel.function("*").return.maxactive(N)
+{
+}
diff --git a/testsuite/parseko/maxactive03.stp b/testsuite/parseko/maxactive03.stp
new file mode 100755
index 00000000..e61cce7c
--- /dev/null
+++ b/testsuite/parseko/maxactive03.stp
@@ -0,0 +1,9 @@
+#!./stap -p1
+
+# maxactive with a non-number argument
+
+function four() { return 4 }
+
+probe kernel.function("*").return.maxactive(four())
+{
+}
diff --git a/testsuite/parseko/maxactive04.stp b/testsuite/parseko/maxactive04.stp
new file mode 100755
index 00000000..b7fcaea9
--- /dev/null
+++ b/testsuite/parseko/maxactive04.stp
@@ -0,0 +1,7 @@
+#!./stap -p1
+
+# maxactive with a numeric expression argument
+
+probe kernel.function("*").return.maxactive(3 + 2)
+{
+}
diff --git a/testsuite/semko/maxactive01.stp b/testsuite/semko/maxactive01.stp
new file mode 100755
index 00000000..58851970
--- /dev/null
+++ b/testsuite/semko/maxactive01.stp
@@ -0,0 +1,7 @@
+#!./stap -p2
+
+# maxactive not on a return probe
+
+probe kernel.function("*").maxactive(3)
+{
+}
diff --git a/testsuite/semko/maxactive02.stp b/testsuite/semko/maxactive02.stp
new file mode 100755
index 00000000..55b79582
--- /dev/null
+++ b/testsuite/semko/maxactive02.stp
@@ -0,0 +1,7 @@
+#!./stap -p2
+
+# maxactive with a string argument
+
+probe kernel.function("*").return.maxactive("hi")
+{
+}
diff --git a/testsuite/semko/maxactive03.stp b/testsuite/semko/maxactive03.stp
new file mode 100755
index 00000000..35deecd8
--- /dev/null
+++ b/testsuite/semko/maxactive03.stp
@@ -0,0 +1,7 @@
+#!./stap -p1
+
+# maxactive on a timer probe
+
+probe timer.sec(100).maxactive(3)
+{
+}
diff --git a/testsuite/systemtap.base/maxactive.exp b/testsuite/systemtap.base/maxactive.exp
new file mode 100644
index 00000000..d5fdd0d2
--- /dev/null
+++ b/testsuite/systemtap.base/maxactive.exp
@@ -0,0 +1,103 @@
+# maxactive.exp
+#
+# Check to see if using the 'maxactive(N)' limit on return probes
+# works, by seeing if skipped probes increases when using it.
+
+if {[info procs installtest_p] != "" && ![installtest_p]} {
+ untested "MAXACTIVE"
+ return
+}
+
+# stap_run variant that sets 'skipped_probes' to the number of skipped
+# probes in a run.
+#
+# stap_run_skipped TEST_NAME
+# TEST_NAME is path to the current test
+# Additional arguments are passed to stap as-is.
+proc stap_run_skipped { TEST_NAME args } {
+ global skipped_probes
+
+ # initialize skipped_probes to 0
+ set skipped_probes 0
+
+ set cmd [concat {stap -v} $args]
+ eval spawn $cmd
+ expect {
+ -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n}
+ {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"; exp_continue}
+ -re {^Pass\ ([34]): using cached .+\r\n}
+ {set pass$expect_out(1,string) "\t0\t0\t0"; exp_continue}
+ -re {^Pass 5: starting run.\r\n} {exp_continue}
+ -timeout 30 -re "^systemtap starting probe\r\n" {
+ pass "$TEST_NAME startup"
+
+ # check the output to see if it is sane
+ set output "^systemtap ending probe\r\n"
+
+ expect {
+ -re $output {
+ pass "$TEST_NAME shutdown and output"
+ expect {
+ -re {^Pass\ ([5]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n}
+ {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"
+ verbose -log "metric:\t$TEST_NAME $pass1$pass2$pass3$pass4$pass5"}
+ -re {^WARNING: Number of errors: 0, skipped probes: ([0-9]+)\r\n}
+ {set skipped_probes $expect_out(1,string)}
+ }
+ }
+ timeout { fail "$TEST_NAME shutdown (timeout)" }
+ eof { fail "$TEST_NAME shutdown (eof)" }
+ }
+ }
+ -re "semantic error:" { fail "$TEST_NAME compilation" }
+ timeout { fail "$TEST_NAME startup (timeout)"; send "\003" }
+ eof { fail "$TEST_NAME startup (eof)" }
+ }
+ catch close
+ wait
+}
+
+# Script1. For 5 seconds, probe the return of "sys_select" and
+# "sys_read". See if we skip any probes.
+set script1 {
+ probe kernel.function("sys_select").return,
+ kernel.function("sys_read").return { }
+
+ probe timer.ms(5000) { exit(); }
+ probe begin { log("systemtap starting probe"); }
+ probe end { log("systemtap ending probe"); }
+}
+
+# Run script1 and save the number of skipped probes (which will most
+# likely be 0).
+stap_run_skipped "MAXACTIVE01" -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
+# skip any probes.
+set script2 {
+ probe kernel.function("sys_select").return.maxactive(1),
+ kernel.function("sys_read").return.maxactive(1) { }
+
+ probe timer.ms(5000) { exit(); }
+ probe begin { log("systemtap starting probe"); }
+ probe end { log("systemtap ending probe"); }
+}
+
+# Run script2 and save the number of skipped probes.
+stap_run_skipped "MAXACTIVE02" -e $script2
+set skipped2 $skipped_probes
+
+# If the number of skipped probes for script 1 is less than the number
+# of skipped probes for script 2, we can assume that "maxactive(N)" is
+# working.
+#
+# Note that this isn't 100% accurate based on the system load at the
+# time of the scripts.
+set TEST_NAME "MAXACTIVE03"
+if {$skipped1 < $skipped2} {
+ pass "$TEST_NAME ($skipped1 skipped probes < $skipped2 skipped probes)"
+} else {
+ fail "$TEST_NAME ($skipped1 skipped probes > $skipped2 skipped probes)"
+}