]> sourceware.org Git - systemtap.git/commitdiff
PR10854 cont'd: Add a testcase for the reproducer
authorJosh Stone <jistone@redhat.com>
Tue, 27 Oct 2009 20:52:34 +0000 (13:52 -0700)
committerJosh Stone <jistone@redhat.com>
Tue, 27 Oct 2009 20:52:34 +0000 (13:52 -0700)
testsuite/systemtap.base/pr10854.exp [new file with mode: 0644]
testsuite/systemtap.base/pr10854.stp [new file with mode: 0644]

diff --git a/testsuite/systemtap.base/pr10854.exp b/testsuite/systemtap.base/pr10854.exp
new file mode 100644 (file)
index 0000000..11d2221
--- /dev/null
@@ -0,0 +1,31 @@
+# This test is to make sure that we've resolved PR10854's race between probe
+# initialization and shutdown.  Here we load a module and then kill the stapio
+# process as soon as we can to try to make the init and shutdown overlap.
+
+set test "pr10854"
+
+# precompile the script module
+set compile { exec stap $srcdir/$subdir/$test.stp sys_read *@fs/*.c -p4 }
+if { [catch { set module [eval $compile] } msg ] } {
+    fail "compiling $test.stp: $msg"
+    untested "$test runloop"
+    continue
+} else {
+    pass "compiling $test.stp"
+}
+
+if {![installtest_p]} {
+    untested "$test runloop"
+    continue
+}
+
+# run & kill the module 10 times
+# (this was usually enough to trigger the fault)
+for {set i 0} {$i < 10} {incr i} {
+    spawn staprun $module -o /dev/null
+    while { [catch { exec pkill stapio -P [pid] } msg ] } { }
+    wait
+}
+
+# if we're still alive, we pass :)
+pass "$test runloop"
diff --git a/testsuite/systemtap.base/pr10854.stp b/testsuite/systemtap.base/pr10854.stp
new file mode 100644 (file)
index 0000000..55f027f
--- /dev/null
@@ -0,0 +1,20 @@
+function trace(entry_p) {
+   if(tid() in trace)
+       printf("%s%s%s\n",thread_indent(entry_p),
+                        (entry_p>0?"->":"<-"),
+                        probefunc())
+}
+
+global trace
+probe kernel.function(@1).call {
+   if (execname() == "staprun") next # skip our own helper process
+   trace[tid()] = 1
+   trace(1)
+}
+probe kernel.function(@1).return {
+   trace(-1)
+   delete trace[tid()]
+}
+
+probe kernel.function(@2).call { trace(1) }
+probe kernel.function(@2).return { trace(-1) }
This page took 0.030394 seconds and 5 git commands to generate.