summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/flightrec4.exp
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-09-16 16:08:38 -0400
committerMasami Hiramatsu <mhiramat@redhat.com>2009-09-16 16:08:38 -0400
commit0ec1af8d6f51d29ee6191a0160e934bef1dd94d3 (patch)
tree0b3853ab094671d4c39ac2922ed1c39ac8b0af2b /testsuite/systemtap.base/flightrec4.exp
parentc3a32b01d74946d8ae4d79534aeb194f1c66c72a (diff)
downloadsystemtap-steved-0ec1af8d6f51d29ee6191a0160e934bef1dd94d3.tar.gz
systemtap-steved-0ec1af8d6f51d29ee6191a0160e934bef1dd94d3.tar.xz
systemtap-steved-0ec1af8d6f51d29ee6191a0160e934bef1dd94d3.zip
Add signal based file switching testcase
* testsuite/systemtap.base/flightrec1.exp: Add signal file switching testcase. * testsuite/systemtap.base/flightrec4.exp: New test for signal file switching with file number limits. * testsuite/systemtap.base/flightrec5.exp: New test for signal file switching with file number limits on bulk mode.
Diffstat (limited to 'testsuite/systemtap.base/flightrec4.exp')
-rw-r--r--testsuite/systemtap.base/flightrec4.exp56
1 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/flightrec4.exp b/testsuite/systemtap.base/flightrec4.exp
new file mode 100644
index 00000000..3f17563d
--- /dev/null
+++ b/testsuite/systemtap.base/flightrec4.exp
@@ -0,0 +1,56 @@
+set test "flightrec4"
+if {![installtest_p]} { untested $test; return }
+
+# run stapio in background mode with number limit
+spawn stap -F -S 1,2 -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
+}
+
+# switch file to .1
+exec kill -USR2 $pid
+
+# check output file
+if {[catch {exec rm $test.out.0}]} {
+ fail "$test (no output file)"
+ return -1
+} else {
+ pass "$test (output file)"
+}
+
+# switch file to .2
+exec kill -USR2 $pid
+# switch file to .3 (this time, .1 file should be deleted)
+exec kill -USR2 $pid
+
+# check switched output file
+if {[catch {exec rm $test.out.1}]} {
+ pass "$test (old output file is removed)"
+} else {
+ fail "$test (failed to remove output file)"
+ return -1
+}
+
+exec kill -TERM $pid
+
+# check switched output file
+if {[catch {exec rm $test.out.2 $test.out.3}]} {
+ fail "$test (failed to switch output file)"
+ return -1
+} else {
+ pass "$test (switch output file)"
+}
+