diff options
author | William Cohen <wcohen@redhat.com> | 2009-02-10 16:18:29 -0500 |
---|---|---|
committer | William Cohen <wcohen@redhat.com> | 2009-02-10 16:18:29 -0500 |
commit | a70a69bd47f2b0c7e8e4e99b7a630ebbedc5f264 (patch) | |
tree | 5abda041a1bba2387eaf996665a0936322d4b004 /testsuite/systemtap.base/crash.exp | |
parent | 955925b709fcf1aeaa667423ed7b639dcfd94478 (diff) | |
download | systemtap-steved-a70a69bd47f2b0c7e8e4e99b7a630ebbedc5f264.tar.gz systemtap-steved-a70a69bd47f2b0c7e8e4e99b7a630ebbedc5f264.tar.xz systemtap-steved-a70a69bd47f2b0c7e8e4e99b7a630ebbedc5f264.zip |
Move crash.exp and crash.sh to systemtap.base directory.
Diffstat (limited to 'testsuite/systemtap.base/crash.exp')
-rw-r--r-- | testsuite/systemtap.base/crash.exp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/crash.exp b/testsuite/systemtap.base/crash.exp new file mode 100644 index 00000000..9c3e5e05 --- /dev/null +++ b/testsuite/systemtap.base/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 { exec kill -INT -[exp_pid]; 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 } + |