diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | stap.1.in | 10 | ||||
-rw-r--r-- | testsuite/ChangeLog | 7 | ||||
-rwxr-xr-x | testsuite/buildok/array_size.stp | 11 | ||||
-rwxr-xr-x | testsuite/parseko/array01.stp | 4 | ||||
-rwxr-xr-x | testsuite/parseko/array02.stp | 4 | ||||
-rwxr-xr-x | testsuite/parseko/array03.stp | 4 | ||||
-rwxr-xr-x | testsuite/parseko/array04.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/array_size.exp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/array_size.stp | 30 | ||||
-rwxr-xr-x | testsuite/transko/array01.stp | 7 |
11 files changed, 92 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2006-12-22 Josh Stone <joshua.i.stone@intel.com> + + * stap.1.in: Document how to specify the size of global arrays. + 2006-12-21 Josh Stone <joshua.i.stone@intel.com> PR 3671 @@ -280,6 +280,16 @@ or number literal. .RS .BR global " var1" , " var2" , " var3=4" .RE +.PP +Arrays are limited in size by the MAXMAPENTRIES variable -- see the +.B SAFETY AND SECURITY +section for details. Optionally, global arrays may be declared with a +maximum size in brackets, overriding MAXMAPENTRIES for that array only. +Note that this doesn't indicate the type of keys for the array, just the +size. +.RS +.BR global " tiny_array[10]" , " normal_array" , " big_array[50000]" +.RE .\" XXX add statistics type here once it's supported .SS STATEMENTS diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 4f113d42..6a64e636 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-12-22 Josh Stone <joshua.i.stone@intel.com> + + * buildok/array_size.stp, parseko/array01.stp, parseko/array02.stp, + parseko/array03.stp, parseko/array04.stp, transko/array01.stp, + systemtap.base/array_size.exp, systemtap.base/array_size.stp: + Tests for specifying the size of global arrays. + 2006-12-22 David Smith <dsmith@redhat.com> * systemtap.base/cache.exp: Added test to ensure that using '-M' diff --git a/testsuite/buildok/array_size.stp b/testsuite/buildok/array_size.stp new file mode 100755 index 00000000..44a5e58c --- /dev/null +++ b/testsuite/buildok/array_size.stp @@ -0,0 +1,11 @@ +#! stap -p4 + +# test reading & writing for little, big, and default arrays, with various +# index types mixed in. +global a[1], b[100000], c +probe begin { + a[42, "foobar"] = "Hello World!" + b["foo", "bar", "baz", 42] = 314159265 + c[42] = 161803399 + printf("%s %d %d\n", a[42, "foobar"], b["foo", "bar", "baz", 42], c[42]) +} diff --git a/testsuite/parseko/array01.stp b/testsuite/parseko/array01.stp new file mode 100755 index 00000000..81e7f249 --- /dev/null +++ b/testsuite/parseko/array01.stp @@ -0,0 +1,4 @@ +#! stap -p1 + +# array size must be >0 +global a[0] diff --git a/testsuite/parseko/array02.stp b/testsuite/parseko/array02.stp new file mode 100755 index 00000000..2825cce5 --- /dev/null +++ b/testsuite/parseko/array02.stp @@ -0,0 +1,4 @@ +#! stap -p1 + +# array size must have a reasonable upper limit +global a[1000000000] diff --git a/testsuite/parseko/array03.stp b/testsuite/parseko/array03.stp new file mode 100755 index 00000000..601efff6 --- /dev/null +++ b/testsuite/parseko/array03.stp @@ -0,0 +1,4 @@ +#! stap -p1 + +# arrays can't be initialized with a scalar number +global a[10] = 42 diff --git a/testsuite/parseko/array04.stp b/testsuite/parseko/array04.stp new file mode 100755 index 00000000..476685ed --- /dev/null +++ b/testsuite/parseko/array04.stp @@ -0,0 +1,4 @@ +#! stap -p1 + +# arrays can't be initialized with a scalar string +global a[10] = "foobar" diff --git a/testsuite/systemtap.base/array_size.exp b/testsuite/systemtap.base/array_size.exp new file mode 100644 index 00000000..86aec8ab --- /dev/null +++ b/testsuite/systemtap.base/array_size.exp @@ -0,0 +1,7 @@ +# Check that specifying an array size gives more room than MAXMAPENTRIES + +load_lib "stap_run.exp" + +set test "array_size" + +stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string -DMAXMAPENTRIES=1 diff --git a/testsuite/systemtap.base/array_size.stp b/testsuite/systemtap.base/array_size.stp new file mode 100644 index 00000000..cf597a61 --- /dev/null +++ b/testsuite/systemtap.base/array_size.stp @@ -0,0 +1,30 @@ +/* + * array_size.stp + * + * Check that specifying an array size gives more room than MAXMAPENTRIES + * + * Call with MAXMAPENTRIES << 100 + */ + +probe begin { log("systemtap starting probe") } +probe end { log("systemtap ending probe") } + +global a[100] + +probe begin { + for (i=42; i<142; ++i) + a[i] = i*i +} + +probe end(1) { + for (i=42; i<142; ++i) { + if (a[i] == i*i) + ++ok + else + ++bad + } + if (ok == 100 && bad == 0) + log("systemtap test success") + else + printf("systemtap test failure - ok:%d, bad:%d\n", ok, bad) +} diff --git a/testsuite/transko/array01.stp b/testsuite/transko/array01.stp new file mode 100755 index 00000000..f936cefa --- /dev/null +++ b/testsuite/transko/array01.stp @@ -0,0 +1,7 @@ +#! stap -p3 + +# arrays can't be inferred as anything else +global a[10] +probe begin { + printf("%d\n", @count(a)) # try to make 'a' a stat +} |