diff options
author | Dave Brolley <brolley@redhat.com> | 2009-02-20 12:25:59 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-02-20 12:25:59 -0500 |
commit | 72629a44d453ddbdaec22a680b207e96a5e19ec3 (patch) | |
tree | 8d2e02c4bb111dd09e1f87703185cd71f897b05e | |
parent | 49e34da0845cf50fdffa955ed6620b8e97b92872 (diff) | |
download | systemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.tar.gz systemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.tar.xz systemtap-steved-72629a44d453ddbdaec22a680b207e96a5e19ec3.zip |
New basic tests for client/server.
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | stap-client | 4 | ||||
-rw-r--r-- | testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | testsuite/lib/systemtap.exp | 100 | ||||
-rw-r--r-- | testsuite/systemtap.server/server.exp | 40 |
5 files changed, 109 insertions, 46 deletions
@@ -1,3 +1,7 @@ +2009-02-20 ChangeLog <brolley@redhat.com> + + * stap-client: Redirect stderr to /dev/null when using kill. + 2009-02-19 Mark Wielaard <mjw@redhat.com> * translate.cxx (dump_unwindsyms): Ignore symbols before module diff --git a/stap-client b/stap-client index e2d95ada..70271b9a 100755 --- a/stap-client +++ b/stap-client @@ -1020,7 +1020,7 @@ function terminate { kill -s SIGTERM '%?staprun' 2>/dev/null # Kill any stap-client-connect job - kill -s SIGTERM '%${exec_prefix}stap-client-connect' + kill -s SIGTERM '%${exec_prefix}stap-client-connect' 2>/dev/null exit 1 } @@ -1037,7 +1037,7 @@ function interrupt { # Kill any stap-client-connect job # SIGINT won't do it. - kill -s SIGTERM '%${exec_prefix}stap-client-connect' + kill -s SIGTERM '%${exec_prefix}stap-client-connect' 2>/dev/null # If staprun was not running, then exit. cleanup diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 65244185..e305d0ea 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-02-20 Dave Brolley <brolley@redhat.com> + + * lib/systemtap.exp (setup_server,shutdown_server): New procs. + (setup_systemtap_environment): Call setup_server. + (systemtap_exit): Call shutdown_server. + * systemtap.server: New testsuite for client/server. + 2009-02-18 Stan Cox <scox@redhat.com> * systemtap.base/static_uprobes.exp: Also test without .probes section. 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 } } diff --git a/testsuite/systemtap.server/server.exp b/testsuite/systemtap.server/server.exp new file mode 100644 index 00000000..f82abc27 --- /dev/null +++ b/testsuite/systemtap.server/server.exp @@ -0,0 +1,40 @@ +# Don't attempt these tests if the client/server are not available +if {! [file exists [exec pwd]/../stap-client-connect]} then { + untested "Server Tests" + return + } + +# Start a systemtap server, if one is not already started. +if {! [use_server_p]} then { + setup_server +} + +# Run the buildok tests using the server +set self buildok +foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { + set test "$self/[file tail $file] with server" + verbose -log "Running $file" + set rc [stap_run_batch $file] + # some tests are known to fail. + switch $test { + "buildok/perfmon01.stp with server" {setup_kfail 909 *-*-*} + "buildok/twentysix.stp with server" {setup_kfail 4105 *-*-*} + "buildok/twentyseven.stp with server" {setup_kfail 4166 *-*-*} + "buildok/sched_test.stp with server" {setup_kfail 1155 *-*-*} + "buildok/process_test.stp with server" {setup_kfail 1155 *-*-*} + "buildok/rpc-all-probes.stp with server" {setup_kfail 4413 *-*-*} + "buildok/nfs-all-probes.stp with server" {setup_kfail 4413 *-*-*} + } + if {$rc == 0} { pass $test } else { fail $test } +} + +# If this is an installcheck, then run a basic execution test. +if {[installtest_p]} then { + set test "add" + stap_run $srcdir/systemtap.base/$test.stp no_load $all_pass_string +} + +# Shudown the server, if we started it. +if {! [use_server_p]} then { + shutdown_server +} |