blob: 59c8dadd64d4f315450b9caff418ab79ccb3c308 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 -e {probe begin {print("HelloWorld\n")}} -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 }
|