summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorhiramatu <hiramatu>2007-11-09 18:12:06 +0000
committerhiramatu <hiramatu>2007-11-09 18:12:06 +0000
commit185457afd0b9b00f835e2bedcd6801aae432b699 (patch)
tree667dc956901aa44b59cd87adc4ad688a71b3cdfb /testsuite
parentbba416fe7a5eb25ed7c517d076185ce4cfaf6fbd (diff)
downloadsystemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.tar.gz
systemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.tar.xz
systemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.zip
2007-11-09 Masami Hiramatsu <mhiramat@redhat.com>
PR3858 * print.c: Add -DRELAY_HOST=<hostname> and -DRELAY_GUEST=<hostname> options support. (_stp_print_flush): Disable irqs if -DRELAY_* option is specified. * print_old.c: Export stp_print_flush to other modules if the -DRELAY_HOST option is specified. * print_new.c: Ditto. * transport.c (_stp_transport_init): Reduce relay buffer size to 64KB*2 if -DRELAY_GUEST is specified. * systemtap.printf/sharedbuf.exp: New test for buffer sharing option. * systemtap.printf/sharedbuf.stp: Ditto. * systemtap.printf/hello.stp: Ditto. * systemtap.printf/hello2.stp: Ditto.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog8
-rw-r--r--testsuite/systemtap.printf/hello.stp6
-rw-r--r--testsuite/systemtap.printf/hello2.stp7
-rw-r--r--testsuite/systemtap.printf/sharedbuf.exp62
-rw-r--r--testsuite/systemtap.printf/sharedbuf.stp3
5 files changed, 86 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 3d71c5a4..58f0cc13 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2007-11-09 Masami Hiramatsu <mhiramat@redhat.com>
+
+ PR3858
+ * systemtap.printf/sharedbuf.exp: New test for buffer sharing option.
+ * systemtap.printf/sharedbuf.stp: Ditto.
+ * systemtap.printf/hello.stp: Ditto.
+ * systemtap.printf/hello2.stp: Ditto.
+
2007-10-25 Martin Hunt <hunt@redhat.com>
* systemtap.printf/printd.exp: New.
diff --git a/testsuite/systemtap.printf/hello.stp b/testsuite/systemtap.printf/hello.stp
new file mode 100644
index 00000000..c0613225
--- /dev/null
+++ b/testsuite/systemtap.printf/hello.stp
@@ -0,0 +1,6 @@
+probe begin
+{
+ printf("Hello");
+ printf("World");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/hello2.stp b/testsuite/systemtap.printf/hello2.stp
new file mode 100644
index 00000000..aa0798fa
--- /dev/null
+++ b/testsuite/systemtap.printf/hello2.stp
@@ -0,0 +1,7 @@
+probe begin
+{
+ print("Print");
+ log("Systemtap");
+ warn("warning");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/sharedbuf.exp b/testsuite/systemtap.printf/sharedbuf.exp
new file mode 100644
index 00000000..6a182716
--- /dev/null
+++ b/testsuite/systemtap.printf/sharedbuf.exp
@@ -0,0 +1,62 @@
+# 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" }
+}
+send "\003"
+if {$c1 == 2 && $c2 == 2} {
+ pass "buffer sharing"
+} else {
+ fail "buffer sharing ($c1, $c2)"
+}
+close
+wait
diff --git a/testsuite/systemtap.printf/sharedbuf.stp b/testsuite/systemtap.printf/sharedbuf.stp
new file mode 100644
index 00000000..270e6bd1
--- /dev/null
+++ b/testsuite/systemtap.printf/sharedbuf.stp
@@ -0,0 +1,3 @@
+probe begin {
+ printf("Host: begin\n")
+}