summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorjistone <jistone>2007-08-17 01:54:28 +0000
committerjistone <jistone>2007-08-17 01:54:28 +0000
commit3cb170588c9b180fb4d28af04e44ac87481560a7 (patch)
tree8cf0c1f2f065c640052d6f8b90ee6f0300f12a85 /testsuite
parentbf49da0383481795d0a8d608beee27f6b1a251dc (diff)
downloadsystemtap-steved-3cb170588c9b180fb4d28af04e44ac87481560a7.tar.gz
systemtap-steved-3cb170588c9b180fb4d28af04e44ac87481560a7.tar.xz
systemtap-steved-3cb170588c9b180fb4d28af04e44ac87481560a7.zip
2007-08-16 Josh Stone <joshua.i.stone@intel.com>
PR 4591 * parse.cxx (parser::parse_symbol): Tweak 'print' matching to allow all the new variants with printd and println. * staptree.h (struct print_format): Add fields for the new print variants, and parse_print() to help matching. * staptree.cxx (print_format::parse_print): New static method to match the print variants and determine their properties. (print_format::print): Handle the new print types. (deep_copy_visitor::visit_print_format): Copy the new fields. * translate.cxx (c_unparser::visit_print_format): Insert delims and newlines where appropriate for new print functions. * stap1.in: Document the new print functions. testsuite/ * lib/stap_run.exp: Make sure to match the entire output, in case there are multiple pass/fail messages. * buildok/printf.stp: Add lines for new print variants. * parseko/printd01.stp: Make sure that bad printd calls are handled. * parseko/printd02.stp: Ditto. * parseko/printd03.stp: Ditto. * parseko/printd04.stp: Ditto. * systemtap.base/print.stp: Try a bunch of different print calls. * systemtap.base/print.exp: Driver for above.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog13
-rwxr-xr-xtestsuite/buildok/printf.stp20
-rw-r--r--testsuite/lib/stap_run.exp2
-rw-r--r--testsuite/parseko/printd01.stp6
-rw-r--r--testsuite/parseko/printd02.stp6
-rw-r--r--testsuite/parseko/printd03.stp6
-rw-r--r--testsuite/parseko/printd04.stp6
-rw-r--r--testsuite/systemtap.base/print.exp5
-rw-r--r--testsuite/systemtap.base/print.stp39
9 files changed, 97 insertions, 6 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 7e80f80b..030848e5 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2007-08-16 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 4591
+ * lib/stap_run.exp: Make sure to match the entire output, in case
+ there are multiple pass/fail messages.
+ * buildok/printf.stp: Add lines for new print variants.
+ * parseko/printd01.stp: Make sure that bad printd calls are handled.
+ * parseko/printd02.stp: Ditto.
+ * parseko/printd03.stp: Ditto.
+ * parseko/printd04.stp: Ditto.
+ * systemtap.base/print.stp: Try a bunch of different print calls.
+ * systemtap.base/print.exp: Driver for above.
+
2007-08-15 Martin Hunt <hunt@redhat.com>
* systemtap.printf/*b.exp: Use stap_merge.tcl.
diff --git a/testsuite/buildok/printf.stp b/testsuite/buildok/printf.stp
index badea63a..481892a2 100755
--- a/testsuite/buildok/printf.stp
+++ b/testsuite/buildok/printf.stp
@@ -26,9 +26,19 @@ probe begin
sprintf("%s before %s",
sprint(1), sprint(3)),
sprint("C"))
- printf("\"quote\\this\"\n")
- printf("%d is %03o in octal\n", 9, 9)
- printf("%d is %#X in hex\n", 255, 255)
- printf("print unsigned %u\n", 17)
- printf("-% d is % d\n", 9, -9)
+ printf("\"quote\\this\"\n")
+ printf("%d is %03o in octal\n", 9, 9)
+ printf("%d is %#X in hex\n", 255, 255)
+ printf("print unsigned %u\n", 17)
+ printf("-% d is % d\n", 9, -9)
+
+ print(1, "two", 3, "four")
+ print(sprint(1, "two", 3, "four"))
+ println(1, "two", 3, "four")
+ print(sprintln(1, "two", 3, "four"))
+
+ printd(", ", 1, "two", 3, "four")
+ print(sprintd(", ", 1, "two", 3, "four"))
+ printdln(", ", 1, "two", 3, "four")
+ print(sprintdln(", ", 1, "two", 3, "four"))
}
diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp
index 018d2bf3..14786218 100644
--- a/testsuite/lib/stap_run.exp
+++ b/testsuite/lib/stap_run.exp
@@ -86,4 +86,4 @@ proc no_load {} {
}
# tests better all be true
-set all_pass_string "(systemtap test success\r\n)+"
+set all_pass_string "(systemtap test success\r\n)+$"
diff --git a/testsuite/parseko/printd01.stp b/testsuite/parseko/printd01.stp
new file mode 100644
index 00000000..31eef777
--- /dev/null
+++ b/testsuite/parseko/printd01.stp
@@ -0,0 +1,6 @@
+#! stap -p1
+
+probe begin {
+ // missing the delimiter
+ printd(1, 2, 3, 4, 5)
+}
diff --git a/testsuite/parseko/printd02.stp b/testsuite/parseko/printd02.stp
new file mode 100644
index 00000000..afc7da99
--- /dev/null
+++ b/testsuite/parseko/printd02.stp
@@ -0,0 +1,6 @@
+#! stap -p1
+
+probe begin {
+ // missing the delimiter
+ printdln(1, 2, 3, 4, 5)
+}
diff --git a/testsuite/parseko/printd03.stp b/testsuite/parseko/printd03.stp
new file mode 100644
index 00000000..6c6e6a41
--- /dev/null
+++ b/testsuite/parseko/printd03.stp
@@ -0,0 +1,6 @@
+#! stap -p1
+
+probe begin {
+ // need more than one value to join
+ printd(", ", 1)
+}
diff --git a/testsuite/parseko/printd04.stp b/testsuite/parseko/printd04.stp
new file mode 100644
index 00000000..5d6aadcb
--- /dev/null
+++ b/testsuite/parseko/printd04.stp
@@ -0,0 +1,6 @@
+#! stap -p1
+
+probe begin {
+ // need more than one value to join
+ printdln(", ", 1)
+}
diff --git a/testsuite/systemtap.base/print.exp b/testsuite/systemtap.base/print.exp
new file mode 100644
index 00000000..9158a296
--- /dev/null
+++ b/testsuite/systemtap.base/print.exp
@@ -0,0 +1,5 @@
+# Test that all the print statements work
+
+set test "print"
+
+stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
diff --git a/testsuite/systemtap.base/print.stp b/testsuite/systemtap.base/print.stp
new file mode 100644
index 00000000..e1b64c35
--- /dev/null
+++ b/testsuite/systemtap.base/print.stp
@@ -0,0 +1,39 @@
+/*
+ * print.stp
+ *
+ * Test that all the print statements work
+ */
+
+global s1, s2, s3
+
+probe begin
+{
+ log("systemtap starting probe")
+ s1 = "systemtap"
+ s2 = "test"
+ s3 = "success"
+}
+
+probe end
+{
+ log("systemtap ending probe")
+
+ print(s1, " ", s2, " ", s3, "\n")
+ print(sprint(s1, " ", s2, " ", s3, "\n"))
+
+ println(s1, " ", s2, " ", s3)
+ print(sprintln(s1, " ", s2, " ", s3))
+
+ printd(" ", s1, s2, s3 . "\n")
+ print(sprintd(" ", s1, s2, s3 . "\n"))
+
+ printdln(" ", s1, s2, s3)
+ print(sprintdln(" ", s1, s2, s3))
+
+ // check that formatting characters get escaped correctly in the delimiter
+ s = sprintd("%% % \\ \"", 1, 2, 3)
+ if (s == "1%% % \\ \"2%% % \\ \"3")
+ log("systemtap test success")
+ else
+ log("systemtap test failure")
+}