View | Details | Raw Unified | Return to bug 3858 | Differences between
and this patch

Collapse All | Expand All

(-)src.MAIN/testsuite/systemtap.printf/hello.stp (+6 lines)
Line 0 Link Here
1
probe begin
2
{
3
	printf("Hello");
4
	printf("World");
5
	exit()
6
}
(-)src.MAIN/testsuite/systemtap.printf/hello2.stp (+7 lines)
Line 0 Link Here
1
probe begin
2
{
3
	print("Print");
4
	log("Systemtap");
5
	warn("warning");
6
	exit()
7
}
(-)src.MAIN/testsuite/systemtap.printf/sharedbuf.exp (+62 lines)
Line 0 Link Here
1
# Simple test that systemtap can share the buffer with other scripts.
2
set test "sharedbuf"
3
set TEST_NAME "$subdir/$test"
4
5
if {![installtest_p]} { untested $TEST_NAME; return }
6
7
set c1 0
8
set c2 0
9
10
# Load a host script
11
spawn stap $srcdir/$subdir/$test.stp -DRELAY_HOST=test1
12
13
expect {
14
	-timeout 120
15
	"Host: begin\r\n" {
16
		pass "shared buffer hosting"
17
		# Run a guest script which uses printf.
18
		if {[catch {exec stap $srcdir/$subdir/hello.stp -DRELAY_GUEST=test1} res]} {
19
			fail "shared buffer guest"
20
			print $res
21
		} else {
22
			incr c1
23
			exp_continue
24
		}
25
	}
26
	"HelloWorld" {
27
		if {$c1 == 1} {incr c1}
28
		# Run a guest script which uses print, log and warn.
29
		if {[catch {exec stap $srcdir/$subdir/hello2.stp -DRELAY_GUEST=test1} res]} {
30
			# check that the guest outputs a warning message.
31
			if {$res == "WARNING: warning"} {
32
				xfail "shared buffer guest2"
33
				incr c2
34
				exp_continue
35
			} else {
36
				fail "shared buffer guest2"
37
			}
38
		} else {
39
			kpass "shared buffer guest2"
40
			incr c2
41
			exp_continue
42
		}
43
	}
44
	"PrintSystemtap" {
45
		if {$c2 == 1} {incr c2}
46
		# Run a guest script which tries to use nonexist buffer.
47
		if {[catch {exec stap $srcdir/$subdir/hello.stp -DRELAY_GUEST=test2} res]} {
48
			xfail "nonexist buffer sharing"
49
		} else {
50
			fail "nonexist buffer sharing"
51
		}
52
	}
53
	eof {fail "shared buffer hosting. unexpected EOF" }
54
}
55
send "\003"
56
if {$c1 == 2 && $c2 == 2} {
57
	pass "buffer sharing"
58
} else {
59
	fail "buffer sharing ($c1, $c2)"
60
}
61
close
62
wait
(-)src.MAIN/testsuite/systemtap.printf/sharedbuf.stp (+3 lines)
Line 0 Link Here
1
probe begin {
2
	printf("Host: begin\n")
3
}

Return to bug 3858