summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/bench.exp2
-rw-r--r--testsuite/systemtap.base/global_end.exp23
-rw-r--r--testsuite/systemtap.base/global_end.stp30
-rw-r--r--testsuite/systemtap.base/optim_arridx.exp40
-rw-r--r--testsuite/systemtap.base/optim_arridx.stp6
5 files changed, 88 insertions, 13 deletions
diff --git a/testsuite/systemtap.base/bench.exp b/testsuite/systemtap.base/bench.exp
index 4863a00c..72864292 100644
--- a/testsuite/systemtap.base/bench.exp
+++ b/testsuite/systemtap.base/bench.exp
@@ -11,4 +11,4 @@ expect {
eof { }
}
wait
-if {$ok == 15} { pass "$test ($ok)" } { fail "$test ($ok)" }
+if {$ok == 18} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp
new file mode 100644
index 00000000..b1931a90
--- /dev/null
+++ b/testsuite/systemtap.base/global_end.exp
@@ -0,0 +1,23 @@
+# test end probe creation and display of written and unread global variables
+
+set test "global_end"
+
+if {![installtest_p]} {untested $test; return}
+
+spawn stap $srcdir/$subdir/global_end.stp
+set ok 0
+expect {
+ -timeout 180
+ -re {one,0x1.*one,0x2.*two,0x1.*two,0x2} { incr ok; exp_continue }
+ -re {alpha."one"..1.=0x1} { incr ok; exp_continue }
+ -re {alpha."one"..2.=0x2} { incr ok; exp_continue }
+ -re {alpha."two"..1.=0x3} { incr ok; exp_continue }
+ -re {alpha."two"..2.=0x4} { incr ok; exp_continue }
+ -re {gamma="abcdefghijklmnopqrstuvwxyz"} { incr ok; exp_continue }
+ -re {iota."one".="eleven"} { incr ok; exp_continue }
+ -re {iota."two".="twelve"} { incr ok; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+wait
+if {$ok == 8} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp
new file mode 100644
index 00000000..e9a1eb8f
--- /dev/null
+++ b/testsuite/systemtap.base/global_end.stp
@@ -0,0 +1,30 @@
+global alpha, beta, gamma, iota
+
+probe begin {
+ gamma = "abcdefghijklmnopqrstuvwxyz"
+
+ iota["one"] = "eleven"
+ iota["two"] = "twelve"
+
+ alpha["one",1] = 1
+ alpha["one",2] = 2
+ alpha["two",1] = 3
+ alpha["two",2] = 4
+
+ beta["one",1] = 1
+ beta["one",2] = 2
+ beta["two",1] = 3
+ beta["two",2] = 4
+}
+
+probe timer.ms(2000) {
+ exit ()
+}
+
+probe end {
+foreach ([i,j] in beta)
+ printf("[%#s,%#x]=%#x ", i, j, beta[i,j])
+print("\n")
+exit()
+}
+
diff --git a/testsuite/systemtap.base/optim_arridx.exp b/testsuite/systemtap.base/optim_arridx.exp
index f4308db5..89282d1b 100644
--- a/testsuite/systemtap.base/optim_arridx.exp
+++ b/testsuite/systemtap.base/optim_arridx.exp
@@ -5,11 +5,14 @@ set ::result_string {# globals
arr1:long [long, long]
arr2:long [long]
arr3:long [long]
+elide_idx1:long
+elide_global_a:long
+elide_global_b:long
# functions
fna:long (a:long)
return a
fnb:long (a:long, b:long)
-return ((a) + (b)) + (printf(""))
+return (a) + (b)
exit:unknown ()
%{
atomic_set (&session_state, STAP_SESSION_STOPPING);
@@ -23,33 +26,52 @@ begin /* <- begin */
k:long
b:long
m:long
- arr1:long [long]
- arr2:long [long, long]
aa:long
bb:long
cc:long
dd:long
ee:long
{
+(arr2[(elide_idx1) = (1)]) = (10)
(arr2[(idx2) = (2)]) = (20)
+(arr2[3]) = (30)
(arr2[(j) = (4)]) = (40)
(arr1[fna((k) = (0)), k]) = (1)
(arr1[(b) = (1), b]) = (2)
-fnb((arr3[0]) = (4), arr3[0])
+(arr1[2, 2]) = (3)
+(arr3[0]) = (4)
(m) = (1)
-for (2; (m) <= (10); (m)++) ;
-printf("%d %d %d %d\\n", arr1[0], arr2[0, 0], idx2, j)
+for (2; (m) <= (10); (m)++) (arr2[m]) = ((m) * (10))
+printf("%d %d %d %d\\n", arr1[0, 0], arr2[0], idx2, j)
(aa) = (fna(1))
-(bb) = (fnb((cc) = (1), 2))
+(bb) = (fnb((cc) = (1), (elide_global_a) = (2)))
for (1; (bb) < (10); (bb)++) (cc) += (bb)
for ((dd) = (1); (dd) < (10); 1) (dd) += (1)
-if (1) (ee) = (1)
+if ((elide_global_b) = (1)) (ee) = (1)
(cc) = ((dd) = (5))
(cc) = ((4) + ((cc) = (1)))
-printf("%d %d %d %d %d", aa, bb, cc, dd, ee)
+printf("%d %d %d %d %d\\n", aa, bb, cc, dd, ee)
exit()
}
+end /* <- end */
+ # locals
+ idx0:long
+{
+foreach ([idx0] in arr3) printf("arr3[%#d]=%#x\\n", idx0, arr3[idx0])
+}
+end /* <- end */
+{
+printf("elide_idx1=%#x\\n", elide_idx1)
+}
+end /* <- end */
+{
+printf("elide_global_a=%#x\\n", elide_global_a)
+}
+end /* <- end */
+{
+printf("elide_global_b=%#x\\n", elide_global_b)
+}
}
proc optim_arridx_run { TEST_NAME args } {
diff --git a/testsuite/systemtap.base/optim_arridx.stp b/testsuite/systemtap.base/optim_arridx.stp
index 3e4f8fd2..5c9c1051 100644
--- a/testsuite/systemtap.base/optim_arridx.stp
+++ b/testsuite/systemtap.base/optim_arridx.stp
@@ -1,7 +1,7 @@
global arr1, arr2, arr3, elide_idx1, elide_global_a, elide_global_b
function fna(a:long) {return a}
-function fnb(a:long, b:long) {return a+b+printf("")}
+function fnb(a:long, b:long) {return a+b}
probe begin {
// array indices
@@ -16,7 +16,7 @@ probe begin {
m = 1
for (elide_n=2; m <= 10; m++)
arr2[m] = m * 10
- printf ("%d %d %d %d\n", arr1[0], arr2[0,0], idx2, j)
+ printf ("%d %d %d %d\n", arr1[0,0], arr2[0], idx2, j)
// function args
aa = fna(elide_aa = 1)
@@ -40,6 +40,6 @@ probe begin {
// binary expression
cc = ((elide_hh = 4) + (cc = 1))
- printf("%d %d %d %d %d", aa, bb, cc, dd, ee)
+ printf("%d %d %d %d %d\n", aa, bb, cc, dd, ee)
exit ()
}