summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.printf
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.printf')
-rw-r--r--testsuite/systemtap.printf/basic1.exp4
-rw-r--r--testsuite/systemtap.printf/basic1.stp6
-rw-r--r--testsuite/systemtap.printf/basic2.exp4
-rw-r--r--testsuite/systemtap.printf/basic2.stp6
-rw-r--r--testsuite/systemtap.printf/basic3.exp6
-rw-r--r--testsuite/systemtap.printf/basic3.stp6
-rw-r--r--testsuite/systemtap.printf/basic4.exp4
-rw-r--r--testsuite/systemtap.printf/basic4.stp12
-rw-r--r--testsuite/systemtap.printf/basic5.exp4
-rw-r--r--testsuite/systemtap.printf/basic5.stp22
-rw-r--r--testsuite/systemtap.printf/bin.stp18
-rw-r--r--testsuite/systemtap.printf/bin1.exp4
-rw-r--r--testsuite/systemtap.printf/bin1.stp5
-rw-r--r--testsuite/systemtap.printf/bin2.exp7
-rw-r--r--testsuite/systemtap.printf/bin2.stp13
-rw-r--r--testsuite/systemtap.printf/bin3.exp11
-rw-r--r--testsuite/systemtap.printf/bin3.stp18
-rw-r--r--testsuite/systemtap.printf/bin3a.stp17
-rw-r--r--testsuite/systemtap.printf/bin4.exp14
-rw-r--r--testsuite/systemtap.printf/bin4.stp17
-rw-r--r--testsuite/systemtap.printf/bin4a.stp16
-rw-r--r--testsuite/systemtap.printf/bin5.exp20
-rw-r--r--testsuite/systemtap.printf/bin5.stp18
-rw-r--r--testsuite/systemtap.printf/bin5a.stp17
-rw-r--r--testsuite/systemtap.printf/int1.exp25
-rw-r--r--testsuite/systemtap.printf/int1.stp42
-rw-r--r--testsuite/systemtap.printf/oct.exp7
-rw-r--r--testsuite/systemtap.printf/oct.stp8
-rw-r--r--testsuite/systemtap.printf/ptr.exp67
-rw-r--r--testsuite/systemtap.printf/ptr.stp42
-rw-r--r--testsuite/systemtap.printf/string1.exp7
-rw-r--r--testsuite/systemtap.printf/string1.stp9
-rw-r--r--testsuite/systemtap.printf/string2.exp119
-rw-r--r--testsuite/systemtap.printf/string2.stp12
-rw-r--r--testsuite/systemtap.printf/text_str.exp58
-rw-r--r--testsuite/systemtap.printf/text_str.stp79
36 files changed, 744 insertions, 0 deletions
diff --git a/testsuite/systemtap.printf/basic1.exp b/testsuite/systemtap.printf/basic1.exp
new file mode 100644
index 00000000..c354a6dc
--- /dev/null
+++ b/testsuite/systemtap.printf/basic1.exp
@@ -0,0 +1,4 @@
+load_lib "stap_run2.exp"
+set test "basic1"
+set ::result_string {HelloWorld}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic1.stp b/testsuite/systemtap.printf/basic1.stp
new file mode 100644
index 00000000..3d2e35c6
--- /dev/null
+++ b/testsuite/systemtap.printf/basic1.stp
@@ -0,0 +1,6 @@
+probe begin
+{
+ printf("Hello");
+ printf("World");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/basic2.exp b/testsuite/systemtap.printf/basic2.exp
new file mode 100644
index 00000000..385cc5c5
--- /dev/null
+++ b/testsuite/systemtap.printf/basic2.exp
@@ -0,0 +1,4 @@
+load_lib "stap_run2.exp"
+set test "basic2"
+set ::result_string {HelloWorld}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic2.stp b/testsuite/systemtap.printf/basic2.stp
new file mode 100644
index 00000000..8c5891b4
--- /dev/null
+++ b/testsuite/systemtap.printf/basic2.stp
@@ -0,0 +1,6 @@
+probe begin
+{
+ printf("Hello");
+ print("World");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/basic3.exp b/testsuite/systemtap.printf/basic3.exp
new file mode 100644
index 00000000..2eb74431
--- /dev/null
+++ b/testsuite/systemtap.printf/basic3.exp
@@ -0,0 +1,6 @@
+load_lib "stap_run2.exp"
+set test "basic3"
+set ::result_string {Hello
+World
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic3.stp b/testsuite/systemtap.printf/basic3.stp
new file mode 100644
index 00000000..23f826d6
--- /dev/null
+++ b/testsuite/systemtap.printf/basic3.stp
@@ -0,0 +1,6 @@
+probe begin
+{
+ printf("Hello\n");
+ print("World\n");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/basic4.exp b/testsuite/systemtap.printf/basic4.exp
new file mode 100644
index 00000000..3b89a24d
--- /dev/null
+++ b/testsuite/systemtap.printf/basic4.exp
@@ -0,0 +1,4 @@
+load_lib "stap_run2.exp"
+set test "basic4"
+set ::result_string {HelloWorldHelloWorld}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic4.stp b/testsuite/systemtap.printf/basic4.stp
new file mode 100644
index 00000000..06caeebf
--- /dev/null
+++ b/testsuite/systemtap.printf/basic4.stp
@@ -0,0 +1,12 @@
+probe begin
+{
+ printf("Hello");
+ printf("World");
+ exit()
+}
+probe end
+{
+ printf("Hello");
+ printf("World");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/basic5.exp b/testsuite/systemtap.printf/basic5.exp
new file mode 100644
index 00000000..9fe0ad16
--- /dev/null
+++ b/testsuite/systemtap.printf/basic5.exp
@@ -0,0 +1,4 @@
+load_lib "stap_run2.exp"
+set test "basic5"
+set ::result_string {HelloWorldHelloWorld}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic5.stp b/testsuite/systemtap.printf/basic5.stp
new file mode 100644
index 00000000..8ddb089d
--- /dev/null
+++ b/testsuite/systemtap.printf/basic5.stp
@@ -0,0 +1,22 @@
+# This test is really a transport test.
+# Waiting one second makes sure the two probes
+# send the data in different packets, at least
+# with procfs.
+
+probe begin
+{
+ printf("Hello");
+ printf("World");
+}
+
+probe timer.ms(1000)
+{
+ exit()
+}
+
+probe end
+{
+ printf("Hello");
+ printf("World");
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin.stp b/testsuite/systemtap.printf/bin.stp
new file mode 100644
index 00000000..ac86059d
--- /dev/null
+++ b/testsuite/systemtap.printf/bin.stp
@@ -0,0 +1,18 @@
+# test of 16-bit binary prints
+# need to use big_endian2() to get consistent results across
+# different-endian architectures.
+
+probe begin
+{
+ set_endian(2)
+ printf("%2b", 0x12)
+ printf("%2b", 0x34)
+ printf("%2b%2b", 0xabcd, 0x5678)
+ a = 0x12345678
+ b = 0xabcd
+ c = 0x8888
+ d = 0xcdef
+ printf("%2b%2b%2b%2b", a, b, c, d)
+ printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin1.exp b/testsuite/systemtap.printf/bin1.exp
new file mode 100644
index 00000000..e25a6e9c
--- /dev/null
+++ b/testsuite/systemtap.printf/bin1.exp
@@ -0,0 +1,4 @@
+load_lib "stap_run_binary.exp"
+set test "bin1"
+set ::result_string {42 }
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/bin1.stp b/testsuite/systemtap.printf/bin1.stp
new file mode 100644
index 00000000..2177d8b3
--- /dev/null
+++ b/testsuite/systemtap.printf/bin1.stp
@@ -0,0 +1,5 @@
+probe begin
+{
+ printf("%1b", 0x42)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin2.exp b/testsuite/systemtap.printf/bin2.exp
new file mode 100644
index 00000000..bab11e39
--- /dev/null
+++ b/testsuite/systemtap.printf/bin2.exp
@@ -0,0 +1,7 @@
+load_lib "stap_run_binary.exp"
+set test "bin2"
+set ::result_string {12 34 56 78 12 34 56 78
+61 3d 12 20 62 3d 34 20
+63 3d 56 20 64 3d 78 }
+
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/bin2.stp b/testsuite/systemtap.printf/bin2.stp
new file mode 100644
index 00000000..b7d221b5
--- /dev/null
+++ b/testsuite/systemtap.printf/bin2.stp
@@ -0,0 +1,13 @@
+probe begin
+{
+ printf("%1b", 0x12)
+ printf("%1b", 0x34)
+ printf("%1b%1b", 0x56, 0x78)
+ a = 0x12
+ b = 0x34
+ c = 0x56
+ d = 0x78
+ printf("%1b%1b%1b%1b", a, b, c, d)
+ printf("a=%1b b=%1b c=%1b d=%1b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin3.exp b/testsuite/systemtap.printf/bin3.exp
new file mode 100644
index 00000000..e3ffaed5
--- /dev/null
+++ b/testsuite/systemtap.printf/bin3.exp
@@ -0,0 +1,11 @@
+load_lib "stap_run_binary.exp"
+set ::result_string {00 12 00 34 ab cd 56 78
+56 78 ab cd 88 88 cd ef
+61 3d 56 78 20 62 3d ab
+cd 20 63 3d 88 88 20 64
+3d cd ef }
+
+set test "bin3"
+stap_run_binary $srcdir/$subdir/$test.stp
+set test "bin3a"
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/bin3.stp b/testsuite/systemtap.printf/bin3.stp
new file mode 100644
index 00000000..ac86059d
--- /dev/null
+++ b/testsuite/systemtap.printf/bin3.stp
@@ -0,0 +1,18 @@
+# test of 16-bit binary prints
+# need to use big_endian2() to get consistent results across
+# different-endian architectures.
+
+probe begin
+{
+ set_endian(2)
+ printf("%2b", 0x12)
+ printf("%2b", 0x34)
+ printf("%2b%2b", 0xabcd, 0x5678)
+ a = 0x12345678
+ b = 0xabcd
+ c = 0x8888
+ d = 0xcdef
+ printf("%2b%2b%2b%2b", a, b, c, d)
+ printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin3a.stp b/testsuite/systemtap.printf/bin3a.stp
new file mode 100644
index 00000000..c0a30448
--- /dev/null
+++ b/testsuite/systemtap.printf/bin3a.stp
@@ -0,0 +1,17 @@
+# test of 16-bit binary prints
+# need to use big_endian2() to get consistent results across
+# different-endian architectures.
+
+probe begin
+{
+ printf("%2b", big_endian2(0x12))
+ printf("%2b", big_endian2(0x34))
+ printf("%2b%2b", big_endian2(0xabcd), big_endian2(0x5678))
+ a = big_endian2(0x12345678)
+ b = big_endian2(0xabcd)
+ c = big_endian2(0x8888)
+ d = big_endian2(0xcdef)
+ printf("%2b%2b%2b%2b", a, b, c, d)
+ printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin4.exp b/testsuite/systemtap.printf/bin4.exp
new file mode 100644
index 00000000..5da24366
--- /dev/null
+++ b/testsuite/systemtap.printf/bin4.exp
@@ -0,0 +1,14 @@
+load_lib "stap_run_binary.exp"
+set ::result_string {00 00 00 12 00 00 00 34
+ab cd ef 00 00 00 56 78
+12 34 56 78 11 11 22 22
+88 88 99 99 cd ef 00 00
+61 3d 12 34 56 78 20 62
+3d 11 11 22 22 20 63 3d
+88 88 99 99 20 64 3d cd
+ef 00 00 }
+
+set test "bin4"
+stap_run_binary $srcdir/$subdir/$test.stp
+set test "bin4a"
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/bin4.stp b/testsuite/systemtap.printf/bin4.stp
new file mode 100644
index 00000000..638a38e6
--- /dev/null
+++ b/testsuite/systemtap.printf/bin4.stp
@@ -0,0 +1,17 @@
+# test of 32-bit binary prints
+# Also tests big_endian4()
+
+probe begin
+{
+ set_endian(2)
+ printf("%4b", 0x12)
+ printf("%4b", 0x34)
+ printf("%4b%4b", 0xabcdef00, 0x5678)
+ a = 0x12345678
+ b = 0x11112222
+ c = 0x88889999
+ d = 0xcdef0000
+ printf("%4b%4b%4b%4b", a, b, c, d)
+ printf("a=%4b b=%4b c=%4b d=%4b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin4a.stp b/testsuite/systemtap.printf/bin4a.stp
new file mode 100644
index 00000000..40bbec7f
--- /dev/null
+++ b/testsuite/systemtap.printf/bin4a.stp
@@ -0,0 +1,16 @@
+# test of 32-bit binary prints
+# Also tests big_endian4()
+
+probe begin
+{
+ printf("%4b", big_endian4(0x12))
+ printf("%4b", big_endian4(0x34))
+ printf("%4b%4b", big_endian4(0xabcdef00), big_endian4(0x5678))
+ a = big_endian4(0x12345678)
+ b = big_endian4(0x11112222)
+ c = big_endian4(0x88889999)
+ d = big_endian4(0xcdef0000)
+ printf("%4b%4b%4b%4b", a, b, c, d)
+ printf("a=%4b b=%4b c=%4b d=%4b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin5.exp b/testsuite/systemtap.printf/bin5.exp
new file mode 100644
index 00000000..11564bd5
--- /dev/null
+++ b/testsuite/systemtap.printf/bin5.exp
@@ -0,0 +1,20 @@
+load_lib "stap_run_binary.exp"
+set ::result_string {00 00 00 00 00 00 00 12
+00 00 00 00 00 00 00 34
+ab cd 00 00 11 11 22 22
+56 78 56 78 56 78 56 78
+00 12 34 56 78 ab cd ef
+11 11 22 22 33 33 44 44
+88 88 99 99 aa aa bb bb
+cd ef 00 00 11 11 22 22
+61 3d 00 12 34 56 78 ab
+cd ef 20 62 3d 11 11 22
+22 33 33 44 44 20 63 3d
+88 88 99 99 aa aa bb bb
+20 64 3d cd ef 00 00 11
+11 22 22 }
+
+set test "bin5"
+stap_run_binary $srcdir/$subdir/$test.stp
+set test "bin5a"
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/bin5.stp b/testsuite/systemtap.printf/bin5.stp
new file mode 100644
index 00000000..3a88de60
--- /dev/null
+++ b/testsuite/systemtap.printf/bin5.stp
@@ -0,0 +1,18 @@
+# test of 64-bit binary prints
+# need to use big_endian8() to get consistent results across
+# different-endian architectures.
+
+probe begin
+{
+ set_endian(2)
+ printf("%8b", 0x12)
+ printf("%8b", 0x34)
+ printf("%8b%8b", 0xabcd000011112222, 0x5678567856785678)
+ a = 0x0012345678abcdef
+ b = 0x1111222233334444
+ c = 0x88889999aaaabbbb
+ d = 0xcdef000011112222
+ printf("%8b%8b%8b%8b", a, b, c, d)
+ printf("a=%8b b=%8b c=%8b d=%8b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/bin5a.stp b/testsuite/systemtap.printf/bin5a.stp
new file mode 100644
index 00000000..ebee2e01
--- /dev/null
+++ b/testsuite/systemtap.printf/bin5a.stp
@@ -0,0 +1,17 @@
+# test of 64-bit binary prints
+# need to use big_endian8() to get consistent results across
+# different-endian architectures.
+
+probe begin
+{
+ printf("%8b", big_endian8(0x12))
+ printf("%8b", big_endian8(0x34))
+ printf("%8b%8b", big_endian8(0xabcd000011112222), big_endian8(0x5678567856785678))
+ a = big_endian8(0x0012345678abcdef)
+ b = big_endian8(0x1111222233334444)
+ c = big_endian8(0x88889999aaaabbbb)
+ d = big_endian8(0xcdef000011112222)
+ printf("%8b%8b%8b%8b", a, b, c, d)
+ printf("a=%8b b=%8b c=%8b d=%8b",a,b,c,d)
+ exit()
+}
diff --git a/testsuite/systemtap.printf/int1.exp b/testsuite/systemtap.printf/int1.exp
new file mode 100644
index 00000000..56fb8e62
--- /dev/null
+++ b/testsuite/systemtap.printf/int1.exp
@@ -0,0 +1,25 @@
+load_lib "stap_run2.exp"
+set test "int1"
+set ::result_string {1,10,9000000000000,-1,-1024
+ 1,10,9000000000000,-1,-1024
+ 1, 10, 9000000000000, -1, -1024
+0000000000000001,0000000000000010,0009000000000000,-000000000000001,-000000000001024
+
+1,10,9000000000000,18446744073709551615,18446744073709550592
+ 1,10,9000000000000,18446744073709551615,18446744073709550592
+ 1, 10, 9000000000000,18446744073709551615,18446744073709550592
+0000000000000001,0000000000000010,0009000000000000,18446744073709551615,18446744073709550592
+
+1,a,82f79cd9000,ffffffffffffffff,fffffffffffffc00
+ 1, a,82f79cd9000,ffffffffffffffff,fffffffffffffc00
+ 1, a, 82f79cd9000,ffffffffffffffff,fffffffffffffc00
+0000000000000001,000000000000000a,0000082f79cd9000,ffffffffffffffff,fffffffffffffc00
+ 1, A, 82F79CD9000,FFFFFFFFFFFFFFFF,FFFFFFFFFFFFFC00
+0000000000000001,000000000000000A,0000082F79CD9000,FFFFFFFFFFFFFFFF,FFFFFFFFFFFFFC00
+
+1,12,202757163310000,1777777777777777777777,1777777777777777776000
+ 1,12,202757163310000,1777777777777777777777,1777777777777777776000
+ 1, 12, 202757163310000,1777777777777777777777,1777777777777777776000
+0000000000000001,0000000000000012,0202757163310000,1777777777777777777777,1777777777777777776000
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/int1.stp b/testsuite/systemtap.printf/int1.stp
new file mode 100644
index 00000000..0acd4304
--- /dev/null
+++ b/testsuite/systemtap.printf/int1.stp
@@ -0,0 +1,42 @@
+probe begin
+{
+ i = 1
+ j = 10
+ k = 9000000000000
+ m = -1
+ n = -1024
+
+ # signed decimal
+ printf("%d,%d,%d,%d,%d\n",i,j,k,m,n)
+ printf("%2d,%2d,%2d,%2d,%2d\n",i,j,k,m,n)
+ printf("%16d,%16d,%16d,%16d,%16d\n",i,j,k,m,n)
+ printf("%016d,%016d,%016d,%016d,%016d\n",i,j,k,m,n)
+
+ printf("\n")
+
+ # unsigned decimal
+ printf("%u,%u,%u,%u,%u\n",i,j,k,m,n)
+ printf("%2u,%2u,%2u,%2u,%2u\n",i,j,k,m,n)
+ printf("%16u,%16u,%16u,%16u,%16u\n",i,j,k,m,n)
+ printf("%016u,%016u,%016u,%016u,%016u\n",i,j,k,m,n)
+
+ printf("\n")
+
+ # hex
+ printf("%x,%x,%x,%x,%x\n",i,j,k,m,n)
+ printf("%2x,%2x,%2x,%2x,%2x\n",i,j,k,m,n)
+ printf("%16x,%16x,%16x,%16x,%16x\n",i,j,k,m,n)
+ printf("%016x,%016x,%016x,%016x,%016x\n",i,j,k,m,n)
+ printf("%16X,%16X,%16X,%16X,%16X\n",i,j,k,m,n)
+ printf("%016X,%016X,%016X,%016X,%016X\n",i,j,k,m,n)
+
+ printf("\n")
+
+ # octal
+ printf("%o,%o,%o,%o,%o\n",i,j,k,m,n)
+ printf("%2o,%2o,%2o,%2o,%2o\n",i,j,k,m,n)
+ printf("%16o,%16o,%16o,%16o,%16o\n",i,j,k,m,n)
+ printf("%016o,%016o,%016o,%016o,%016o\n",i,j,k,m,n)
+
+ exit()
+}
diff --git a/testsuite/systemtap.printf/oct.exp b/testsuite/systemtap.printf/oct.exp
new file mode 100644
index 00000000..c676ff0e
--- /dev/null
+++ b/testsuite/systemtap.printf/oct.exp
@@ -0,0 +1,7 @@
+load_lib "stap_run_binary.exp"
+set test "oct"
+set ::result_string {10 01 02 03 04 05 06 07
+08 09 0a 0b 0c 0d 0e 0f
+10 11 12 13 14 15 16 17
+18 19 1a 1b 1c 1d 1e 1f}
+stap_run_binary $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/oct.stp b/testsuite/systemtap.printf/oct.stp
new file mode 100644
index 00000000..255ccfe5
--- /dev/null
+++ b/testsuite/systemtap.printf/oct.stp
@@ -0,0 +1,8 @@
+probe begin
+{
+ printf("\020\01\02\03\04\05\06\07")
+ printf("\010\011\012\013\014\015\016\017")
+ printf("\020\021\022\023\024\025\026\027")
+ printf("\030\031\032\033\034\035\036\037")
+ exit()
+}
diff --git a/testsuite/systemtap.printf/ptr.exp b/testsuite/systemtap.printf/ptr.exp
new file mode 100644
index 00000000..0ad0083e
--- /dev/null
+++ b/testsuite/systemtap.printf/ptr.exp
@@ -0,0 +1,67 @@
+load_lib "stap_run2.exp"
+set test "ptr"
+
+if {$::tcl_platform(wordSize) == 8} {
+ set ::result_string "0x0000000000000000
+0x0000000000000001
+0x0000000012345678
+0x12345678abcdef00
+0x0000000012345678
+
+ 0x0000000000000000X
+ 0x0000000000000001X
+ 0x0000000012345678X
+ 0x12345678abcdef00X
+ 0x0000000012345678X
+
+0x000000000000000000X
+0x000000000000000001X
+0x000000000012345678X
+0x0012345678abcdef00X
+0x000000000012345678X
+
+0x000000
+0x000001
+0x12345678
+0x12345678abcdef00
+0x12345678
+
+0x000000X
+0x000001X
+0x12345678X
+0x12345678abcdef00X
+0x12345678X
+"
+} else {
+ set ::result_string "0x00000000
+0x00000001
+0x12345678
+0xabcdef00
+0x12345678
+
+ 0x00000000X
+ 0x00000001X
+ 0x12345678X
+ 0xabcdef00X
+ 0x12345678X
+
+0x000000000000000000X
+0x000000000000000001X
+0x000000000012345678X
+0x0000000000abcdef00X
+0x000000000012345678X
+
+0x000000
+0x000001
+0x12345678
+0xabcdef00
+0x12345678
+
+0x000000X
+0x000001X
+0x12345678X
+0xabcdef00X
+0x12345678X
+"
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/ptr.stp b/testsuite/systemtap.printf/ptr.stp
new file mode 100644
index 00000000..397ff922
--- /dev/null
+++ b/testsuite/systemtap.printf/ptr.stp
@@ -0,0 +1,42 @@
+probe begin
+{
+ printf("%p\n",0)
+ printf("%p\n",1)
+ printf("%p\n",0x12345678)
+ printf("%p\n",0x12345678abcdef00)
+ printf("%p\n",0x0000000012345678)
+
+ printf("\n")
+
+ printf("%20pX\n",0)
+ printf("%20pX\n",1)
+ printf("%20pX\n",0x12345678)
+ printf("%20pX\n",0x12345678abcdef00)
+ printf("%20pX\n",0x0000000012345678)
+
+ printf("\n")
+
+ printf("%-20pX\n",0)
+ printf("%-20pX\n",1)
+ printf("%-20pX\n",0x12345678)
+ printf("%-20pX\n",0x12345678abcdef00)
+ printf("%-20pX\n",0x0000000012345678)
+
+ printf("\n")
+
+ printf("%8p\n",0)
+ printf("%8p\n",1)
+ printf("%8p\n",0x12345678)
+ printf("%8p\n",0x12345678abcdef00)
+ printf("%8p\n",0x0000000012345678)
+
+ printf("\n")
+
+ printf("%-8pX\n",0)
+ printf("%-8pX\n",1)
+ printf("%-8pX\n",0x12345678)
+ printf("%-8pX\n",0x12345678abcdef00)
+ printf("%-8pX\n",0x0000000012345678)
+
+ exit()
+}
diff --git a/testsuite/systemtap.printf/string1.exp b/testsuite/systemtap.printf/string1.exp
new file mode 100644
index 00000000..7b47336b
--- /dev/null
+++ b/testsuite/systemtap.printf/string1.exp
@@ -0,0 +1,7 @@
+load_lib "stap_run2.exp"
+set test "string1"
+set ::result_string {The string is <Foobar!>
+Foobar!XYZZY
+XYZZYFoobar!XYZZYFoobar!
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/string1.stp b/testsuite/systemtap.printf/string1.stp
new file mode 100644
index 00000000..69671620
--- /dev/null
+++ b/testsuite/systemtap.printf/string1.stp
@@ -0,0 +1,9 @@
+probe begin
+{
+ s = "Foobar!"
+ printf("The string is <%s>\n", s);
+ t = "XYZZY"
+ printf("%s%s\n",s,t);
+ printf("%s%s%s%s\n",t,s,t,s);
+ exit()
+}
diff --git a/testsuite/systemtap.printf/string2.exp b/testsuite/systemtap.printf/string2.exp
new file mode 100644
index 00000000..a64bfa38
--- /dev/null
+++ b/testsuite/systemtap.printf/string2.exp
@@ -0,0 +1,119 @@
+set test "string2"
+set ::result_string {s is <12345678901234567890123456789012345678901234567890>
+t is <1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890>
+ 0: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 1: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 2: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 3: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 4: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 5: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 6: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 7: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 8: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 9: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+10: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+11: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+12: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+13: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+14: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+15: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+16: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+17: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+18: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+19: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+20: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+21: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+22: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+23: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+24: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+25: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+26: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+27: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+28: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+29: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+30: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+31: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+32: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+33: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+34: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+35: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+36: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+37: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+38: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+39: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+40: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+41: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+42: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+43: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+44: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+45: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+46: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+47: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+48: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+49: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+50: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+51: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+52: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+53: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+54: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+55: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+56: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+57: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+58: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+59: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+60: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+61: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+62: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+63: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+64: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+65: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+66: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+67: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+68: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+69: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+70: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+71: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+72: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+73: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+74: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+75: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+76: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+77: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+78: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+79: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+80: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+81: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+82: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+83: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+84: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+85: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+86: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+87: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+88: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+89: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+90: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+91: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+92: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+93: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+94: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+95: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+96: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+97: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+98: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+99: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890}
+
+set TEST_NAME "$srcdir/$subdir/$test.stp"
+
+if {![installtest_p]} { untested $TEST_NAME; return }
+
+set res [exec stap $TEST_NAME]
+
+if {[string compare $res $::result_string] == 0} {
+ pass "$TEST_NAME passed"
+} else {
+ fail "$TEST_NAME failed"
+ puts "EXPECTED:\n-----------------------\n<$::result_string>"
+ puts "-----------------------\n"
+ puts "GOT:\n-----------------------\n<$res>"
+ puts "-----------------------\n"
+}
diff --git a/testsuite/systemtap.printf/string2.stp b/testsuite/systemtap.printf/string2.stp
new file mode 100644
index 00000000..4d8e354b
--- /dev/null
+++ b/testsuite/systemtap.printf/string2.stp
@@ -0,0 +1,12 @@
+probe begin
+{
+ # 50 chars
+ s = "12345678901234567890123456789012345678901234567890"
+ # 100 chars
+ t = s.s
+ printf("s is <%s>\n", s);
+ printf("t is <%s>\n", t);
+ for (i = 0; i < 100; i++)
+ printf("%2d: %s\n", i, t);
+ exit()
+}
diff --git a/testsuite/systemtap.printf/text_str.exp b/testsuite/systemtap.printf/text_str.exp
new file mode 100644
index 00000000..2871b2ea
--- /dev/null
+++ b/testsuite/systemtap.printf/text_str.exp
@@ -0,0 +1,58 @@
+load_lib "stap_run2.exp"
+set test "text_str"
+set ::result_string {a=1234567890
+b=12345678901234567890
+c=123456789012345678901234567890
+----- Using text_str -----
+a=1234567890
+b=12345678901234567890
+c=123456789012345678901234567890
+----- Using text_strn -----
+a=1234567890
+b=12345678901234567890
+c=123456789012345678901234567890
+----- Using text_strn len = 10 -----
+a=1234567890
+b=1234567890
+c=1234567890
+----- Using text_strn quoted -----
+a="1234567890"
+b="12345678901234567890"
+c="123456789012345678901234567890"
+----- Using text_strn len=10, quoted -----
+a="12345"...
+b="12345"...
+c="12345"...
+----- Using text_strn len=12, quoted -----
+a="1234567890"
+b="1234567"...
+c="1234567"...
+----- Using text_str -----
+a=\n\nXYZZY\31
+b=?\31\a\n\n\r\n
+c=\n\nXYZZY\31?\31\a\n\n\r\n
+----- Using text_strn -----
+a=\n\nXYZZY\31
+b=?\31\a\n\n\r\n
+c=\n\nXYZZY\31?\31\a\n\n\r\n
+----- Using text_strn len = 10 -----
+a=\n\nXYZZY
+b=?\31\a\n\n
+c=\n\nXYZZY
+----- Using text_strn len = 12 -----
+a=\n\nXYZZY\31
+b=?\31\a\n\n\r
+c=\n\nXYZZY\31
+----- Using text_strn quoted -----
+a="\n\nXYZZY\31"
+b="?\31\a\n\n\r\n"
+c="\n\nXYZZY\31?\31\a\n\n\r\n"
+----- Using text_strn len=10, quoted -----
+a="\n\nX"...
+b="?\31\"...
+c="\n\nX"...
+----- Using text_strn len=14, quoted -----
+a="\n\nXYZZY\31"
+b="?\31\a\n\"...
+c="\n\nXYZZY"...}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/text_str.stp b/testsuite/systemtap.printf/text_str.stp
new file mode 100644
index 00000000..05acc431
--- /dev/null
+++ b/testsuite/systemtap.printf/text_str.stp
@@ -0,0 +1,79 @@
+probe begin {
+ a = "1234567890"
+ b = a.a
+ c = a.b
+ printf("a=%s\n", a)
+ printf("b=%s\n", b)
+ printf("c=%s\n", c)
+
+ printf("----- Using text_str -----\n");
+ printf("a=%s\n", text_str(a))
+ printf("b=%s\n", text_str(b))
+ printf("c=%s\n", text_str(c))
+
+ printf("----- Using text_strn -----\n");
+ printf("a=%s\n", text_strn(a,0,0))
+ printf("b=%s\n", text_strn(b,0,0))
+ printf("c=%s\n", text_strn(c,0,0))
+
+ printf("----- Using text_strn len = 10 -----\n");
+ printf("a=%s\n", text_strn(a,10,0))
+ printf("b=%s\n", text_strn(b,10,0))
+ printf("c=%s\n", text_strn(c,10,0))
+
+ printf("----- Using text_strn quoted -----\n");
+ printf("a=%s\n", text_strn(a,0,1))
+ printf("b=%s\n", text_strn(b,0,1))
+ printf("c=%s\n", text_strn(c,0,1))
+
+ printf("----- Using text_strn len=10, quoted -----\n");
+ printf("a=%s\n", text_strn(a,10,1))
+ printf("b=%s\n", text_strn(b,10,1))
+ printf("c=%s\n", text_strn(c,10,1))
+
+ printf("----- Using text_strn len=12, quoted -----\n");
+ printf("a=%s\n", text_strn(a,12,1))
+ printf("b=%s\n", text_strn(b,12,1))
+ printf("c=%s\n", text_strn(c,12,1))
+
+ a = "\n\nXYZZY\031"
+ b = "\077\031\a\n\n\r\n"
+ c = a.b
+
+ printf("----- Using text_str -----\n");
+ printf("a=%s\n", text_str(a))
+ printf("b=%s\n", text_str(b))
+ printf("c=%s\n", text_str(c))
+
+ printf("----- Using text_strn -----\n");
+ printf("a=%s\n", text_strn(a,0,0))
+ printf("b=%s\n", text_strn(b,0,0))
+ printf("c=%s\n", text_strn(c,0,0))
+
+ printf("----- Using text_strn len = 10 -----\n");
+ printf("a=%s\n", text_strn(a,10,0))
+ printf("b=%s\n", text_strn(b,10,0))
+ printf("c=%s\n", text_strn(c,10,0))
+
+ printf("----- Using text_strn len = 12 -----\n");
+ printf("a=%s\n", text_strn(a,12,0))
+ printf("b=%s\n", text_strn(b,12,0))
+ printf("c=%s\n", text_strn(c,12 ,0))
+
+ printf("----- Using text_strn quoted -----\n");
+ printf("a=%s\n", text_strn(a,0,1))
+ printf("b=%s\n", text_strn(b,0,1))
+ printf("c=%s\n", text_strn(c,0,1))
+
+ printf("----- Using text_strn len=10, quoted -----\n");
+ printf("a=%s\n", text_strn(a,10,1))
+ printf("b=%s\n", text_strn(b,10,1))
+ printf("c=%s\n", text_strn(c,10,1))
+
+ printf("----- Using text_strn len=14, quoted -----\n");
+ printf("a=%s\n", text_strn(a,14,1))
+ printf("b=%s\n", text_strn(b,14,1))
+ printf("c=%s\n", text_strn(c,14,1))
+
+ exit()
+}