summaryrefslogtreecommitdiffstats
path: root/testsuite/lib/systemtap.exp
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-02-20 12:25:59 -0500
committerDave Brolley <brolley@redhat.com>2009-02-20 12:25:59 -0500
commit72629a44d453ddbdaec22a680b207e96a5e19ec3 (patch)
tree8d2e02c4bb111dd09e1f87703185cd71f897b05e /testsuite/lib/systemtap.exp
parent49e34da0845cf50fdffa955ed6620b8e97b92872 (diff)
downloadsystemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.tar.gz
systemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.tar.xz
systemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.zip
New basic tests for client/server.
Diffstat (limited to 'testsuite/lib/systemtap.exp')
-rw-r--r--testsuite/lib/systemtap.exp100
1 files changed, 56 insertions, 44 deletions
diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp
index 5bf125b9..9dea8a89 100644
--- a/testsuite/lib/systemtap.exp
+++ b/testsuite/lib/systemtap.exp
@@ -37,7 +37,7 @@ proc print_systemtap_version {} {
proc setup_systemtap_environment {} {
- global srcdir prefix env server_pid net_path
+ global srcdir env
# need an absolute SRCDIR for the top-level src/ tree
# XXX: or, we could change nearby uses of ${SRCDIR}/testsuite to ${SRCDIR}
@@ -53,40 +53,7 @@ proc setup_systemtap_environment {} {
# Find or start a systemtap server, if requested.
if {[use_server_p]} then {
- print "Testing using a systemtap server"
-
- # A place for some temporary files and scripts.
- set net_path [exec pwd]/net
- exec /bin/mkdir -p $net_path
-
- # Server management scripts and data are installed if this is an
- # install test, otherwise there is some setup to do.
- if {! [installtest_p]} then {
- # Make sure the server management scripts and tools are on the $PATH.
- set env(PATH) "$srcdir/..:[exec pwd]/..:$env(PATH)"
- }
-
- # Try to find or start the server.
- set server_pid [exec stap-find-or-start-server]
- if { "$server_pid" == "-1" } then {
- print "Cannot find or start a systemtap server"
- set server_pid 0
- # TODO: How do we abort here?
- } elseif { "$server_pid" == "0" } then {
- print "A compatible systemtap server is already available"
- } else {
- print "Started a systemtap server as PID==$server_pid"
- }
-
- # Make a copy of 'stap-client' as 'stap' and make sure it's at the
- # beginning of the $PATH. Do this after starting the server so that
- # The server does not call this instance of 'stap'
- if {[installtest_p]} then {
- exec /bin/cp -p [exec which stap-client] $net_path/stap
- } else {
- exec /bin/cp -p $srcdir/../stap-client $net_path/stap
- }
- set env(PATH) "$net_path:$env(PATH)"
+ setup_server
}
# PATH, SYSTEMTAP_TAPSET, SYSTEMTAP_RUNTIME, LD_LIBRARY_PATH are already set.
@@ -97,6 +64,59 @@ proc setup_systemtap_environment {} {
}
}
+# Set up the environment so that tests will be performed using the systemtap
+# client and server.
+proc setup_server {} {
+ global srcdir env server_pid net_path
+
+ print "Testing using a systemtap server"
+
+ # A place for some temporary files and scripts.
+ set net_path [exec pwd]/net
+ exec /bin/mkdir -p $net_path
+
+ # Server management scripts and data are installed if this is an
+ # install test, otherwise there is some setup to do.
+ if {! [installtest_p]} then {
+ # Make sure the server management scripts and tools are on the $PATH.
+ set env(PATH) "$srcdir/..:[exec pwd]/..:$env(PATH)"
+ }
+
+ # Try to find or start the server.
+ set server_pid [exec stap-find-or-start-server]
+ if { "$server_pid" == "-1" } then {
+ print "Cannot find or start a systemtap server"
+ set server_pid 0
+ # TODO: How do we abort here?
+ } elseif { "$server_pid" == "0" } then {
+ print "A compatible systemtap server is already available"
+ } else {
+ print "Started a systemtap server as PID==$server_pid"
+ }
+
+ # Make a copy of 'stap-client' as 'stap' and make sure it's at the
+ # beginning of the $PATH. Do this after starting the server so that
+ # The server does not call this instance of 'stap'
+ if {[installtest_p]} then {
+ exec /bin/cp -p [exec which stap-client] $net_path/stap
+ } else {
+ exec /bin/cp -p $srcdir/../stap-client $net_path/stap
+ }
+ set env(PATH) "$net_path:$env(PATH)"
+}
+
+proc shutdown_server {} {
+ global server_pid net_path
+
+ if { $server_pid != 0 } then {
+ print "Stopping the systemtap server with PID==$server_pid"
+ exec stap-stop-server $server_pid
+ }
+
+ # Remove the temporary stap script
+ exec /bin/rm -fr $net_path
+}
+
proc get_system_info {} {
global Host Snapshot Distro env
@@ -124,17 +144,9 @@ proc systemtap_init {args} {}
proc systemtap_version {} {}
proc systemtap_exit {} {
- global server_pid net_path
-
# Stop the stap server, if we started it.
if {[use_server_p]} then {
- if { $server_pid != 0 } then {
- print "Stopping the systemtap server with PID==$server_pid"
- exec stap-stop-server $server_pid
- }
-
- # Remove the temporary stap script
- exec /bin/rm -fr $net_path
+ shutdown_server
}
}