diff options
-rw-r--r-- | testsuite/systemtap.context/context.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.context/pid.stp | 15 | ||||
-rw-r--r-- | testsuite/systemtap.context/pid.tcl | 54 |
3 files changed, 70 insertions, 1 deletions
diff --git a/testsuite/systemtap.context/context.exp b/testsuite/systemtap.context/context.exp index f4b34fba..858596d9 100644 --- a/testsuite/systemtap.context/context.exp +++ b/testsuite/systemtap.context/context.exp @@ -1,4 +1,4 @@ -set testlist {backtrace args} +set testlist {backtrace args pid} if {![installtest_p]} { foreach test $testlist { diff --git a/testsuite/systemtap.context/pid.stp b/testsuite/systemtap.context/pid.stp new file mode 100644 index 00000000..41833273 --- /dev/null +++ b/testsuite/systemtap.context/pid.stp @@ -0,0 +1,15 @@ +probe module("systemtap_test_module2").function("yyy_int") { + printf("execname: %s\n", execname()) + printf("pexecname: %s\n", pexecname()) + printf("pid: %d\n", pid()) + printf("ppid: %d\n", ppid()) + printf("tid: %d\n", tid()) + printf("uid: %d\n", uid()) + printf("euid: %d\n", euid()) + printf("gid: %d\n", gid()) + printf("egid: %d\n", egid()) + exit() +} +probe begin { + printf("READY\n") +} diff --git a/testsuite/systemtap.context/pid.tcl b/testsuite/systemtap.context/pid.tcl new file mode 100644 index 00000000..36ee6b9c --- /dev/null +++ b/testsuite/systemtap.context/pid.tcl @@ -0,0 +1,54 @@ +spawn stap pid.stp +expect { + -timeout 240 + "READY" { + set pid [exec echo 1 > /proc/stap_test_cmd &] + set uid [exec id -ru] + set gid [exec id -rg] + set euid [exec id -u] + set egid [exec id -g] + expect { + -timeout 5 + "execname: echo\r\n" { + pass "execname" + exp_continue + } + "pexecname: expect\r\n" { + pass "pexecname" + exp_continue + } + "pid: $pid\r\n" { + pass "pid" + exp_continue + } + -re {ppid: [^\r\n]+\r\n} { + pass "ppid" + exp_continue + } + "tid: $pid\r\n" { + pass "tid" + exp_continue + } + "uid: $uid\r\n" { + pass "uid" + exp_continue + } + "euid: $euid\r\n" { + pass "euid" + exp_continue + } + "gid: $gid\r\n" { + pass "gid" + exp_continue + } + "egid: $egid\r\n" { + pass "egid" + exp_continue + } + eof {} + } + } + eof {} +} +catch {close} +wait |