summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.printf/memory1.stp
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-03-28 12:34:05 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-03-28 12:34:05 -0400
commit5e5189b38b0b1b788d32190361961d18e4456ae6 (patch)
treed388205113589bf73857efc6ef997bc8c39e112b /testsuite/systemtap.printf/memory1.stp
parentbf6c85c35a749ca8cc6bea20a7774d063c218938 (diff)
parent1e00cfb1b6caa8b8ac343fac8e3d08f2d6a5d785 (diff)
downloadsystemtap-steved-5e5189b38b0b1b788d32190361961d18e4456ae6.tar.gz
systemtap-steved-5e5189b38b0b1b788d32190361961d18e4456ae6.tar.xz
systemtap-steved-5e5189b38b0b1b788d32190361961d18e4456ae6.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
* 'master' of git://sources.redhat.com/git/systemtap: (24 commits) 2008-03-27 Frank Ch. Eigler <fche@elastic.org> 2008-03-27 Frank Ch. Eigler <fche@elastic.org> 2008-03-26 Frank Ch. Eigler <fche@elastic.org> Revert "dummy commit" dummy commit * clarify utility of epilogue-type probe aliases in documentation 2008-03-23 Frank Ch. Eigler <fche@elastic.org> 2008-03-23 Frank Ch. Eigler <fche@elastic.org> 2008-03-21 Eugene Teo <eugeneteo@kernel.sg> spelling fixes 2008-03-20 Frank Ch. Eigler <fche@elastic.org> * clarify $variables available in .return probes 2008-03-20 Frank Ch. Eigler <fche@elastic.org> 2008-03-17 Eugene Teo <eteo@redhat.com> * systemtap.base/maxactive.exp, probefunc.exp: Standardize pass msg. 2008-03-14 Masami Hiramatsu <mhiramat@redhat.com> 2008-03-13 Frank Ch. Eigler <fche@elastic.org> * release prep: 0.6.2 version bump 2008-03-12 Dave Brolley <brolley@redhat.com> 2008-03-11 Will Cohen <wcohen@redhat.com> ...
Diffstat (limited to 'testsuite/systemtap.printf/memory1.stp')
-rw-r--r--testsuite/systemtap.printf/memory1.stp146
1 files changed, 120 insertions, 26 deletions
diff --git a/testsuite/systemtap.printf/memory1.stp b/testsuite/systemtap.printf/memory1.stp
index 3b4d6d5e..f9cbf60b 100644
--- a/testsuite/systemtap.printf/memory1.stp
+++ b/testsuite/systemtap.printf/memory1.stp
@@ -1,27 +1,121 @@
-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()
+probe syscall.open {
+ actualLength = strlen (filename);
+
+ if (actualLength > 5 && actualLength < 15 && filename != "<unknown>") {
+ four = 4;
+ five = 5;
+ fifteen = 15;
+ success = 1;
+
+ expected_1_1 = sprintf ("%.1s", filename);
+ testName = "%m default width and precision";
+ result = sprintf ("%m", $filename);
+ if (result != expected_1_1) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_5_5 = sprintf ("%.5s", filename);
+ testName = "%m static precision smaller than input";
+ result = sprintf ("%.5m", $filename);
+ if (result != expected_5_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic precision smaller than input";
+ result = sprintf ("%.*m", five, $filename);
+ if (result != expected_5_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic precision equal to input";
+ expected_actual_actual = filename;
+ result = sprintf ("%.*m", actualLength, $filename);
+ if (result != expected_actual_actual) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_5_1 = sprintf (" %.1s", filename);
+ testName = "%m static width default precision";
+ result = sprintf ("%5m", $filename);
+ if (result != expected_5_1) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic width default precision";
+ result = sprintf ("%*m", five, $filename);
+ if (result != expected_5_1) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_4_5 = expected_5_5;
+ testName = "%m static width smaller than static precision";
+ result = sprintf ("%4.5m", $filename);
+ if (result != expected_4_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_15_5 = sprintf (" %.5s", filename);
+ testName = "%m static width larger than static precision";
+ result = sprintf ("%15.5m", $filename);
+ if (result != expected_15_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic width smaller than static precision";
+ result = sprintf ("%*.5m", four, $filename);
+ if (result != expected_4_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic width larger than static precision";
+ result = sprintf ("%*.5m", fifteen, $filename);
+ if (result != expected_15_5) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_4_actual = expected_actual_actual;
+ testName = "%m static width smaller than dynamic precision";
+ result = sprintf ("%4.*m", actualLength, $filename);
+ if (result != expected_4_actual) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ expected_15_actual = sprintf ("%15s", filename);
+ testName = "%m static width larger than dynamic precision";
+ result = sprintf ("%15.*m", actualLength, $filename);
+ if (result != expected_15_actual) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic width smaller than dynamic precision";
+ result = sprintf ("%*.*m", four, actualLength, $filename);
+ if (result != expected_4_actual) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ testName = "%m dynamic width larger than dynamic precision";
+ result = sprintf ("%*.*m", fifteen, actualLength, $filename);
+ if (result != expected_15_actual) {
+ printf ("Test %s failed\n", testName);
+ success = 0;
+ }
+
+ if (success)
+ print ("Test passed\n");
+
+ exit();
+ }
}