summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples/crash.exp
diff options
context:
space:
mode:
authorfche <fche>2008-01-25 04:47:11 +0000
committerfche <fche>2008-01-25 04:47:11 +0000
commit674427d3a018d0f89c9669db8dcf952aab8b4423 (patch)
tree29e3f9c4405e1fd1f81b8c87ac2e485855541a66 /testsuite/systemtap.samples/crash.exp
parent7ae8037e595d8da298c83cdc059db6ac5b68d8dc (diff)
downloadsystemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.tar.gz
systemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.tar.xz
systemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.zip
staplog crash(8) module tests
2008-01-24 Frank Ch. Eigler <fche@elastic.org> * Makefile.am: Make another $(MKDIR) call visible. * Makefile.in: Regenerated. 2008-01-24 Frank Ch. Eigler <fche@elastic.org> crash(8) tests, based on Masami Hiramatsu <mhiramat@redhat.com>: * Makefile.am (CRASH_LIBDIR): Pass in $(RUNTEST). * lib/systemtap.exp (as_root): Trace command string, output, and result. * sysetmtap.samples/crash.*, testlog.stp: New test case. * Makefile.in: Regenerated.
Diffstat (limited to 'testsuite/systemtap.samples/crash.exp')
-rw-r--r--testsuite/systemtap.samples/crash.exp45
1 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/crash.exp b/testsuite/systemtap.samples/crash.exp
new file mode 100644
index 00000000..629cff54
--- /dev/null
+++ b/testsuite/systemtap.samples/crash.exp
@@ -0,0 +1,45 @@
+# Simple test for staplog.so crash(8) extension
+set test "crash"
+
+if {![installtest_p]} { untested $test; return }
+if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return }
+
+# Load a test script
+spawn stap $srcdir/$subdir/testlog.stp -m testlog
+expect {
+ -timeout 120
+ "HelloWorld\r\n" {
+ pass "$test - testlog.stp"
+ # Need to run crash(8) while this script is still running.
+ # Since crash(8) needs /dev/mem access, need it run as_root too.
+ # This [ eval ... \{ \} ] business is necessary because as_root
+ # evals the given list/variables in its own scope.
+ eval as_root \{ $srcdir/$subdir/crash.sh $env(CRASH_LIBDIR) \}
+ }
+ timeout { fail "$test - testlog.stp timeout" }
+ timeout { fail "$test - testlog.stp eof" }
+}
+catch { send "\003"; close ; wait }
+
+# The crash(8) script creates testlog/global or testlog/cpu<n>
+as_root { chmod -R a+rX testlog }
+
+set ok 0
+foreach f [glob -nocomplain testlog/*] {
+ pass "$test - crash(8) generated $f"
+ set fp [open $f]
+ set chars [read $fp]
+ close $fp
+ if [string match "HelloWorld*" $chars] {
+ incr ok
+ pass "$test - crash(8) data"
+ } else {
+ fail "$test - crash(8) data $chars"
+ }
+}
+if {$ok == 0} {
+ fail "$test - crash(8) data"
+}
+
+as_root { rm -rf testlog testlog.ko }
+