summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/cmd_parse.exp48
-rw-r--r--testsuite/systemtap.base/global_end.exp3
-rw-r--r--testsuite/systemtap.base/global_end.stp7
-rw-r--r--testsuite/systemtap.base/uprobes.exp36
-rwxr-xr-xtestsuite/systemtap.base/uprobes.stp3
5 files changed, 67 insertions, 30 deletions
diff --git a/testsuite/systemtap.base/cmd_parse.exp b/testsuite/systemtap.base/cmd_parse.exp
index c37d358f..733881a1 100644
--- a/testsuite/systemtap.base/cmd_parse.exp
+++ b/testsuite/systemtap.base/cmd_parse.exp
@@ -5,76 +5,68 @@ if {![installtest_p]} {
return
}
-# stap -c 'echo "hello world"' -e 'probe begin {}'
-spawn stap -c {echo "hello world"} -e {probe begin {}}
+spawn stap -c {echo "hello world"} -we {probe begin {}}
expect {
-timeout 60
"hello world" {pass "cmd_parse1"}
timeout {fail "cmd_parse1: unexpected timeout"}
eof {fail "cmd_parse1: unexpected EOF"}
}
-wait
+wait;close
-# stap -c 'echo "hello "\"world\"' -e 'probe begin {}'
-spawn stap -c {echo "hello "\"world\"} -e {probe begin {}}
+spawn stap -c {echo "hello "\"world\"} -we {probe begin {}}
expect {
-timeout 60
"hello \"world\"" {pass "cmd_parse2"}
timeout {fail "cmd_parse2: unexpected timeout"}
eof {fail "cmd_parse2: unexpected EOF"}
}
-wait
+wait;close
-#stap -c '(a="hello world"; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello world"; echo $a)} -e {probe begin {}}
+spawn stap -c {sh -c '(a="hello world"; echo $a)'} -we {probe begin {}}
expect {
-timeout 60
"hello world" {pass "cmd_parse3"}
timeout {fail "cmd_parse3: unexpected timeout"}
eof {fail "cmd_parse3: unexpected EOF"}
}
-wait
+wait;close
-#stap -c '(a="hello "\"world\"; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello "\"world\"; echo $a)} -e {probe begin {}}
+spawn stap -c {sh -c '(a="hello "\"world\"; echo $a)'} -we {probe begin {}}
expect {
-timeout 60
"hello \"world\"" {pass "cmd_parse4"}
timeout {fail "cmd_parse4: unexpected timeout"}
eof {fail "cmd_parse4: unexpected EOF"}
}
-wait
+wait;close
-#stap -c '(a="hello "world; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello "world; echo $a)} -e {probe begin {}}
+spawn stap -c {sh -c '(a="hello "world; echo $a)'} -we {probe begin {}}
expect {
-timeout 60
"hello world" {pass "cmd_parse5"}
timeout {fail "cmd_parse5: unexpected timeout"}
eof {fail "cmd_parse5: unexpected EOF"}
}
-wait
+wait;close
-#stap -c '(((a=42+7)); echo "The answer is $a")' -e 'probe begin {}'
-# NB: not ((a=42+7)) - must not assume bash
-spawn stap -c {(a=49; echo "The answer is $a")} -e {probe begin {}}
+spawn stap -c {bash -c '((a=42+7)); echo "The answer is $a"'} -we {probe begin {}}
expect {
-timeout 60
"The answer is 49" {pass "cmd_parse6"}
timeout {fail "cmd_parse6: unexpected timeout"}
eof {fail "cmd_parse6: unexpected EOF"}
}
-wait
+wait;close
-#stap -c '(echo "Hello World" 1>&2) > /dev/null' -e 'probe begin {}'
-spawn stap -c {(echo "Hello World" 1>&2) > /dev/null} -e {probe begin {}}
+spawn stap -c {sh -c '(echo "Hello World" 1>&2) > /dev/null'} -we {probe begin {}}
expect {
-timeout 60
"Hello World" {pass "cmd_parse7"}
timeout {fail "cmd_parse7: unexpected timeout"}
eof {fail "cmd_parse7: unexpected EOF"}
}
-wait
+wait;close
spawn stap -l {vm.*}
expect {
@@ -83,7 +75,7 @@ expect {
timeout {fail "cmd_parse8: unexpected timeout"}
eof {fail "cmd_parse8: unexpected EOF"}
}
-wait
+wait;close
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1
expect {
@@ -92,7 +84,7 @@ expect {
timeout { fail "cmd_parse9 timeout" }
eof { fail "cmd_parse9 eof" }
}
-wait
+wait;close
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d
expect {
@@ -101,7 +93,7 @@ expect {
timeout { fail "cmd_parse10 timeout" }
eof { fail "cmd_parse10 eof" }
}
-wait
+wait;close
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d
expect {
@@ -110,7 +102,7 @@ expect {
timeout { fail "cmd_parse11 timeout" }
eof { fail "cmd_parse11 eof" }
}
-wait
+wait;close
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }}
expect {
@@ -119,7 +111,7 @@ expect {
timeout { fail "cmd_parse12 timeout" }
eof { fail "cmd_parse12 eof" }
}
-wait
+wait;close
spawn stap -L syscall.a*
expect {
@@ -128,4 +120,4 @@ expect {
timeout {fail "cmd_parse13: unexpected timeout"}
eof {fail "cmd_parse13: unexpected EOF"}
}
-wait
+wait;close
diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp
index d066cf9d..cd5c6f83 100644
--- a/testsuite/systemtap.base/global_end.exp
+++ b/testsuite/systemtap.base/global_end.exp
@@ -18,8 +18,9 @@ expect {
-re {iota."two".="twelve"} { incr ok; exp_continue }
-re {epsilon."one",1. @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue }
-re {epsilon."two",2. @count=0x4 @min=0xa @max=0x28 @sum=0x64 @avg=0x19} { incr ok; exp_continue }
+ -re {phi @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
wait
-if {$ok == 10} { pass "$test ($ok)" } { fail "$test ($ok)" }
+if {$ok == 11} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp
index b26b7c03..876eac8c 100644
--- a/testsuite/systemtap.base/global_end.stp
+++ b/testsuite/systemtap.base/global_end.stp
@@ -1,4 +1,4 @@
-global alpha, beta, gamma, iota, epsilon
+global alpha, beta, gamma, iota, epsilon, phi
probe begin {
gamma = "abcdefghijklmnopqrstuvwxyz"
@@ -16,6 +16,11 @@ probe begin {
beta["two",1] = 3
beta["two",2] = 4
+ phi <<< 1
+ phi <<< 2
+ phi <<< 3
+ phi <<< 4
+
epsilon["one",1] <<< 1
epsilon["one",1] <<< 2
epsilon["one",1] <<< 3
diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp
new file mode 100644
index 00000000..a0ae3e76
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes.exp
@@ -0,0 +1,36 @@
+
+
+set test uprobes
+
+# Compile a little C program to use as the user-space probing victim
+set path "jennie.c"
+set fp [open $path "w"]
+puts $fp "int main (int argc, char *argv[])"
+puts $fp "{"
+puts $fp "if (argc > 1) main (argc - 1, argv);"
+puts $fp "}"
+close $fp
+
+# too easy
+if [file exists $path] then { pass "$test prep" } else { fail "$test prep" }
+
+catch {exec gcc -g -o jennie jennie.c} err
+if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { pass "$test compile" }
+
+set rc [stap_run_batch $srcdir/$subdir/uprobes.stp]
+if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" }
+
+if {! [installtest_p]} { untested "$test -p5"; return }
+
+spawn sudo stap -v $srcdir/$subdir/uprobes.stp -c "./jennie 1 2 3 4"
+set ok 0
+expect {
+ -re {^Pass[^\r\n]*\r\n} { exp_continue }
+ -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*call[^\r\n]*\r\n} { incr ok; exp_continue }
+ -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*return[^\r\n]*\r\n} { incr ok; exp_continue }
+ -timeout 30
+ timeout { }
+ eof { }
+}
+if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
+catch {wait; close}
diff --git a/testsuite/systemtap.base/uprobes.stp b/testsuite/systemtap.base/uprobes.stp
new file mode 100755
index 00000000..d7efb586
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes.stp
@@ -0,0 +1,3 @@
+#! stap -p4
+probe process("./jennie").function("main").call { log(pp()." "/*.$$parms*/) }
+probe process("./jennie").function("main").return { log(pp()." "/*.$$return*/) }