summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorhunt <hunt>2007-07-06 19:03:12 +0000
committerhunt <hunt>2007-07-06 19:03:12 +0000
commit8ecca5bae4ccdd9af021ba6af3fa5c8bd26c34be (patch)
tree559966e2b73fb55cdc00b7653c1915bbd0db9d8a /testsuite
parent7d291bee3622b18c16d53a359a230306b67203f9 (diff)
downloadsystemtap-steved-8ecca5bae4ccdd9af021ba6af3fa5c8bd26c34be.tar.gz
systemtap-steved-8ecca5bae4ccdd9af021ba6af3fa5c8bd26c34be.tar.xz
systemtap-steved-8ecca5bae4ccdd9af021ba6af3fa5c8bd26c34be.zip
2007-07-06 Martin Hunt <hunt@redhat.com>
* systemtap.maps/linear*: New tests of linear histograms.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.maps/linear.exp45
-rw-r--r--testsuite/systemtap.maps/linear.stp33
-rw-r--r--testsuite/systemtap.maps/linear_0.exp25
-rw-r--r--testsuite/systemtap.maps/linear_0.stp21
-rw-r--r--testsuite/systemtap.maps/linear_bad.exp25
-rw-r--r--testsuite/systemtap.maps/linear_bad.stp21
-rw-r--r--testsuite/systemtap.maps/linear_empty.exp9
-rw-r--r--testsuite/systemtap.maps/linear_empty.stp16
-rw-r--r--testsuite/systemtap.maps/linear_neg.exp25
-rw-r--r--testsuite/systemtap.maps/linear_neg.stp21
-rw-r--r--testsuite/systemtap.maps/linear_over.exp18
-rw-r--r--testsuite/systemtap.maps/linear_over.stp22
-rw-r--r--testsuite/systemtap.maps/linear_under.exp18
-rw-r--r--testsuite/systemtap.maps/linear_under.stp22
15 files changed, 325 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 259971e2..2e83a8ce 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-07-06 Martin Hunt <hunt@redhat.com>
+
+ * systemtap.maps/linear*: New tests of linear histograms.
+
2007-07-03 Frank Ch. Eigler <fche@elastic.org>
* configure.ac: Bumped version to 0.5.15.
diff --git a/testsuite/systemtap.maps/linear.exp b/testsuite/systemtap.maps/linear.exp
new file mode 100644
index 00000000..5023beab
--- /dev/null
+++ b/testsuite/systemtap.maps/linear.exp
@@ -0,0 +1,45 @@
+# Test linear histogram
+
+set test "linear"
+set ::result_string {count=1600
+sum=653400
+min=0
+max=1485
+avg=408
+value |-------------------------------------------------- count
+ 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 177
+ 50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 170
+ 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 117
+ 150 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 122
+ 200 |@@@@@@@@@@@@@@@@@@@@@@@ 94
+ 250 |@@@@@@@@@@@@@@@@@@@@@@@ 94
+ 300 |@@@@@@@@@@@@@@@@@@@ 79
+ 350 |@@@@@@@@@@@@@@@@@@@ 79
+ 400 |@@@@@@@@@@@@@@@@ 65
+ 450 |@@@@@@@@@@@@@@@@ 67
+ 500 |@@@@@@@@@@@@@ 55
+ 550 |@@@@@@@@@@@@@ 54
+ 600 |@@@@@@@@@@@@ 51
+ 650 |@@@@@@@@@@@ 45
+ 700 |@@@@@@@@@@ 41
+ 750 |@@@@@@@@@@ 40
+ 800 |@@@@@@@@ 34
+ 850 |@@@@@@@@ 33
+ 900 |@@@@@@@ 31
+ 950 |@@@@@@ 27
+ 1000 |@@@@@ 23
+ 1050 |@@@@@@ 24
+ 1100 |@@@@ 19
+ 1150 |@@@@ 18
+ 1200 |@@@ 12
+ 1250 |@@ 9
+ 1300 |@ 7
+ 1350 |@ 7
+ 1400 | 3
+ 1450 | 3
+
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/linear.stp b/testsuite/systemtap.maps/linear.stp
new file mode 100644
index 00000000..f678fccf
--- /dev/null
+++ b/testsuite/systemtap.maps/linear.stp
@@ -0,0 +1,33 @@
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=0; key < 100; key++) {
+ agg <<< key
+ agg <<< key * 2
+ agg <<< key * 3
+ agg <<< key * 4
+ agg <<< key * 5
+ agg <<< key * 6
+ agg <<< key * 7
+ agg <<< key * 8
+ agg <<< key * 9
+ agg <<< key * 10
+ agg <<< key * 11
+ agg <<< key * 12
+ agg <<< key * 12
+ agg <<< key * 13
+ agg <<< key * 14
+ agg <<< key * 15
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+ print(@hist_linear(agg, 0, 1500, 50))
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_0.exp b/testsuite/systemtap.maps/linear_0.exp
new file mode 100644
index 00000000..8e6952a7
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_0.exp
@@ -0,0 +1,25 @@
+# test of histogram with interval = 0 (error)
+
+set test "linear_0"
+
+if {![installtest_p]} { untested $test; return }
+
+set ok 0
+
+spawn stap -DMAXACTION=10000 $srcdir/$subdir/$test.stp
+expect {
+ -timeout 150
+ "WARNING: histogram: interval cannot be zero." {
+ incr ok
+ exp_continue
+ }
+ eof { }
+}
+catch close
+wait
+
+if {$ok == 1} {
+ pass $test
+} else {
+ fail $test
+}
diff --git a/testsuite/systemtap.maps/linear_0.stp b/testsuite/systemtap.maps/linear_0.stp
new file mode 100644
index 00000000..d5201d46
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_0.stp
@@ -0,0 +1,21 @@
+# test for interval = 0
+
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=0; key < 100; key++) {
+ agg <<< key
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+
+ print(@hist_linear(agg, 0, 1500, 0))
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_bad.exp b/testsuite/systemtap.maps/linear_bad.exp
new file mode 100644
index 00000000..8aa88bb2
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_bad.exp
@@ -0,0 +1,25 @@
+# test of histogram with interval too small
+
+set test "linear_bad"
+
+if {![installtest_p]} { untested $test; return }
+
+set ok 0
+
+spawn stap -DMAXACTION=10000 $srcdir/$subdir/$test.stp
+expect {
+ -timeout 150
+ "WARNING: histogram: Interval is too small." {
+ incr ok
+ exp_continue
+ }
+ eof { }
+}
+catch close
+wait
+
+if {$ok == 1} {
+ pass $test
+} else {
+ fail $test
+}
diff --git a/testsuite/systemtap.maps/linear_bad.stp b/testsuite/systemtap.maps/linear_bad.stp
new file mode 100644
index 00000000..5ebde182
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_bad.stp
@@ -0,0 +1,21 @@
+# test of too many buckets (interval too small)
+
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=0; key < 100; key++) {
+ agg <<< key
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+
+ print(@hist_linear(agg, 0, 1500, 2))
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_empty.exp b/testsuite/systemtap.maps/linear_empty.exp
new file mode 100644
index 00000000..9bcc64eb
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_empty.exp
@@ -0,0 +1,9 @@
+# Test empty linear histogram
+
+set test "linear_empty"
+set ::result_string {count=0
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
+
+
diff --git a/testsuite/systemtap.maps/linear_empty.stp b/testsuite/systemtap.maps/linear_empty.stp
new file mode 100644
index 00000000..f20bf470
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_empty.stp
@@ -0,0 +1,16 @@
+# test that we can check the count of an empty array
+
+global agg
+
+probe begin
+{
+ printf("count=%d\n", @count(agg))
+ if (@count(agg) > 0) {
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+ print(@hist_linear(agg, 0, 1500, 50))
+ }
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_neg.exp b/testsuite/systemtap.maps/linear_neg.exp
new file mode 100644
index 00000000..fcd1c4dd
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_neg.exp
@@ -0,0 +1,25 @@
+# test of histogram with negative interval
+
+set test "linear_neg"
+
+if {![installtest_p]} { untested $test; return }
+
+set ok 0
+
+spawn stap -DMAXACTION=10000 $srcdir/$subdir/$test.stp
+expect {
+ -timeout 150
+ "saw: operator \'-\' at *linear_neg.stp" {
+ incr ok
+ exp_continue
+ }
+ eof { }
+}
+catch close
+wait
+
+if {$ok == 1} {
+ pass $test
+} else {
+ fail $test
+}
diff --git a/testsuite/systemtap.maps/linear_neg.stp b/testsuite/systemtap.maps/linear_neg.stp
new file mode 100644
index 00000000..b8825a6b
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_neg.stp
@@ -0,0 +1,21 @@
+# test for a negative interval
+
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=0; key < 100; key++) {
+ agg <<< key
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+
+ print(@hist_linear(agg, 0, 1500, -1))
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_over.exp b/testsuite/systemtap.maps/linear_over.exp
new file mode 100644
index 00000000..cdeb9538
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_over.exp
@@ -0,0 +1,18 @@
+# Test linear histogram
+
+set test "linear_over"
+set ::result_string {count=9000
+sum=49495500
+min=1000
+max=9999
+avg=5499
+value |-------------------------------------------------- count
+ 70 | 0
+ 80 | 0
+ 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9000
+
+}
+
+stap_run2 $srcdir/$subdir/$test.stp -DMAXACTION=10000
+
+
diff --git a/testsuite/systemtap.maps/linear_over.stp b/testsuite/systemtap.maps/linear_over.stp
new file mode 100644
index 00000000..989d9ac2
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_over.stp
@@ -0,0 +1,22 @@
+# test of histogram where all the values are
+# over the histogram
+
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=1000; key < 10000; key++) {
+ agg <<< key
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+
+ print(@hist_linear(agg, 0, 100, 10))
+
+ exit()
+}
diff --git a/testsuite/systemtap.maps/linear_under.exp b/testsuite/systemtap.maps/linear_under.exp
new file mode 100644
index 00000000..39514241
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_under.exp
@@ -0,0 +1,18 @@
+# Test linear histogram
+
+set test "linear_under"
+set ::result_string {count=100
+sum=4950
+min=0
+max=99
+avg=49
+value |-------------------------------------------------- count
+ 1800 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 100
+ 1900 | 0
+ 2000 | 0
+
+}
+
+stap_run2 $srcdir/$subdir/$test.stp -DMAXACTION=10000
+
+
diff --git a/testsuite/systemtap.maps/linear_under.stp b/testsuite/systemtap.maps/linear_under.stp
new file mode 100644
index 00000000..59566cf0
--- /dev/null
+++ b/testsuite/systemtap.maps/linear_under.stp
@@ -0,0 +1,22 @@
+# test of histogram where all the values are
+# under the start of the histogram
+
+global agg
+
+probe begin
+{
+ # Add items to the aggregate
+ for (key=0; key < 100; key++) {
+ agg <<< key
+ }
+
+ printf("count=%d\n", @count(agg))
+ printf("sum=%d\n", @sum(agg))
+ printf("min=%d\n", @min(agg))
+ printf("max=%d\n", @max(agg))
+ printf("avg=%d\n", @avg(agg))
+
+ print(@hist_linear(agg, 1800, 2500, 100))
+
+ exit()
+}