diff options
author | wcohen <wcohen> | 2008-01-07 21:12:53 +0000 |
---|---|---|
committer | wcohen <wcohen> | 2008-01-07 21:12:53 +0000 |
commit | 14b31996a7752ab19f1b9017c65742c866394c1e (patch) | |
tree | 5b3fb62b169ca06f9c7bb380a1fe032ebcfc4ab7 /testsuite/lib/systemtap.exp | |
parent | b5121873c8e4cf5c89105d93b76c1fe7c8f10811 (diff) | |
download | systemtap-steved-14b31996a7752ab19f1b9017c65742c866394c1e.tar.gz systemtap-steved-14b31996a7752ab19f1b9017c65742c866394c1e.tar.xz systemtap-steved-14b31996a7752ab19f1b9017c65742c866394c1e.zip |
2008-01-07 William Cohen <wcohen@redhat.com>
* testsuite/lib/systemtap.exp (as_root): new proc.
* testsuite/systemtap.context/context.exp:
* testsuite/systemtap.printf/end1b.exp:
* testsuite/systemtap.printf/mixed_outb.exp:
* testsuite/systemtap.printf/out1b.exp:
* testsuite/systemtap.printf/out2b.exp:
* testsuite/systemtap.printf/out3b.exp: Use as_root proc.
Diffstat (limited to 'testsuite/lib/systemtap.exp')
-rw-r--r-- | testsuite/lib/systemtap.exp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp index 7fb1e317..3b66b05a 100644 --- a/testsuite/lib/systemtap.exp +++ b/testsuite/lib/systemtap.exp @@ -111,3 +111,14 @@ proc stap_run_batch {args} { return [lindex $results 3] } } + +proc as_root { command } { + + set effective_pid [exec /usr/bin/id -u] + + if {$effective_pid != 0} { + set command "sudo $command" + } + set res [catch {eval exec $command} value] + return $res + } |