]> sourceware.org Git - systemtap.git/commitdiff
2007-10-25 Martin Hunt <hunt@redhat.com>
authorhunt <hunt>
Thu, 25 Oct 2007 22:22:16 +0000 (22:22 +0000)
committerhunt <hunt>
Thu, 25 Oct 2007 22:22:16 +0000 (22:22 +0000)
* systemtap.printf/print_char.*: New test.
* systemtap.printf/print.*: New test.
* systemtap.printf/println.*: New test.

* systemtap.maps/elision.*: New tests.

* config/unix.exp: Added stap_run_exact.
* lib/stap_run_exact.exp: New. Like stap_run2 but
takes a seperate test name.

testsuite/ChangeLog
testsuite/config/unix.exp
testsuite/lib/stap_run_exact.exp [new file with mode: 0644]
testsuite/systemtap.maps/elision.exp [new file with mode: 0755]
testsuite/systemtap.maps/elision.stp [new file with mode: 0644]
testsuite/systemtap.printf/print.exp [new file with mode: 0644]
testsuite/systemtap.printf/print.stp [new file with mode: 0644]
testsuite/systemtap.printf/print_char.exp [new file with mode: 0644]
testsuite/systemtap.printf/print_char.stp [new file with mode: 0644]
testsuite/systemtap.printf/println.exp [new file with mode: 0644]
testsuite/systemtap.printf/println.stp [new file with mode: 0644]

index 69ee365e2d3b8c576bc273c886e84efa154408c2..c5e4f8f0ce7cc5e5f4c18927ae218d0de0ef90d9 100644 (file)
@@ -1,5 +1,17 @@
 2007-10-25  Martin Hunt  <hunt@redhat.com>
 
+       * systemtap.printf/print_char.*: New test. 
+       * systemtap.printf/print.*: New test.
+       * systemtap.printf/println.*: New test.
+       
+       * systemtap.maps/elision.*: New tests.
+
+       * config/unix.exp: Added stap_run_exact.
+       * lib/stap_run_exact.exp: New. Like stap_run2 but
+       takes a seperate test name. 
+
+2007-10-25  Martin Hunt  <hunt@redhat.com>
+       
        * systemtap.printf/printd.stp: New
        * systemtap.printf/printdln.stp: New    
 
index b3be70f536bb232545fca7a69417a8ece8ba128a..625c5604e74ee053c9e6c90a3588819ae5ec496e 100644 (file)
@@ -1,4 +1,5 @@
 load_lib "systemtap.exp"
 load_lib "stap_run2.exp"
+load_lib "stap_run_exact.exp"
 load_lib "stap_run_binary.exp"
 load_lib "stap_run.exp"
diff --git a/testsuite/lib/stap_run_exact.exp b/testsuite/lib/stap_run_exact.exp
new file mode 100644 (file)
index 0000000..6a47379
--- /dev/null
@@ -0,0 +1,30 @@
+# stap_run_exact.exp
+#
+# Simple script for testing multiple lines of exact output.
+    
+# stap_run_exact TEST_NAME filename args
+# TEST_NAME is the name printed
+# filename is path to the current test
+# Additional arguments are passed to stap as-is.
+#
+# global result_string must be set to the expected output
+
+proc stap_run_exact { TEST_NAME test_file_name args } {
+    if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return }
+    
+    set cmd [concat stap $args $test_file_name]
+    catch {eval exec $cmd} res
+
+    set n 0
+    set expected [split $::result_string "\n"]
+    foreach line [split $res "\n"] {
+       if {![string equal $line [lindex $expected $n]]} {
+           fail "$TEST_NAME"
+           send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\"\n"
+           send_log "Got \"$line\"\n"
+           return
+       }
+       incr n
+    }
+    pass "$TEST_NAME"
+}
diff --git a/testsuite/systemtap.maps/elision.exp b/testsuite/systemtap.maps/elision.exp
new file mode 100755 (executable)
index 0000000..60c52bb
--- /dev/null
@@ -0,0 +1,397 @@
+# test elision of zero buckets in histograms
+
+set myresults(-1) {value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |                                                   0
+  550 |                                                   0
+  600 |                                                   0
+  650 |                                                   0
+  700 |                                                   0
+  750 |                                                   0
+  800 |                                                   0
+  850 |                                                   0
+  900 |                                                   0
+  950 |@                                                  1
+ 1000 |                                                   0
+ 1050 |                                                   0
+
+value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |@                                                  1
+  550 |                                                   0
+  600 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+   50 |                                                   0
+  100 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |                                                   0
+   50 |@                                                  1
+  100 |                                                   0
+  150 |                                                   0
+
+value |-------------------------------------------------- count
+ 1350 |                                                   0
+ 1400 |                                                   0
+ 1450 |@                                                  1
+ 1500 |                                                   0
+
+value |-------------------------------------------------- count
+ 1400 |                                                   0
+ 1450 |                                                   0
+ 1500 |@                                                  1
+
+value |-------------------------------------------------- count
+  -30 |                                                   0
+  -20 |                                                   0
+  -10 |@                                                  1
+    0 |                                                   0
+   10 |                                                   0
+
+value |-------------------------------------------------- count
+  -20 |                                                   0
+  -10 |                                                   0
+    0 |@                                                  1
+   10 |                                                   0
+   20 |                                                   0
+
+value |-------------------------------------------------- count
+   32 |                                                   0
+   64 |                                                   0
+  128 |@                                                  1
+  256 |                                                   0
+  512 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+    1 |                                                   0
+    2 |                                                   0
+
+ value |-------------------------------------------------- count
+-16384 |                                                   0
+ -8192 |                                                   0
+ -4096 |@                                                  1
+ -2048 |                                                   0
+ -1024 |                                                   0
+  -512 |                                                   0
+  -256 |                                                   0
+  -128 |                                                   0
+   -64 |                                                   0
+   -32 |                                                   0
+   -16 |                                                   0
+    -8 |                                                   0
+    -4 |                                                   0
+    -2 |@                                                  1
+    -1 |                                                   0
+     0 |                                                   0
+
+}
+set myresults(0) {value |-------------------------------------------------- count
+      ~
+  400 |@                                                  1
+      ~
+  950 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+  400 |@                                                  1
+      ~
+  500 |@                                                  1
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+   50 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+ 1450 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+ 1500 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+  -10 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+    0 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+  128 |@                                                  1
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+
+ value |-------------------------------------------------- count
+       ~
+ -4096 |@                                                  1
+       ~
+    -2 |@                                                  1
+
+}
+set myresults(1) {value |-------------------------------------------------- count
+      ~
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+      ~
+  900 |                                                   0
+  950 |@                                                  1
+ 1000 |                                                   0
+
+value |-------------------------------------------------- count
+      ~
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |@                                                  1
+  550 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+   50 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |                                                   0
+   50 |@                                                  1
+  100 |                                                   0
+
+value |-------------------------------------------------- count
+      ~
+ 1400 |                                                   0
+ 1450 |@                                                  1
+ 1500 |                                                   0
+
+value |-------------------------------------------------- count
+      ~
+ 1450 |                                                   0
+ 1500 |@                                                  1
+
+value |-------------------------------------------------- count
+      ~
+  -20 |                                                   0
+  -10 |@                                                  1
+    0 |                                                   0
+
+value |-------------------------------------------------- count
+      ~
+  -10 |                                                   0
+    0 |@                                                  1
+   10 |                                                   0
+
+value |-------------------------------------------------- count
+      ~
+   64 |                                                   0
+  128 |@                                                  1
+  256 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+    1 |                                                   0
+
+ value |-------------------------------------------------- count
+       ~
+ -8192 |                                                   0
+ -4096 |@                                                  1
+ -2048 |                                                   0
+       ~
+    -4 |                                                   0
+    -2 |@                                                  1
+    -1 |                                                   0
+
+}
+set myresults(2) {value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |                                                   0
+      ~
+  850 |                                                   0
+  900 |                                                   0
+  950 |@                                                  1
+ 1000 |                                                   0
+ 1050 |                                                   0
+
+value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |@                                                  1
+  550 |                                                   0
+  600 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+   50 |                                                   0
+  100 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |                                                   0
+   50 |@                                                  1
+  100 |                                                   0
+  150 |                                                   0
+
+value |-------------------------------------------------- count
+ 1350 |                                                   0
+ 1400 |                                                   0
+ 1450 |@                                                  1
+ 1500 |                                                   0
+
+value |-------------------------------------------------- count
+ 1400 |                                                   0
+ 1450 |                                                   0
+ 1500 |@                                                  1
+
+value |-------------------------------------------------- count
+  -30 |                                                   0
+  -20 |                                                   0
+  -10 |@                                                  1
+    0 |                                                   0
+   10 |                                                   0
+
+value |-------------------------------------------------- count
+  -20 |                                                   0
+  -10 |                                                   0
+    0 |@                                                  1
+   10 |                                                   0
+   20 |                                                   0
+
+value |-------------------------------------------------- count
+   32 |                                                   0
+   64 |                                                   0
+  128 |@                                                  1
+  256 |                                                   0
+  512 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+    1 |                                                   0
+    2 |                                                   0
+
+ value |-------------------------------------------------- count
+-16384 |                                                   0
+ -8192 |                                                   0
+ -4096 |@                                                  1
+ -2048 |                                                   0
+ -1024 |                                                   0
+       ~
+    -8 |                                                   0
+    -4 |                                                   0
+    -2 |@                                                  1
+    -1 |                                                   0
+     0 |                                                   0
+
+}
+set myresults(3) {value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |                                                   0
+  550 |                                                   0
+      ~
+  800 |                                                   0
+  850 |                                                   0
+  900 |                                                   0
+  950 |@                                                  1
+ 1000 |                                                   0
+ 1050 |                                                   0
+
+value |-------------------------------------------------- count
+  300 |                                                   0
+  350 |                                                   0
+  400 |@                                                  1
+  450 |                                                   0
+  500 |@                                                  1
+  550 |                                                   0
+  600 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+   50 |                                                   0
+  100 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |                                                   0
+   50 |@                                                  1
+  100 |                                                   0
+  150 |                                                   0
+
+value |-------------------------------------------------- count
+ 1350 |                                                   0
+ 1400 |                                                   0
+ 1450 |@                                                  1
+ 1500 |                                                   0
+
+value |-------------------------------------------------- count
+ 1400 |                                                   0
+ 1450 |                                                   0
+ 1500 |@                                                  1
+
+value |-------------------------------------------------- count
+  -30 |                                                   0
+  -20 |                                                   0
+  -10 |@                                                  1
+    0 |                                                   0
+   10 |                                                   0
+
+value |-------------------------------------------------- count
+  -20 |                                                   0
+  -10 |                                                   0
+    0 |@                                                  1
+   10 |                                                   0
+   20 |                                                   0
+
+value |-------------------------------------------------- count
+   32 |                                                   0
+   64 |                                                   0
+  128 |@                                                  1
+  256 |                                                   0
+  512 |                                                   0
+
+value |-------------------------------------------------- count
+    0 |@                                                  1
+    1 |                                                   0
+    2 |                                                   0
+
+ value |-------------------------------------------------- count
+-16384 |                                                   0
+ -8192 |                                                   0
+ -4096 |@                                                  1
+ -2048 |                                                   0
+ -1024 |                                                   0
+  -512 |                                                   0
+       ~
+   -16 |                                                   0
+    -8 |                                                   0
+    -4 |                                                   0
+    -2 |@                                                  1
+    -1 |                                                   0
+     0 |                                                   0
+
+}
+
+
+for {set i -1} { $i < 4} {incr i} {
+    set test "elision-$i"
+    set ::result_string $myresults($i)
+    stap_run_exact "elision$i" $srcdir/$subdir/elision.stp -DHIST_ELISION=$i
+}
+
+
diff --git a/testsuite/systemtap.maps/elision.stp b/testsuite/systemtap.maps/elision.stp
new file mode 100644 (file)
index 0000000..e903f56
--- /dev/null
@@ -0,0 +1,54 @@
+# test that we can check the count of an empty array
+
+global a,b,c
+
+probe begin
+{
+       a <<< 444
+       a <<< 999
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       a <<< 444
+       a <<< 500
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       a <<< 0
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       a <<< 50
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       a <<< 1450
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       a <<< 1500
+        print(@hist_linear(a, 0, 1500, 50))
+       delete a
+
+       b <<< -10
+        print(@hist_linear(b, -100, 100, 10))
+       delete b
+
+       b <<< 0
+        print(@hist_linear(b, -100, 100, 10))
+       delete b
+
+       c <<< 128
+       print(@hist_log(c))
+       delete c
+
+       c <<< 0
+       print(@hist_log(c))
+       delete c
+
+       c <<< -2
+       c <<< -4096
+       print(@hist_log(c))
+
+       exit()
+}
diff --git a/testsuite/systemtap.printf/print.exp b/testsuite/systemtap.printf/print.exp
new file mode 100644 (file)
index 0000000..3a4de52
--- /dev/null
@@ -0,0 +1,18 @@
+set test "print"
+set ::result_string {hello world
+777
+hello world
+hello world
+foo
+foobar
+foobar
+foobar
+foo99
+99foo
+777
+888
+123456789
+hello999
+999hello
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/print.stp b/testsuite/systemtap.printf/print.stp
new file mode 100644 (file)
index 0000000..ae77093
--- /dev/null
@@ -0,0 +1,47 @@
+# test the print function with string and integers,
+# variables and constants.
+
+probe begin {
+       a = "hello"
+       b = " "
+       c = "world"
+       d = 777
+
+       # print variables
+       print(a)
+       print(b)
+       print(c)
+       print("\n")
+
+       print(d)
+       print("\n")
+       
+       print(a,b,c,"\n")
+       print(a.b.c."\n")
+
+       # print literals
+       print("foo")
+       print("\n")
+
+       print("foo")
+       print("bar")
+       print("\n")
+
+       print("foo","bar","\n")
+       print("foo"."bar"."\n")
+
+       print("foo",99,"\n")
+       print(99, "foo","\n")
+       
+       print(777)
+       print("\n")
+       print(888,"\n")
+
+       print(123,456,789,"\n")
+
+       # mixed
+       print(a,999,"\n")
+       print(999,a,"\n")
+
+       exit()
+}
diff --git a/testsuite/systemtap.printf/print_char.exp b/testsuite/systemtap.printf/print_char.exp
new file mode 100644 (file)
index 0000000..bab056d
--- /dev/null
@@ -0,0 +1,5 @@
+set test "print_char"
+set ::result_string {ABC
+ABCDEFGHIJKLMNOPQRSTUVWXYZ
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/print_char.stp b/testsuite/systemtap.printf/print_char.stp
new file mode 100644 (file)
index 0000000..0900fe1
--- /dev/null
@@ -0,0 +1,16 @@
+# test the print_char function
+
+probe begin {
+       endl = 10
+       print_char(65)
+       print_char(66)
+       print_char(67)
+       print_char(endl)
+
+       for (i = 65; i < 91; i++)
+               print_char(i)
+       print_char(endl)
+
+       
+       exit()
+}
diff --git a/testsuite/systemtap.printf/println.exp b/testsuite/systemtap.printf/println.exp
new file mode 100644 (file)
index 0000000..8deba53
--- /dev/null
@@ -0,0 +1,18 @@
+set test "println"
+set ::result_string {hello
+world
+777
+hello world
+hello world
+foo
+foobar
+foobar
+777
+foo99
+99foo
+123456789
+hello999
+999hello
+}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/println.stp b/testsuite/systemtap.printf/println.stp
new file mode 100644 (file)
index 0000000..0b02f0a
--- /dev/null
@@ -0,0 +1,37 @@
+# test the println function with string and integers,
+# variables and constants.
+
+probe begin {
+       a = "hello"
+       b = " "
+       c = "world"
+       d = 777
+
+       # println variables
+       println(a)
+       println(b)
+       println(c)
+
+       println(d)
+       
+       println(a,b,c)
+       println(a.b.c)
+
+       # println literals
+       println("foo")
+
+       println("foo","bar")
+       println("foo"."bar")
+
+       println(777)
+       println("foo",99)
+       println(99, "foo")
+       
+       println(123,456,789)
+
+       # mixed
+       println(a,999)
+       println(999,a)
+
+       exit()
+}
This page took 0.050067 seconds and 5 git commands to generate.