summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.printf
diff options
context:
space:
mode:
authorbrolley <brolley>2008-02-27 16:41:38 +0000
committerbrolley <brolley>2008-02-27 16:41:38 +0000
commit33c514bdedd1d2753f7d29a8926223e30986c639 (patch)
treea205f75bf92cf97fb80c4df8e9eb982b55ae365e /testsuite/systemtap.printf
parentbcdfb17df458f7a660fd079afbc46dc9e65a36d9 (diff)
downloadsystemtap-steved-33c514bdedd1d2753f7d29a8926223e30986c639.tar.gz
systemtap-steved-33c514bdedd1d2753f7d29a8926223e30986c639.tar.xz
systemtap-steved-33c514bdedd1d2753f7d29a8926223e30986c639.zip
2008-02-27 Dave Brolley <brolley@redhat.com>
PR5189 * systemtap.printf/bin6.{exp,stp}: New test case. * systemtap.printf/memory1.{exp,stp}: New test case.
Diffstat (limited to 'testsuite/systemtap.printf')
-rw-r--r--testsuite/systemtap.printf/bin6.expbin0 -> 1225 bytes
-rw-r--r--testsuite/systemtap.printf/bin6.stp40
-rw-r--r--testsuite/systemtap.printf/memory1.exp18
-rw-r--r--testsuite/systemtap.printf/memory1.stp27
4 files changed, 85 insertions, 0 deletions
diff --git a/testsuite/systemtap.printf/bin6.exp b/testsuite/systemtap.printf/bin6.exp
new file mode 100644
index 00000000..0de41e78
--- /dev/null
+++ b/testsuite/systemtap.printf/bin6.exp
Binary files differ
diff --git a/testsuite/systemtap.printf/bin6.stp b/testsuite/systemtap.printf/bin6.stp
new file mode 100644
index 00000000..a281d5a3
--- /dev/null
+++ b/testsuite/systemtap.printf/bin6.stp
@@ -0,0 +1,40 @@
+# test of width and precision on binary prints
+
+probe begin {
+ one = 1;
+ two = 2;
+ four = 4;
+ eight = 8;
+ deadbeef = big_endian8 (0x6465616462656566);
+
+ printf ("Binary default width default precision\t:%b:\n", deadbeef);
+
+ printf ("Binary static width default precision\t:%1b:\n", deadbeef);
+ printf ("Binary static width default precision\t:%2b:\n", deadbeef);
+ printf ("Binary static width default precision\t:%4b:\n", deadbeef);
+ printf ("Binary static width default precision\t:%8b:\n", deadbeef);
+ printf ("Binary dynamic width default precision\t:%*b:\n", one, deadbeef);
+ printf ("Binary dynamic width default precision\t:%*b:\n", two, deadbeef);
+ printf ("Binary dynamic width default precision\t:%*b:\n", four, deadbeef);
+ printf ("Binary dynamic width default precision\t:%*b:\n", eight, deadbeef);
+
+ printf ("Binary default width static precision\t:%.8b:\n", deadbeef);
+ printf ("Binary default width static precision\t:%.4b:\n", deadbeef);
+ printf ("Binary default width static precision\t:%.2b:\n", deadbeef);
+ printf ("Binary default width static precision\t:%.1b:\n", deadbeef);
+ printf ("Binary default width dynamic precision\t:%.*b:\n", eight, deadbeef);
+ printf ("Binary default width dynamic precision\t:%.*b:\n", four, deadbeef);
+ printf ("Binary default width dynamic precision\t:%.*b:\n", two, deadbeef);
+ printf ("Binary default width dynamic precision\t:%.*b:\n", one, deadbeef);
+
+ printf ("Binary static width static precision\t:%1.8b:\n", deadbeef);
+ printf ("Binary static width static precision\t:%2.4b:\n", deadbeef);
+ printf ("Binary static width static precision\t:%4.2b:\n", deadbeef);
+ printf ("Binary static width static precision\t:%8.1b:\n", deadbeef);
+ printf ("Binary dynamic width dynamic precision\t:%*.*b:\n", one, eight, deadbeef);
+ printf ("Binary dynamic width dynamic precision\t:%*.*b:\n", two, four, deadbeef);
+ printf ("Binary dynamic width dynamic precision\t:%*.*b:\n", four, two, deadbeef);
+ printf ("Binary dynamic width dynamic precision\t:%*.*b:\n", eight, one, deadbeef);
+
+ exit ();
+}
diff --git a/testsuite/systemtap.printf/memory1.exp b/testsuite/systemtap.printf/memory1.exp
new file mode 100644
index 00000000..2389cdc5
--- /dev/null
+++ b/testsuite/systemtap.printf/memory1.exp
@@ -0,0 +1,18 @@
+set test "memory1"
+set ::result_string {Memory default width and precision :m:
+Memory static precision smaller than input :my st:
+Memory dynamic precision smaller than input :my st:
+Memory static precision equal to input :my string:
+Memory dynamic precision equal to input :my string:
+Memory static width default precision : m:
+Memory dynamic width default precision : m:
+Memory static width smaller than static precision :my string:
+Memory static width larger than static precision : my string:
+Memory dynamic width smaller than static precision :my string:
+Memory dynamic width larger than static precision : my string:
+Memory static width smaller than dynamic precision :my string:
+Memory static width larger than dynamic precision : my string:
+Memory dynamic width smaller than dynamic precision :my string:
+Memory dynamic width larger than dynamic precision : my string:
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/memory1.stp b/testsuite/systemtap.printf/memory1.stp
new file mode 100644
index 00000000..3b4d6d5e
--- /dev/null
+++ b/testsuite/systemtap.printf/memory1.stp
@@ -0,0 +1,27 @@
+probe begin {
+ five = 5;
+ nine = 9;
+ fifteen = 15;
+ s = "my string";
+
+ printf ("Memory default width and precision\t:%m:\n", s);
+
+ printf ("Memory static precision smaller than input\t:%.5m:\n", s);
+ printf ("Memory dynamic precision smaller than input\t:%.*m:\n", five, s);
+ printf ("Memory static precision equal to input\t:%.9m:\n", s);
+ printf ("Memory dynamic precision equal to input\t:%.*m:\n", nine, s);
+
+ printf ("Memory static width default precision\t:%5m:\n", s);
+ printf ("Memory dynamic width default precision\t:%*m:\n", five, s);
+
+ printf ("Memory static width smaller than static precision\t:%5.9m:\n", s);
+ printf ("Memory static width larger than static precision\t:%15.9m:\n", s);
+ printf ("Memory dynamic width smaller than static precision\t:%*.9m:\n", five, s);
+ printf ("Memory dynamic width larger than static precision\t:%*.9m:\n", fifteen, s);
+ printf ("Memory static width smaller than dynamic precision\t:%5.*m:\n", nine, s);
+ printf ("Memory static width larger than dynamic precision\t:%15.*m:\n", nine, s);
+ printf ("Memory dynamic width smaller than dynamic precision\t:%*.*m:\n", five, nine, s);
+ printf ("Memory dynamic width larger than dynamic precision\t:%*.*m:\n", fifteen, nine, s);
+
+ exit()
+}