summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorjistone <jistone>2006-12-08 02:17:09 +0000
committerjistone <jistone>2006-12-08 02:17:09 +0000
commit16e8f21f336bcfc16a1174be8a8143668dbd0118 (patch)
treec967ecdec501b69910a16ee0f50317434ed49675 /testsuite
parente0d86324628566cedd055ed038fd487c12db676a (diff)
downloadsystemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.tar.gz
systemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.tar.xz
systemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.zip
2006-12-07 Josh Stone <joshua.i.stone@intel.com>
PR 3624. * tapsets.cxx (struct be_derived_probe): Add a new priority parameter for begin/end probes, and a comparison function for sorting. (be_builder::build): Parse the priority & pass it to be_derived_probe. (be_derived_probe_group::emit_module_init, emit_module_exit): Sort the probe list by priority before emitting any code. (register_standard_tapsets): Add new begin/end variants. * parse.cxx (parser::parse_literal): Allow negative numeric literals, by checking for a '-' unary operator right before a number. testsuite/ * systemtap.base/be_order.exp, systemtap.base/be_order.stp, semok/beginend.stp: New tests for begin/end priorities. * lib/stap_run.exp: Anchor OUTPUT_CHECK_STRING to the end of output. * systemtap.base/maxactive.exp: Fix to compare output to the end. * systemtap.base/probefunc.exp: Ditto. * systemtap.samples/ioblocktest.exp: Ditto. * systemtap.samples/ioblocktest.stp: Ditto. * systemtap.samples/tcptest.exp: Ditto.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog13
-rw-r--r--testsuite/lib/stap_run.exp2
-rwxr-xr-xtestsuite/semok/beginend.stp11
-rw-r--r--testsuite/systemtap.base/be_order.exp7
-rw-r--r--testsuite/systemtap.base/be_order.stp37
-rw-r--r--testsuite/systemtap.base/maxactive.exp9
-rw-r--r--testsuite/systemtap.base/probefunc.exp4
-rw-r--r--testsuite/systemtap.samples/ioblocktest.exp2
-rw-r--r--testsuite/systemtap.samples/ioblocktest.stp2
-rw-r--r--testsuite/systemtap.samples/tcptest.exp4
10 files changed, 82 insertions, 9 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 131bd06c..83a48057 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2006-12-07 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 3624.
+ * systemtap.base/be_order.exp, systemtap.base/be_order.stp,
+ semok/beginend.stp: New tests for begin/end priorities.
+
+ * lib/stap_run.exp: Anchor OUTPUT_CHECK_STRING to the end of output.
+ * systemtap.base/maxactive.exp: Fix to compare output to the end.
+ * systemtap.base/probefunc.exp: Ditto.
+ * systemtap.samples/ioblocktest.exp: Ditto.
+ * systemtap.samples/ioblocktest.stp: Ditto.
+ * systemtap.samples/tcptest.exp: Ditto.
+
2006-11-30 Martin Hunt <hunt@redhat.com>
* systemtap.samples/pfaults.exp: Fix regular expression
diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp
index 63ad597c..68fceb32 100644
--- a/testsuite/lib/stap_run.exp
+++ b/testsuite/lib/stap_run.exp
@@ -52,7 +52,7 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args }
send "\003"
# check the output to see if it is sane
- set output "^systemtap ending probe\r\n$OUTPUT_CHECK_STRING"
+ set output "^systemtap ending probe\r\n$OUTPUT_CHECK_STRING$"
expect {
-re $output {
diff --git a/testsuite/semok/beginend.stp b/testsuite/semok/beginend.stp
new file mode 100755
index 00000000..a5fe7fda
--- /dev/null
+++ b/testsuite/semok/beginend.stp
@@ -0,0 +1,11 @@
+#! stap -p2
+
+probe begin {}
+probe begin(0) {}
+probe begin(9223372036854775807) {}
+probe begin(-9223372036854775808) {}
+
+probe end {}
+probe end(0) {}
+probe end(9223372036854775807) {}
+probe end(-9223372036854775808) {}
diff --git a/testsuite/systemtap.base/be_order.exp b/testsuite/systemtap.base/be_order.exp
new file mode 100644
index 00000000..a40c7684
--- /dev/null
+++ b/testsuite/systemtap.base/be_order.exp
@@ -0,0 +1,7 @@
+# Simple function to test that ordering of begin/end probes works
+
+load_lib "stap_run.exp"
+
+set test "be_order"
+
+stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
diff --git a/testsuite/systemtap.base/be_order.stp b/testsuite/systemtap.base/be_order.stp
new file mode 100644
index 00000000..eb8ef0c8
--- /dev/null
+++ b/testsuite/systemtap.base/be_order.stp
@@ -0,0 +1,37 @@
+/*
+ * add.stp
+ *
+ * Check that ordering of begin/end probes works
+ */
+
+probe begin { log("systemtap starting probe") }
+probe end { log("systemtap ending probe") }
+
+global beginstr, endstr
+
+probe begin { beginstr .= "c" }
+probe begin(1) { beginstr .= "d" }
+probe begin(-1) { beginstr .= "b" }
+probe begin(0) { beginstr .= "c" }
+probe begin(9223372036854775807) { beginstr .= "e" }
+probe begin(-9223372036854775808) { beginstr .= "a" }
+
+probe end { endstr .= "x" }
+probe end(1) { endstr .= "y" }
+probe end(-1) { endstr .= "w" }
+probe end(0) { endstr .= "x" }
+probe end(9223372036854775807) {
+ endstr .= "z"
+
+ if (beginstr == "abccde")
+ log("systemtap test success")
+ else
+ printf("systemtap test failure - beginstr:%s != abccde\n", beginstr)
+
+ if (endstr == "vwxxyz")
+ log("systemtap test success")
+ else
+ printf("systemtap test failure - endstr:%s != vwxxyz\n", endstr)
+}
+probe end(-9223372036854775808) { endstr .= "v" }
+
diff --git a/testsuite/systemtap.base/maxactive.exp b/testsuite/systemtap.base/maxactive.exp
index b5cb7dd7..8754ff6e 100644
--- a/testsuite/systemtap.base/maxactive.exp
+++ b/testsuite/systemtap.base/maxactive.exp
@@ -3,6 +3,8 @@
# Check to see if using the 'maxactive(N)' limit on return probes
# works, by seeing if skipped probes increases when using it.
+load_lib "stap_run.exp"
+
if {[info procs installtest_p] != "" && ![installtest_p]} {
untested "MAXACTIVE"
return
@@ -42,7 +44,8 @@ set script2 {
}
# Run script2 and save the number of skipped probes.
-stap_run "MAXACTIVE02" sleep_five_sec "" -e $script2
+set output_string "(WARNING: Number of errors: 0, skipped probes: \\d+\r\n)?"
+stap_run "MAXACTIVE02" sleep_five_sec $output_string -e $script2
set skipped2 $skipped_probes
# If the number of skipped probes for script 1 is less than the number
@@ -52,8 +55,8 @@ set skipped2 $skipped_probes
# Note that this isn't 100% accurate based on the system load at the
# time of the scripts.
set test "MAXACTIVE03"
-if {$skipped1 < $skipped2} {
- pass "$test ($skipped1 skipped probes < $skipped2 skipped probes)"
+if {$skipped1 <= $skipped2} {
+ pass "$test ($skipped1 skipped probes <= $skipped2 skipped probes)"
} else {
fail "$test ($skipped1 skipped probes > $skipped2 skipped probes)"
}
diff --git a/testsuite/systemtap.base/probefunc.exp b/testsuite/systemtap.base/probefunc.exp
index 10190fc9..b9c02552 100644
--- a/testsuite/systemtap.base/probefunc.exp
+++ b/testsuite/systemtap.base/probefunc.exp
@@ -41,7 +41,7 @@ close $symfd
set prefix "probefunc:"
# test probefunc() with kernel.statement()
-set output_string "\\mscheduler_tick\\M"
+set output_string "\\mscheduler_tick\\M\r\n"
set probepoint "kernel.statement(0x$addr)"
set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -e $script
@@ -52,7 +52,7 @@ set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -e $script
# test probefunc() with kernel.inline()
-set output_string "\\mcontext_switch\\M"
+set output_string "\\mcontext_switch\\M\r\n"
set probepoint "kernel.inline(\"context_switch\")"
set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -e $script
diff --git a/testsuite/systemtap.samples/ioblocktest.exp b/testsuite/systemtap.samples/ioblocktest.exp
index 43c44f5e..e80ec757 100644
--- a/testsuite/systemtap.samples/ioblocktest.exp
+++ b/testsuite/systemtap.samples/ioblocktest.exp
@@ -8,5 +8,5 @@ proc sleep_ten_secs {} {
return 0;
}
-set output_string "\\mioblock*"
+set output_string "ioblock: \\S+\t\\d+\t\[RW]\t\[01]\r\n"
stap_run $srcdir/$subdir/$test.stp sleep_ten_secs $output_string
diff --git a/testsuite/systemtap.samples/ioblocktest.stp b/testsuite/systemtap.samples/ioblocktest.stp
index 1386903c..43b3e7d0 100644
--- a/testsuite/systemtap.samples/ioblocktest.stp
+++ b/testsuite/systemtap.samples/ioblocktest.stp
@@ -10,5 +10,5 @@ probe ioblock.end {
}
probe end {
log("systemtap ending probe")
- printf("%s\n", teststr)
+ printf("%s", teststr)
}
diff --git a/testsuite/systemtap.samples/tcptest.exp b/testsuite/systemtap.samples/tcptest.exp
index 0c40f93d..0ae088ef 100644
--- a/testsuite/systemtap.samples/tcptest.exp
+++ b/testsuite/systemtap.samples/tcptest.exp
@@ -7,5 +7,7 @@ proc tcp_gen { } {
exec $::tcp_tcl 1
return 0
}
-set output_string "\\mTCP totalbytes: \\d+\\M"
+set output_header "UID\tPID\tSIZE\tNAME\t\t\tPORT\tSOURCE\t\tRTO\tRCVMSS\tSSTHRES\tCWND\tSTATE\r\n"
+set output_rows "((\\d+\t\\d+\t\\d+\t\\S+\t\t\t\\d+\t\\S*\t\\d+\t\\d+\t\\d+\t\\d+\t\\d+)?\r\n){5}"
+set output_string "TCP totalbytes: \\d+\r\n$output_header$output_rows"
stap_run $srcdir/$subdir/$test.stp tcp_gen $output_string