summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-04-20 12:56:51 +0200
committerTim Moore <timoore@redhat.com>2009-04-20 19:01:06 +0200
commit764b562f42c6ac7f02e0911cab47f87c827bf3bd (patch)
tree45cb4a80e108aeef69cfaeb1c4a34c030d63380a /testsuite
parent9a6d143c6e2c79cee1082d0455da92cfa78b03c7 (diff)
downloadsystemtap-steved-764b562f42c6ac7f02e0911cab47f87c827bf3bd.tar.gz
systemtap-steved-764b562f42c6ac7f02e0911cab47f87c827bf3bd.tar.xz
systemtap-steved-764b562f42c6ac7f02e0911cab47f87c827bf3bd.zip
fix a bug with %% in format strings
* translate.cxx (c_unparser::visit_print_format): Always use _stp_printf if a format string contains "%%". Previously a format string with no arguments would always be printed with _stp_print. * testsuite/systemtap.printf/basic6.stp: New test for %% in format strings. * testsuite/systemtap.printf/basic6.exp: test driver * testsuite/systemtap.examples/grapher.stp: Remove workaround for "%%" literal problem.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/systemtap.examples/general/grapher.stp10
-rw-r--r--testsuite/systemtap.printf/basic6.exp3
-rw-r--r--testsuite/systemtap.printf/basic6.stp5
3 files changed, 13 insertions, 5 deletions
diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp
index 04463979..4f326ec1 100644
--- a/testsuite/systemtap.examples/general/grapher.stp
+++ b/testsuite/systemtap.examples/general/grapher.stp
@@ -2,11 +2,11 @@
probe begin
{
-printf ("%s\n", "%Title:CPU utilization");
-printf ("%s\n", "%XAxisTitle:Time");
-printf ("%s\n", "%YAxisTitle:Percent");
-printf ("%s\n", "%DataSet:cpu 100 00ff00 bar");
-printf ("%s\n", "%DataSet:kbd 100 ff0000 dot");
+printf ("%%Title:CPU utilization\n");
+printf ("%%XAxisTitle:Time");
+printf ("%%YAxisTitle:Percent");
+printf ("%%DataSet:cpu 100 00ff00 bar");
+printf ("%%DataSet:kbd 100 ff0000 dot");
}
# CPU utilization
diff --git a/testsuite/systemtap.printf/basic6.exp b/testsuite/systemtap.printf/basic6.exp
new file mode 100644
index 00000000..72bf8f57
--- /dev/null
+++ b/testsuite/systemtap.printf/basic6.exp
@@ -0,0 +1,3 @@
+set test "basic6"
+set ::result_string {Hello%World}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic6.stp b/testsuite/systemtap.printf/basic6.stp
new file mode 100644
index 00000000..69721188
--- /dev/null
+++ b/testsuite/systemtap.printf/basic6.stp
@@ -0,0 +1,5 @@
+probe begin
+{
+ printf("Hello%%World");
+ exit()
+}