diff options
author | hunt <hunt> | 2007-09-12 18:21:55 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-09-12 18:21:55 +0000 |
commit | 674f70a0371c1f97a83c66268d03332ebbf9e62f (patch) | |
tree | d910409c003bc72463253cc7ef0c07bb522721fb /testsuite/systemtap.maps | |
parent | cf9be511f05d0b310b2c4ce4c050d3707be9e65a (diff) | |
download | systemtap-steved-674f70a0371c1f97a83c66268d03332ebbf9e62f.tar.gz systemtap-steved-674f70a0371c1f97a83c66268d03332ebbf9e62f.tar.xz systemtap-steved-674f70a0371c1f97a83c66268d03332ebbf9e62f.zip |
2007-09-12 Martin Hunt <hunt@redhat.com>
* systemtap.maps/foreach_limit.stp: Clean up the aggregates
section.
* systemtap.maps/foreach_limit2.stp: Remove newline that was
confusing the output match.
* systemtap.maps/linear_bad.exp: Fix expected output.
* systemtap.maps/linear_neg.exp: Ditto.
* systemtap.maps/log.*: New files.
* systemtap.maps/log_edge.*: New files.
* lib/stap_run2.exp (stap_run2): Rewrite. Previous version
was too complex and buggy.
Diffstat (limited to 'testsuite/systemtap.maps')
-rw-r--r-- | testsuite/systemtap.maps/foreach_limit.exp | 31 | ||||
-rw-r--r-- | testsuite/systemtap.maps/foreach_limit.stp | 21 | ||||
-rwxr-xr-x | testsuite/systemtap.maps/foreach_limit2.stp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.maps/linear_bad.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.maps/linear_neg.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.maps/log.exp | 138 | ||||
-rw-r--r-- | testsuite/systemtap.maps/log.stp | 25 | ||||
-rw-r--r-- | testsuite/systemtap.maps/log_edge.exp | 51 | ||||
-rw-r--r-- | testsuite/systemtap.maps/log_edge.stp | 40 |
9 files changed, 290 insertions, 22 deletions
diff --git a/testsuite/systemtap.maps/foreach_limit.exp b/testsuite/systemtap.maps/foreach_limit.exp index 06e797da..97305c4b 100644 --- a/testsuite/systemtap.maps/foreach_limit.exp +++ b/testsuite/systemtap.maps/foreach_limit.exp @@ -2,7 +2,8 @@ set test "foreach_limit" -set ::result_string {Arrays: +set ::result_string { +Arrays: unsorted: key 9, value 18 key 1, value 40 @@ -71,15 +72,27 @@ loop had 4 iterations x ended up as 5 Aggregates: -64 total aggregate entries +count=150 sum=21360 +min=4 max=600 +value |-------------------------------------------------- count + 1 | 0 + 2 | 0 + 4 |@ 1 + 8 |@@@@@@ 6 + 16 |@@@@@@@@@@@@@ 13 + 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 28 + 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 39 + 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 42 + 256 |@@@@@@@@@@@@@@@@@ 17 + 512 |@@@@ 4 + 1024 | 0 + 2048 | 0 -aggregate limit 5: -bucket 0: 0 -bucket 1: 0 -bucket 2: 0 -bucket 3: 1 -bucket 4: 6 -loop had 5 iterations +bucket 67: 1 +bucket 68: 6 +bucket 69: 13 +bucket 70: 28 +loop had 71 iterations Done. } diff --git a/testsuite/systemtap.maps/foreach_limit.stp b/testsuite/systemtap.maps/foreach_limit.stp index 6ce0f361..d4646dbc 100644 --- a/testsuite/systemtap.maps/foreach_limit.stp +++ b/testsuite/systemtap.maps/foreach_limit.stp @@ -104,6 +104,8 @@ probe begin printf("\nAggregates:\n"); # Add items to the aggregate + # 10 keys, 15 entries each = 150 entries. + # min = 4, max = 15 * 40 = 600 foreach (key in array) { agg <<< array[key] @@ -118,24 +120,23 @@ probe begin agg <<< array[key] * 10 agg <<< array[key] * 11 agg <<< array[key] * 12 - agg <<< array[key] * 12 agg <<< array[key] * 13 agg <<< array[key] * 14 agg <<< array[key] * 15 } - # Find the total number of aggregate entries - i = 0 - foreach (bucket in @hist_log(agg)) - i++; - printf("%d total aggregate entries\n", i); + printf("count=%d sum=%d\n", @count(agg), @sum(agg)) + printf("min=%d max=%d\n", @min(agg), @max(agg)) + print(@hist_log(agg)) - # Print the 1st 5 aggregate entries - printf("\naggregate limit 5:\n"); + # This is useless, but test anyway. Maybe it will + # trigger some obscure edge condition. + # log buckets run from 0 to 127. i = 0 - foreach (bucket in @hist_log(agg) limit 5) + foreach (bucket in @hist_log(agg) limit 71) { - printf("bucket %d: %d\n", bucket, @hist_log(agg)[bucket]); + if (@hist_log(agg)[bucket]) + printf("bucket %d: %d\n", bucket, @hist_log(agg)[bucket]); i++; } printf("loop had %d iterations\n", i); diff --git a/testsuite/systemtap.maps/foreach_limit2.stp b/testsuite/systemtap.maps/foreach_limit2.stp index 22f9a745..60b7ce94 100755 --- a/testsuite/systemtap.maps/foreach_limit2.stp +++ b/testsuite/systemtap.maps/foreach_limit2.stp @@ -5,7 +5,7 @@ probe begin # # Array section # - printf("\nArrays of aggregates:\n"); + printf("Arrays of aggregates:\n"); # Add elements to the array of aggregates, but in an unsorted order agg_array[9] <<< 18 diff --git a/testsuite/systemtap.maps/linear_bad.exp b/testsuite/systemtap.maps/linear_bad.exp index 8aa88bb2..d99fd16c 100644 --- a/testsuite/systemtap.maps/linear_bad.exp +++ b/testsuite/systemtap.maps/linear_bad.exp @@ -9,7 +9,7 @@ set ok 0 spawn stap -DMAXACTION=10000 $srcdir/$subdir/$test.stp expect { -timeout 150 - "WARNING: histogram: Interval is too small." { + "WARNING: histogram: Number of buckets" { incr ok exp_continue } diff --git a/testsuite/systemtap.maps/linear_neg.exp b/testsuite/systemtap.maps/linear_neg.exp index fcd1c4dd..b1640030 100644 --- a/testsuite/systemtap.maps/linear_neg.exp +++ b/testsuite/systemtap.maps/linear_neg.exp @@ -9,7 +9,7 @@ set ok 0 spawn stap -DMAXACTION=10000 $srcdir/$subdir/$test.stp expect { -timeout 150 - "saw: operator \'-\' at *linear_neg.stp" { + "Number of buckets" { incr ok exp_continue } diff --git a/testsuite/systemtap.maps/log.exp b/testsuite/systemtap.maps/log.exp new file mode 100644 index 00000000..2bc54a33 --- /dev/null +++ b/testsuite/systemtap.maps/log.exp @@ -0,0 +1,138 @@ +# test full range of log histograms + +set test "log" +set ::result_string { value |-------------------------------------------------- count +-9223372036854775808 |@ 1 +-4611686018427387904 |@ 1 +-2305843009213693952 |@ 1 +-1152921504606846976 |@ 1 + -576460752303423488 |@ 1 + -288230376151711744 |@ 1 + -144115188075855872 |@ 1 + -72057594037927936 |@ 1 + -36028797018963968 |@ 1 + -18014398509481984 |@ 1 + -9007199254740992 |@ 1 + -4503599627370496 |@ 1 + -2251799813685248 |@ 1 + -1125899906842624 |@ 1 + -562949953421312 |@ 1 + -281474976710656 |@ 1 + -140737488355328 |@ 1 + -70368744177664 |@ 1 + -35184372088832 |@ 1 + -17592186044416 |@ 1 + -8796093022208 |@ 1 + -4398046511104 |@ 1 + -2199023255552 |@ 1 + -1099511627776 |@ 1 + -549755813888 |@ 1 + -274877906944 |@ 1 + -137438953472 |@ 1 + -68719476736 |@ 1 + -34359738368 |@ 1 + -17179869184 |@ 1 + -8589934592 |@ 1 + -4294967296 |@ 1 + -2147483648 |@ 1 + -1073741824 |@ 1 + -536870912 |@ 1 + -268435456 |@ 1 + -134217728 |@ 1 + -67108864 |@ 1 + -33554432 |@ 1 + -16777216 |@ 1 + -8388608 |@ 1 + -4194304 |@ 1 + -2097152 |@ 1 + -1048576 |@ 1 + -524288 |@ 1 + -262144 |@ 1 + -131072 |@ 1 + -65536 |@ 1 + -32768 |@ 1 + -16384 |@ 1 + -8192 |@ 1 + -4096 |@ 1 + -2048 |@ 1 + -1024 |@ 1 + -512 |@ 1 + -256 |@ 1 + -128 |@ 1 + -64 |@ 1 + -32 |@ 1 + -16 |@ 1 + -8 |@ 1 + -4 |@ 1 + -2 |@ 1 + -1 |@ 1 + 0 |@@@@@@@@@@@@@@@@@@@@ 20 + 1 |@ 1 + 2 |@ 1 + 4 |@ 1 + 8 |@ 1 + 16 |@ 1 + 32 |@ 1 + 64 |@ 1 + 128 |@ 1 + 256 |@ 1 + 512 |@ 1 + 1024 |@ 1 + 2048 |@ 1 + 4096 |@ 1 + 8192 |@ 1 + 16384 |@ 1 + 32768 |@ 1 + 65536 |@ 1 + 131072 |@ 1 + 262144 |@ 1 + 524288 |@ 1 + 1048576 |@ 1 + 2097152 |@ 1 + 4194304 |@ 1 + 8388608 |@ 1 + 16777216 |@ 1 + 33554432 |@ 1 + 67108864 |@ 1 + 134217728 |@ 1 + 268435456 |@ 1 + 536870912 |@ 1 + 1073741824 |@ 1 + 2147483648 |@ 1 + 4294967296 |@ 1 + 8589934592 |@ 1 + 17179869184 |@ 1 + 34359738368 |@ 1 + 68719476736 |@ 1 + 137438953472 |@ 1 + 274877906944 |@ 1 + 549755813888 |@ 1 + 1099511627776 |@ 1 + 2199023255552 |@ 1 + 4398046511104 |@ 1 + 8796093022208 |@ 1 + 17592186044416 |@ 1 + 35184372088832 |@ 1 + 70368744177664 |@ 1 + 140737488355328 |@ 1 + 281474976710656 |@ 1 + 562949953421312 |@ 1 + 1125899906842624 |@ 1 + 2251799813685248 |@ 1 + 4503599627370496 |@ 1 + 9007199254740992 |@ 1 + 18014398509481984 |@ 1 + 36028797018963968 |@ 1 + 72057594037927936 |@ 1 + 144115188075855872 |@ 1 + 288230376151711744 |@ 1 + 576460752303423488 |@ 1 + 1152921504606846976 |@ 1 + 2305843009213693952 |@ 1 + 4611686018427387904 |@ 1 + +} + +stap_run2 $srcdir/$subdir/$test.stp + + diff --git a/testsuite/systemtap.maps/log.stp b/testsuite/systemtap.maps/log.stp new file mode 100644 index 00000000..5b1bf4bb --- /dev/null +++ b/testsuite/systemtap.maps/log.stp @@ -0,0 +1,25 @@ +global foo + +probe begin +{ + val = 1 + # add in one of each power of two + for (i = 0; i < 63; i++) { + foo <<< val + val <<= 1 + } + + val = 1; + # now add the negative powers of two + for (i = 0; i < 64; i++) { + foo <<< -val + val <<= 1 + } + + # add in a bunch of zeros + for (i=0; i<20; i++) + foo <<< 0 + + print(@hist_log(foo)) + exit() +} diff --git a/testsuite/systemtap.maps/log_edge.exp b/testsuite/systemtap.maps/log_edge.exp new file mode 100644 index 00000000..051021b1 --- /dev/null +++ b/testsuite/systemtap.maps/log_edge.exp @@ -0,0 +1,51 @@ +# test log histogram edge cases + +set test "log_edge" +set ::result_string {value |-------------------------------------------------- count + -4 | 0 + -2 | 0 + -1 |@ 1 + 0 | 0 + 1 |@ 1 + 2 | 0 + 4 | 0 + +bucket 63: 1 +bucket 65: 1 + + + +value |-------------------------------------------------- count + 0 |@ 1 + 1 | 0 + 2 | 0 + +bucket 64: 1 + + + + value |-------------------------------------------------- count +1152921504606846976 | 0 +2305843009213693952 | 0 +4611686018427387904 |@ 1 + +bucket 127: 1 + + + +value |-------------------------------------------------- count + 0 | 0 + 1 |@ 1 + 2 |@@ 2 + 4 |@ 1 + 8 | 0 + 16 | 0 + +bucket 65: 1 +bucket 66: 2 +bucket 67: 1 +} + +stap_run2 $srcdir/$subdir/$test.stp + + diff --git a/testsuite/systemtap.maps/log_edge.stp b/testsuite/systemtap.maps/log_edge.stp new file mode 100644 index 00000000..9eb2ddb6 --- /dev/null +++ b/testsuite/systemtap.maps/log_edge.stp @@ -0,0 +1,40 @@ +global foo + +probe begin +{ + foo <<< -1 + foo <<< 1 + print(@hist_log(foo)) + foreach (bucket in @hist_log(foo)) + if (@hist_log(foo)[bucket]) + printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket]) + print("\n\n\n") + delete foo + + + foo <<< 0 + print(@hist_log(foo)) + foreach (bucket in @hist_log(foo)) + if (@hist_log(foo)[bucket]) + printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket]) + print("\n\n\n") + delete foo + + foo <<< 0x7fffffffffffffff + print(@hist_log(foo)) + foreach (bucket in @hist_log(foo)) + if (@hist_log(foo)[bucket]) + printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket]) + print("\n\n\n") + delete foo + + foo <<< 1 + foo <<< 2 + foo <<< 3 + foo <<< 4 + print(@hist_log(foo)) + foreach (bucket in @hist_log(foo)) + if (@hist_log(foo)[bucket]) + printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket]) + exit() +} |