summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.maps
diff options
context:
space:
mode:
authorfche <fche>2006-08-12 05:13:09 +0000
committerfche <fche>2006-08-12 05:13:09 +0000
commit814bc89d4635f101b2c0077598f31aad95ed15b7 (patch)
tree407a49dbaf446af4751f5068607a7fb8dad0611d /testsuite/systemtap.maps
parent6b6d04673a1ef175821afc7d4fabdb496698e8e3 (diff)
downloadsystemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.gz
systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.xz
systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.zip
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* configure.ac, Makefile.am: Descend into testsuite/ directory. Remove local test logic. * configure, Makefile.in: Regenerated. * runtest.sh: Not yet removed. * HACKING: Update for new testsuite layout. 2006-08-12 Frank Ch. Eigler <fche@elastic.org> * all: Reorganized old pass-1..4 tests one dejagnu bucket. Moved over old pass-5 tests, except for disabled syscalls tests. * Makefile (installcheck): New target for running pass-1..5 tests against installed systemtap.
Diffstat (limited to 'testsuite/systemtap.maps')
-rw-r--r--testsuite/systemtap.maps/absentstats.exp21
-rw-r--r--testsuite/systemtap.maps/absentstats.stp21
-rw-r--r--testsuite/systemtap.maps/foreach_fail.exp17
-rwxr-xr-xtestsuite/systemtap.maps/foreach_fail.stp19
-rw-r--r--testsuite/systemtap.maps/foreach_foreach.exp114
-rwxr-xr-xtestsuite/systemtap.maps/foreach_foreach.stp40
-rw-r--r--testsuite/systemtap.maps/ii.exp65
-rwxr-xr-xtestsuite/systemtap.maps/ii.stp58
-rw-r--r--testsuite/systemtap.maps/iiiiii.exp72
-rwxr-xr-xtestsuite/systemtap.maps/iiiiii.stp23
-rw-r--r--testsuite/systemtap.maps/is.exp71
-rwxr-xr-xtestsuite/systemtap.maps/is.stp59
-rw-r--r--testsuite/systemtap.maps/ix.exp51
-rwxr-xr-xtestsuite/systemtap.maps/ix.stp37
-rw-r--r--testsuite/systemtap.maps/ix_clear.exp24
-rwxr-xr-xtestsuite/systemtap.maps/ix_clear.stp12
-rw-r--r--testsuite/systemtap.maps/ix_clear2.exp25
-rwxr-xr-xtestsuite/systemtap.maps/ix_clear2.stp12
-rw-r--r--testsuite/systemtap.maps/ix_clear3.exp23
-rwxr-xr-xtestsuite/systemtap.maps/ix_clear3.stp10
-rw-r--r--testsuite/systemtap.maps/ix_hist.exp68
-rwxr-xr-xtestsuite/systemtap.maps/ix_hist.stp15
-rw-r--r--testsuite/systemtap.maps/pmap_agg_overflow.exp27
-rwxr-xr-xtestsuite/systemtap.maps/pmap_agg_overflow.stp38
-rw-r--r--testsuite/systemtap.maps/si.exp65
-rwxr-xr-xtestsuite/systemtap.maps/si.stp62
-rw-r--r--testsuite/systemtap.maps/ss.exp69
-rwxr-xr-xtestsuite/systemtap.maps/ss.stp62
28 files changed, 1180 insertions, 0 deletions
diff --git a/testsuite/systemtap.maps/absentstats.exp b/testsuite/systemtap.maps/absentstats.exp
new file mode 100644
index 00000000..99de9b0f
--- /dev/null
+++ b/testsuite/systemtap.maps/absentstats.exp
@@ -0,0 +1,21 @@
+# PR 2142+2610
+
+set test "absentstats"
+
+if {![installtest_p]} { untested $test; return }
+
+set ok 0
+set ko 0
+
+spawn stap -DMAXERRORS=20 $srcdir/$subdir/$test.stp
+# spawn echo hello children 0
+expect {
+ -re {^ERROR: empty aggregate[^\r]*\r} { incr ko ; exp_continue }
+ -re {^WARNING: Number of errors} { incr ko ; exp_continue }
+ -re {^0\r} { incr ok ; exp_continue }
+ -re {\n} { exp_continue }
+ eof { }
+}
+wait
+
+if {$ok == 2 && $ko == 13} then { pass $test } else { fail "$test ($ok $ko)" }
diff --git a/testsuite/systemtap.maps/absentstats.stp b/testsuite/systemtap.maps/absentstats.stp
new file mode 100644
index 00000000..641af5d3
--- /dev/null
+++ b/testsuite/systemtap.maps/absentstats.stp
@@ -0,0 +1,21 @@
+# stap -DMAXERRORS=40
+
+global sc
+probe begin { log(sprint(@count(sc))) }
+probe begin { print(@sum(sc)) }
+probe begin { print(@max(sc)) }
+probe begin { print(@min(sc)) }
+probe begin { print(@avg(sc)) }
+probe begin { print(@hist_log(sc)) }
+probe begin { x=@hist_log(sc)[5]; print(x) }
+
+global ry
+probe begin { log(sprint(@count(ry[4]))) }
+probe begin { print(@sum(ry[4])) }
+probe begin { print(@max(ry[4])) }
+probe begin { print(@min(ry[4])) }
+probe begin { print(@avg(ry[4])) }
+probe begin { print(@hist_log(ry[4])) }
+probe begin { x=@hist_log(ry[4])[5]; print(x) }
+
+probe begin { exit() }
diff --git a/testsuite/systemtap.maps/foreach_fail.exp b/testsuite/systemtap.maps/foreach_fail.exp
new file mode 100644
index 00000000..6d5439b7
--- /dev/null
+++ b/testsuite/systemtap.maps/foreach_fail.exp
@@ -0,0 +1,17 @@
+# Simple function to test maps of ints containing ints
+
+# modifying maps while in a foreach should produce a compilation error.
+
+set test foreach_fail
+if {![installtest_p]} { untested $test; return }
+
+spawn stap $srcdir/$subdir/$test.stp
+expect {
+ timeout {
+ fail "$test timed out" }
+ eof {
+ fail "$test unexpected EOF" }
+ -re "semantic error:" { pass "$test correctly failed to compile" }
+}
+close
+wait
diff --git a/testsuite/systemtap.maps/foreach_fail.stp b/testsuite/systemtap.maps/foreach_fail.stp
new file mode 100755
index 00000000..a371c0c8
--- /dev/null
+++ b/testsuite/systemtap.maps/foreach_fail.stp
@@ -0,0 +1,19 @@
+# modifying maps while in a foreach should produce a compilation error.
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[i] = i*i
+
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ foreach (i in foo)
+ foo[i]++
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/foreach_foreach.exp b/testsuite/systemtap.maps/foreach_foreach.exp
new file mode 100644
index 00000000..a84937e3
--- /dev/null
+++ b/testsuite/systemtap.maps/foreach_foreach.exp
@@ -0,0 +1,114 @@
+# Simple test of nested foreaches
+
+load_lib "stap_run2.exp"
+
+set test "foreach_foreach"
+
+set ::result_string {foo[1] = 1
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[5] = 25
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+foo[10] = 100
+
+bar[1] = 1
+bar[2] = 8
+bar[3] = 27
+bar[4] = 64
+bar[5] = 125
+bar[6] = 216
+bar[7] = 343
+bar[8] = 512
+bar[9] = 729
+bar[10] = 1000
+
+foo[1] = 1
+bar[1] = 1
+foo[2] = 4
+bar[2] = 8
+foo[3] = 9
+bar[3] = 27
+foo[4] = 16
+bar[4] = 64
+foo[5] = 25
+bar[5] = 125
+foo[6] = 36
+bar[6] = 216
+foo[7] = 49
+bar[7] = 343
+foo[8] = 64
+bar[8] = 512
+foo[9] = 81
+bar[9] = 729
+foo[10] = 100
+bar[10] = 1000
+
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[1] = 1
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[2] = 4
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[3] = 9
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[4] = 16
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[5] = 25
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[6] = 36
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[7] = 49
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[8] = 64
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[9] = 81
+bar[20] = 8000
+bar[21] = 9261
+bar[22] = 10648
+bar[23] = 12167
+bar[24] = 13824
+foo[10] = 100
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/foreach_foreach.stp b/testsuite/systemtap.maps/foreach_foreach.stp
new file mode 100755
index 00000000..09a230f5
--- /dev/null
+++ b/testsuite/systemtap.maps/foreach_foreach.stp
@@ -0,0 +1,40 @@
+# nested foreach
+
+global foo, bar
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[i] = i*i
+
+ for (i=0;i<11;i++)
+ bar[i] = i*i*i
+
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ printf("\n")
+
+ foreach (i in bar)
+ printf("bar[%d] = %d\n", i, bar[i])
+
+ printf("\n")
+
+ foreach (i in foo) {
+ printf("foo[%d] = %d\n", i, foo[i])
+ printf("bar[%d] = %d\n", i, bar[i])
+ }
+
+ printf("\n")
+
+ delete bar
+ for (i=20;i<25;i++)
+ bar[i] = i*i*i
+
+ foreach (i in foo) {
+ foreach (j in bar)
+ printf("bar[%d] = %d\n", j, bar[j])
+ printf("foo[%d] = %d\n", i, foo[i])
+ }
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/ii.exp b/testsuite/systemtap.maps/ii.exp
new file mode 100644
index 00000000..915e9c30
--- /dev/null
+++ b/testsuite/systemtap.maps/ii.exp
@@ -0,0 +1,65 @@
+# Simple function to test maps of ints containing ints
+
+load_lib "stap_run2.exp"
+
+set test "ii"
+set ::result_string {foo[1] = 1
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[5] = 25
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+foo[10] = 100
+
+foo[1] = 1
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+foo[10] = 100
+
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+
+foo[2] = 4
+foo[3] = 900
+foo[4] = -16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = -81
+
+foo[2] = 4
+foo[3] = 900
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = -81
+
+
+foo[1] = 1
+foo[2] = 5
+foo[3] = 14
+foo[4] = 30
+foo[5] = 55
+foo[6] = 91
+foo[7] = 140
+foo[8] = 204
+foo[9] = 285
+foo[10] = 385
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/ii.stp b/testsuite/systemtap.maps/ii.stp
new file mode 100755
index 00000000..a83ae8ce
--- /dev/null
+++ b/testsuite/systemtap.maps/ii.stp
@@ -0,0 +1,58 @@
+#test of int maps containing ints
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[i] = i*i
+
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # delete out of the middle
+ foo[5] = 0
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # delete first entry
+ foo[1] = 0
+ # and last entry
+ foo[10] = 0
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # change a couple
+ foo[9] = -81
+ foo[4] = -foo[4]
+ foo[3] *= 100
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # delete one
+ foo[4] = 0
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # delete all
+ for (i=0;i<11;i++)
+ foo[i] = 0
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ # load it again
+ for (i=0;i<11;i++)
+ foo[i] = i*i
+ for (i=0;i<11;i++)
+ foo[i] += foo[i-1]
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %d\n", i, foo[i])
+
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/iiiiii.exp b/testsuite/systemtap.maps/iiiiii.exp
new file mode 100644
index 00000000..69fdfd3d
--- /dev/null
+++ b/testsuite/systemtap.maps/iiiiii.exp
@@ -0,0 +1,72 @@
+# Simple test of maps with 5 ints as keys, returning ints
+
+load_lib "stap_run2.exp"
+
+set test "iiiiii"
+set ::result_string {foo[0,0,0,0,1] = 1
+foo[0,0,0,1,0] = 1
+foo[0,0,0,1,1] = 2
+foo[0,0,1,0,0] = 1
+foo[0,0,1,0,1] = 2
+foo[0,0,1,1,0] = 2
+foo[0,0,1,1,1] = 3
+foo[0,1,0,0,0] = 1
+foo[0,1,0,0,1] = 2
+foo[0,1,0,1,0] = 2
+foo[0,1,0,1,1] = 3
+foo[0,1,1,0,0] = 2
+foo[0,1,1,0,1] = 3
+foo[0,1,1,1,0] = 3
+foo[0,1,1,1,1] = 4
+foo[1,0,0,0,0] = 1
+foo[1,0,0,0,1] = 2
+foo[1,0,0,1,0] = 2
+foo[1,0,0,1,1] = 3
+foo[1,0,1,0,0] = 2
+foo[1,0,1,0,1] = 3
+foo[1,0,1,1,0] = 3
+foo[1,0,1,1,1] = 4
+foo[1,1,0,0,0] = 2
+foo[1,1,0,0,1] = 3
+foo[1,1,0,1,0] = 3
+foo[1,1,0,1,1] = 4
+foo[1,1,1,0,0] = 3
+foo[1,1,1,0,1] = 4
+foo[1,1,1,1,0] = 4
+foo[1,1,1,1,1] = 5
+
+foo[0,0,0,0,1] = 1
+foo[0,0,0,1,0] = 1
+foo[0,0,0,1,1] = 2
+foo[0,0,1,0,0] = 1
+foo[0,0,1,0,1] = 2
+foo[0,0,1,1,0] = 2
+foo[0,1,0,0,0] = 1
+foo[0,1,0,0,1] = 2
+foo[0,1,0,1,0] = 2
+foo[0,1,0,1,1] = 3
+foo[0,1,1,0,0] = 2
+foo[0,1,1,0,1] = 3
+foo[0,1,1,1,0] = 3
+foo[0,1,1,1,1] = 4
+foo[1,0,0,0,0] = 1
+foo[1,0,0,0,1] = 2
+foo[1,0,0,1,0] = 2
+foo[1,0,0,1,1] = 3
+foo[1,0,1,0,0] = 2
+foo[1,0,1,0,1] = 3
+foo[1,0,1,1,0] = 3
+foo[1,0,1,1,1] = 4
+foo[1,1,0,0,0] = 2
+foo[1,1,0,0,1] = 3
+foo[1,1,0,1,0] = 3
+foo[1,1,0,1,1] = 4
+foo[1,1,1,0,0] = 3
+foo[1,1,1,0,1] = 4
+foo[1,1,1,1,0] = 4
+foo[1,1,1,1,1] = 5
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/iiiiii.stp b/testsuite/systemtap.maps/iiiiii.stp
new file mode 100755
index 00000000..369c2fec
--- /dev/null
+++ b/testsuite/systemtap.maps/iiiiii.stp
@@ -0,0 +1,23 @@
+#simple test of maps with 5 ints as keys, returning ints
+
+global foo
+
+probe begin {
+ for (i=0;i<2;i++)
+ for (j=0;j<2;j++)
+ for (k=0;k<2;k++)
+ for (m=0;m<2;m++)
+ for (n=0;n<2;n++)
+ foo[i,j,k,m,n] = i+j+k+m+n
+
+ foreach ([a,b,c,d,e] in foo)
+ printf("foo[%d,%d,%d,%d,%d] = %d\n", a,b,c,d,e, foo[a,b,c,d,e])
+
+ foo[0,0,1,1,1] = 0
+ printf("\n")
+ foreach ([a,b,c,d,e] in foo)
+ printf("foo[%d,%d,%d,%d,%d] = %d\n", a,b,c,d,e, foo[a,b,c,d,e])
+
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/is.exp b/testsuite/systemtap.maps/is.exp
new file mode 100644
index 00000000..b94ad860
--- /dev/null
+++ b/testsuite/systemtap.maps/is.exp
@@ -0,0 +1,71 @@
+# Simple function to test maps of ints containing strings
+
+load_lib "stap_run2.exp"
+
+set test "is"
+set ::result_string {foo[0] = The Result is 0
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[5] = The Result is 25
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+foo[10] = The Result is 100
+
+foo[0] = The Result is 0
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+foo[10] = The Result is 100
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 4<------
+foo[4] = The Result is 16(CHANGED)
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = New result is -81
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 4<------
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = New result is -81
+
+
+foo[0] = # 0
+foo[1] = # 1
+foo[2] = # 4
+foo[3] = # 9
+foo[4] = # 16
+foo[5] = # 25
+foo[6] = # 36
+foo[7] = # 49
+foo[8] = # 64
+foo[9] = # 81
+foo[10] = # 100
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/is.stp b/testsuite/systemtap.maps/is.stp
new file mode 100755
index 00000000..993f375e
--- /dev/null
+++ b/testsuite/systemtap.maps/is.stp
@@ -0,0 +1,59 @@
+#test of int maps containing strings
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[i] = "The Result is ".sprint(i*i)
+
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # delete out of the middle
+ foo[5] = ""
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # delete first entry
+ foo[0] = ""
+ # and last entry
+ foo[10] = ""
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # change a couple
+ foo[9] = "New result is -81"
+ foo[4] = foo[4]."(CHANGED)"
+ foo[3] = foo[2]."<------"
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # delete one
+ foo[4] = ""
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # delete all
+ delete foo
+
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ # load it again
+ for (i=0;i<11;i++)
+ foo[i] = sprint(i*i)
+ for (i=0;i<11;i++)
+ foo[i] = "# ".sprint(i*i)
+
+ printf("\n")
+ foreach (i in foo)
+ printf("foo[%d] = %s\n", i, foo[i])
+
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ix.exp b/testsuite/systemtap.maps/ix.exp
new file mode 100644
index 00000000..4f587db6
--- /dev/null
+++ b/testsuite/systemtap.maps/ix.exp
@@ -0,0 +1,51 @@
+# Simple function to test maps of ints containing stats
+
+load_lib "stap_run2.exp"
+
+set test "ix"
+
+set ::result_string {foo[0]: count:3 sum:98 avg:32 min:-2 max:100
+foo[1]: count:3 sum:99 avg:33 min:-2 max:100
+foo[2]: count:3 sum:100 avg:33 min:-2 max:100
+foo[3]: count:3 sum:101 avg:33 min:-2 max:100
+foo[4]: count:3 sum:102 avg:34 min:-2 max:100
+foo[5]: count:3 sum:103 avg:34 min:-2 max:100
+foo[6]: count:3 sum:104 avg:34 min:-2 max:100
+foo[7]: count:3 sum:105 avg:35 min:-2 max:100
+foo[8]: count:3 sum:106 avg:35 min:-2 max:100
+foo[9]: count:3 sum:107 avg:35 min:-2 max:100
+foo[10]: count:3 sum:108 avg:36 min:-2 max:100
+
+Now reverse order...
+foo[10]: count:3 sum:108 avg:36 min:-2 max:100
+foo[9]: count:3 sum:107 avg:35 min:-2 max:100
+foo[8]: count:3 sum:106 avg:35 min:-2 max:100
+foo[7]: count:3 sum:105 avg:35 min:-2 max:100
+foo[6]: count:3 sum:104 avg:34 min:-2 max:100
+foo[5]: count:3 sum:103 avg:34 min:-2 max:100
+foo[4]: count:3 sum:102 avg:34 min:-2 max:100
+foo[3]: count:3 sum:101 avg:33 min:-2 max:100
+foo[2]: count:3 sum:100 avg:33 min:-2 max:100
+foo[1]: count:3 sum:99 avg:33 min:-2 max:100
+foo[0]: count:3 sum:98 avg:32 min:-2 max:100
+
+Now adding 10 to each...
+foo[0]: count:4 sum:108 avg:27 min:-2 max:100
+foo[1]: count:4 sum:109 avg:27 min:-2 max:100
+foo[2]: count:4 sum:110 avg:27 min:-2 max:100
+foo[3]: count:4 sum:111 avg:27 min:-2 max:100
+foo[4]: count:4 sum:112 avg:28 min:-2 max:100
+foo[5]: count:4 sum:113 avg:28 min:-2 max:100
+foo[6]: count:4 sum:114 avg:28 min:-2 max:100
+foo[7]: count:4 sum:115 avg:28 min:-2 max:100
+foo[8]: count:4 sum:116 avg:29 min:-2 max:100
+foo[9]: count:4 sum:117 avg:29 min:-2 max:100
+foo[10]: count:4 sum:118 avg:29 min:-2 max:100
+
+Run a quick foreach without sorting...
+complete sum of foo:1243
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/ix.stp b/testsuite/systemtap.maps/ix.stp
new file mode 100755
index 00000000..328fa066
--- /dev/null
+++ b/testsuite/systemtap.maps/ix.stp
@@ -0,0 +1,37 @@
+#test of int maps containing stats
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[i] <<< 100
+ for (i=0;i<11;i++)
+ foo[i] <<< i
+ for (i=0;i<11;i++)
+ foo[i] <<< -2
+
+ foreach (i+ in foo)
+ printf("foo[%d]: count:%d sum:%d avg:%d min:%d max:%d\n",
+ i, @count(foo[i]), @sum(foo[i]), @avg(foo[i]),
+ @min(foo[i]), @max(foo[i]))
+ printf("\nNow reverse order...\n")
+ foreach (i- in foo)
+ printf("foo[%d]: count:%d sum:%d avg:%d min:%d max:%d\n",
+ i, @count(foo[i]), @sum(foo[i]), @avg(foo[i]),
+ @min(foo[i]), @max(foo[i]))
+
+ printf ("\nNow adding 10 to each...\n")
+ for (i=0;i<11;i++)
+ foo[i] <<< 10
+ foreach (i+ in foo)
+ printf("foo[%d]: count:%d sum:%d avg:%d min:%d max:%d\n",
+ i, @count(foo[i]), @sum(foo[i]), @avg(foo[i]),
+ @min(foo[i]), @max(foo[i]))
+
+ printf ("\nRun a quick foreach without sorting...\n");
+ foreach (i in foo)
+ allsum += @sum(foo[i])
+ printf ("complete sum of foo:%d\n", allsum)
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ix_clear.exp b/testsuite/systemtap.maps/ix_clear.exp
new file mode 100644
index 00000000..96bba1ba
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear.exp
@@ -0,0 +1,24 @@
+# function to test error handling when reading nonexistent pmap elements
+
+set test "ix_clear"
+if {![installtest_p]} { untested $test; return }
+
+set pass_result {foo\[1\] = 1 1*ERROR: empty aggregate*}
+
+
+# spawn test
+spawn stap $srcdir/$subdir/$test.stp
+expect {
+ $pass_result {
+ pass "$test passed"
+ }
+ -timeout 30 {
+ send "\003"
+ fail "$test timed out"
+ }
+ eof {
+ fail "$test unexpected EOF" }
+ -re "semantic error:" { fail "$test compilation" }
+}
+close
+wait
diff --git a/testsuite/systemtap.maps/ix_clear.stp b/testsuite/systemtap.maps/ix_clear.stp
new file mode 100755
index 00000000..a36e5400
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear.stp
@@ -0,0 +1,12 @@
+#test of int maps containing stats
+
+global foo
+
+probe begin {
+ foo[1] <<< 1
+ printf("foo[1] = %d %d\n", @count(foo[1]), @sum(foo[1]))
+ delete foo[1]
+ printf("foo[1] = %d %d\n", @count(foo[1]), @sum(foo[1]))
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ix_clear2.exp b/testsuite/systemtap.maps/ix_clear2.exp
new file mode 100644
index 00000000..702ecc4f
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear2.exp
@@ -0,0 +1,25 @@
+# function to test error handling when reading nonexistent pmap elements
+
+set test "ix_clear2"
+if {![installtest_p]} { untested $test; return }
+
+
+set pass_result {foo\[1\] = 1 1*ERROR: empty aggregate*}
+
+
+# spawn test
+spawn stap $srcdir/$subdir/$test.stp
+expect {
+ $pass_result {
+ pass "$test passed"
+ }
+ -timeout 30 {
+ send "\003"
+ fail "$test timed out"
+ }
+ eof {
+ fail "$test unexpected EOF" }
+ -re "semantic error:" { fail "$test compilation" }
+}
+close
+wait
diff --git a/testsuite/systemtap.maps/ix_clear2.stp b/testsuite/systemtap.maps/ix_clear2.stp
new file mode 100755
index 00000000..cedec482
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear2.stp
@@ -0,0 +1,12 @@
+# test clearing pmaps
+
+global foo
+
+probe begin {
+ foo[1] <<< 1
+ printf("foo[1] = %d %d\n", @count(foo[1]), @sum(foo[1]))
+ delete foo
+ printf("foo[1] = %d %d\n", @count(foo[1]), @sum(foo[1]))
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ix_clear3.exp b/testsuite/systemtap.maps/ix_clear3.exp
new file mode 100644
index 00000000..5ccde188
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear3.exp
@@ -0,0 +1,23 @@
+# function to test error handling when reading nonexistent pmap elements
+
+set test "ix_clear3"
+if {![installtest_p]} { untested $test; return }
+
+set pass_result {*ERROR: empty aggregate*}
+
+# spawn test
+spawn stap $srcdir/$subdir/$test.stp
+expect {
+ $pass_result {
+ pass "$test passed"
+ }
+ -timeout 30 {
+ send "\003"
+ fail "$test timed out"
+ }
+ eof {
+ fail "$test unexpected EOF" }
+ -re "semantic error:" { fail "$test compilation" }
+}
+close
+wait
diff --git a/testsuite/systemtap.maps/ix_clear3.stp b/testsuite/systemtap.maps/ix_clear3.stp
new file mode 100755
index 00000000..f53318fe
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_clear3.stp
@@ -0,0 +1,10 @@
+# test uninitialized pmap element
+
+global foo
+
+probe begin {
+ foo[1] <<< 1
+ printf("foo[2] = %d %d\n", @count(foo[2]), @sum(foo[2]))
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ix_hist.exp b/testsuite/systemtap.maps/ix_hist.exp
new file mode 100644
index 00000000..afa5ddf7
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_hist.exp
@@ -0,0 +1,68 @@
+# Simple function to test istograms
+
+load_lib "stap_run2.exp"
+
+set test "ix_hist"
+
+set ::result_string {value |-------------------------------------------------- count
+ 0 | 1
+ 1 | 1
+ 2 |@ 2
+ 4 |@@ 4
+ 8 |@@@@ 8
+ 16 |@@@@@@@@ 16
+ 32 |@@@@@@@@@@@@@@@@ 32
+ 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 64
+ 128 | 0
+ 256 | 0
+
+value |-------------------------------------------------- count
+ 0 | 1
+ 1 | 0
+ 2 | 1
+ 4 | 2
+ 8 |@ 4
+ 16 |@@ 8
+ 32 |@@@@@ 16
+ 64 |@@@@@@@@@@ 32
+ 128 |@@@@@@@@@@@@@@@@@@@@@ 64
+ 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 128
+ 512 | 0
+ 1024 | 0
+
+value |-------------------------------------------------- count
+ 0 | 1
+ 1 | 0
+ 2 | 1
+ 4 | 1
+ 8 | 3
+ 16 |@ 5
+ 32 |@@ 11
+ 64 |@@@@@ 21
+ 128 |@@@@@@@@@@ 43
+ 256 |@@@@@@@@@@@@@@@@@@@@@ 85
+ 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 171
+ 1024 |@@@@@@@@@@ 42
+ 2048 | 0
+ 4096 | 0
+
+value |-------------------------------------------------- count
+ 0 | 1
+ 1 | 0
+ 2 | 0
+ 4 | 1
+ 8 | 2
+ 16 | 4
+ 32 |@ 8
+ 64 |@@ 16
+ 128 |@@@@@ 32
+ 256 |@@@@@@@@@@ 64
+ 512 |@@@@@@@@@@@@@@@@@@@@@ 128
+ 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 256
+ 2048 | 0
+ 4096 | 0
+}
+
+stap_run2 $srcdir/$subdir/$test.stp -DMAXACTION=10000
+
+
diff --git a/testsuite/systemtap.maps/ix_hist.stp b/testsuite/systemtap.maps/ix_hist.stp
new file mode 100755
index 00000000..2d0a3b17
--- /dev/null
+++ b/testsuite/systemtap.maps/ix_hist.stp
@@ -0,0 +1,15 @@
+# test of int maps containing stats
+
+global foo
+
+probe begin {
+ for (i=0;i<5;i++)
+ for (j=0;j<i*128;j++)
+ foo[i] <<< i*j
+
+ foreach (i+ in foo)
+ print(@hist_log(foo[i]))
+
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/pmap_agg_overflow.exp b/testsuite/systemtap.maps/pmap_agg_overflow.exp
new file mode 100644
index 00000000..f559f00a
--- /dev/null
+++ b/testsuite/systemtap.maps/pmap_agg_overflow.exp
@@ -0,0 +1,27 @@
+# function to test error handling of pmap aggregation
+
+set test "pmap_agg_overflow"
+if {![installtest_p]} { untested $test; return }
+
+set pass_result "^(ERROR: aggregation overflow.*\r\n){2}WARNING: Number of errors: 2, skipped probes: 0\r\n$"
+set skip_result "^WARNING: This test only applies to smp systems...\r\n$"
+
+# spawn test
+spawn stap -DMAXERRORS=1 -g $srcdir/$subdir/$test.stp
+expect {
+ -re $pass_result {
+ pass "$test passed"
+ }
+ -re $skip_result {
+ unsupported "$test requires smp"
+ }
+ -timeout 30 {
+ send "\003"
+ fail "$test timed out"
+ }
+ eof {
+ fail "$test unexpected EOF" }
+ -re "semantic error:" { fail "$test compilation" }
+}
+close
+wait
diff --git a/testsuite/systemtap.maps/pmap_agg_overflow.stp b/testsuite/systemtap.maps/pmap_agg_overflow.stp
new file mode 100755
index 00000000..81268550
--- /dev/null
+++ b/testsuite/systemtap.maps/pmap_agg_overflow.stp
@@ -0,0 +1,38 @@
+# try to induce overflow of pmap aggregation
+# (this will only work on smp machines)
+
+global stat, count, max_count
+
+probe begin {
+ if (num_online_cpus() < 2) {
+ warn("This test only applies to smp systems...")
+ exit()
+ }
+ max_count = num_online_cpus() * max_map_entries()
+}
+
+probe timer.profile {
+ i = ++count
+ if (i >= max_count) exit()
+ stat[i] <<< i
+}
+
+probe end {
+ # pmap aggregation should overflow here
+ foreach (i in stat)
+ printf("@count(stat[%d]) = %d\n", i, @count(stat[i]))
+}
+
+probe end {
+ # sorted pmap aggregation should overflow here
+ foreach (i+ in stat)
+ printf("@count(stat[%d]) = %d\n", i, @count(stat[i]))
+}
+
+function max_map_entries:long() %{
+ THIS->__retvalue = MAXMAPENTRIES;
+%}
+
+function num_online_cpus:long() %{
+ THIS->__retvalue = num_online_cpus();
+%}
diff --git a/testsuite/systemtap.maps/si.exp b/testsuite/systemtap.maps/si.exp
new file mode 100644
index 00000000..53bc1271
--- /dev/null
+++ b/testsuite/systemtap.maps/si.exp
@@ -0,0 +1,65 @@
+# Simple function to test maps of strings containing ints
+
+load_lib "stap_run2.exp"
+
+set test "si"
+set ::result_string {foo[1] = 1
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[5] = 25
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+foo[10] = 100
+
+foo[1] = 1
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+foo[10] = 100
+
+foo[2] = 4
+foo[3] = 9
+foo[4] = 16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = 81
+
+foo[2] = 4
+foo[3] = 900
+foo[4] = -16
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = -81
+
+foo[2] = 4
+foo[3] = 900
+foo[6] = 36
+foo[7] = 49
+foo[8] = 64
+foo[9] = -81
+
+
+foo[1] = 1
+foo[2] = 5
+foo[3] = 14
+foo[4] = 30
+foo[5] = 55
+foo[6] = 91
+foo[7] = 140
+foo[8] = 204
+foo[9] = 285
+foo[10] = 385
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/si.stp b/testsuite/systemtap.maps/si.stp
new file mode 100755
index 00000000..3267b283
--- /dev/null
+++ b/testsuite/systemtap.maps/si.stp
@@ -0,0 +1,62 @@
+#test of string maps containing ints
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[sprint(i)] = i*i
+
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+ # delete out of the middle
+ foo["5"] = 0
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+ # delete first entry
+ foo["1"] = 0
+ # and last entry
+ foo["10"] = 0
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+
+ # change a couple
+ foo["9"] = -81
+ foo["4"] = -foo["4"]
+ foo["3"] *= 100
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+
+ # delete one
+ foo["4"] = 0
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+
+ # delete all
+ delete foo
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+
+ # load it again
+ for (i=0;i<11;i++)
+ foo[sprint(i)] = i*i
+ for (i=0;i<11;i++)
+ foo[sprint(i)] += foo[sprint(i-1)]
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %d\n", str, foo[str])
+
+
+ exit()
+}
+
diff --git a/testsuite/systemtap.maps/ss.exp b/testsuite/systemtap.maps/ss.exp
new file mode 100644
index 00000000..f3a32118
--- /dev/null
+++ b/testsuite/systemtap.maps/ss.exp
@@ -0,0 +1,69 @@
+# Simple function to test maps of strings containing strings
+
+load_lib "stap_run2.exp"
+
+set test "ss"
+set ::result_string {foo[0] = The Result is 0
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[5] = The Result is 25
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+foo[10] = The Result is 100
+
+foo[0] = The Result is 0
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+foo[10] = The Result is 100
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 9
+foo[4] = The Result is 16
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = The Result is 81
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 4<------
+foo[4] = The Result is 16(CHANGED)
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = New result is -81
+
+foo[1] = The Result is 1
+foo[2] = The Result is 4
+foo[3] = The Result is 4<------
+foo[6] = The Result is 36
+foo[7] = The Result is 49
+foo[8] = The Result is 64
+foo[9] = New result is -81
+
+
+foo[0] = # 0
+foo[1] = # 1
+foo[2] = # 4
+foo[3] = # 9
+foo[4] = # 16
+foo[5] = # 25
+foo[6] = # 36
+foo[7] = # 49
+foo[8] = # 64
+foo[9] = # 81
+foo[10] = # 100
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.maps/ss.stp b/testsuite/systemtap.maps/ss.stp
new file mode 100755
index 00000000..d649c25c
--- /dev/null
+++ b/testsuite/systemtap.maps/ss.stp
@@ -0,0 +1,62 @@
+#test of string maps containing strings
+
+global foo
+
+probe begin {
+ for (i=0;i<11;i++)
+ foo[sprint(i)] = "The Result is ".sprint(i*i)
+
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+ # delete out of the middle
+ foo["5"] = ""
+ printf("\n")
+
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+ # delete first entry
+ foo["0"] = ""
+ # and last entry
+ foo["10"] = ""
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+
+ # change a couple
+ foo["9"] = "New result is -81"
+ foo["4"] = foo["4"]."(CHANGED)"
+ foo["3"] = foo["2"]."<------"
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+
+ # delete one
+ foo["4"] = ""
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+
+ # delete all
+ delete foo
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+ # load it again
+ for (i=0;i<11;i++)
+ foo[sprint(i)] = sprint(i*i)
+ for (i=0;i<11;i++)
+ foo[sprint(i)] = "# ".sprint(i*i)
+
+ printf("\n")
+ foreach (str in foo)
+ printf("foo[%s] = %s\n", str, foo[str])
+
+ exit()
+}
+