blob: 7774a305727cba7e117af868b84467fdb9698ffd (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Simple test that systemtap can share the buffer with other scripts.
set test "sharedbuf"
set TEST_NAME "$subdir/$test"
if {![installtest_p]} { untested $TEST_NAME; return }
set c1 0
set c2 0
# Load a host script
spawn stap $srcdir/$subdir/$test.stp -DRELAY_HOST=test1
expect {
-timeout 120
"Host: begin\r\n" {
pass "shared buffer hosting"
# Run a guest script which uses printf.
if {[catch {exec stap $srcdir/$subdir/hello.stp -DRELAY_GUEST=test1} res]} {
fail "shared buffer guest"
print $res
} else {
incr c1
exp_continue
}
}
"HelloWorld" {
if {$c1 == 1} {incr c1}
# Run a guest script which uses print, log and warn.
if {[catch {exec stap $srcdir/$subdir/hello2.stp -DRELAY_GUEST=test1} res]} {
# check that the guest outputs a warning message.
if {$res == "WARNING: warning"} {
xfail "shared buffer guest2"
incr c2
exp_continue
} else {
fail "shared buffer guest2"
}
} else {
kpass "shared buffer guest2"
incr c2
exp_continue
}
}
"PrintSystemtap" {
if {$c2 == 1} {incr c2}
# Run a guest script which tries to use nonexist buffer.
if {[catch {exec stap $srcdir/$subdir/hello.stp -DRELAY_GUEST=test2} res]} {
xfail "nonexist buffer sharing"
} else {
fail "nonexist buffer sharing"
}
}
eof {fail "shared buffer hosting. unexpected EOF" }
}
exec kill -INT -[exp_pid]
if {$c1 == 2 && $c2 == 2} {
pass "buffer sharing"
} else {
fail "buffer sharing ($c1, $c2)"
}
closewait
|