diff options
author | Dave Brolley <brolley@redhat.com> | 2009-02-20 16:58:57 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-02-20 16:58:57 -0500 |
commit | e26df1cb46bf61450a3e9569cd892c91fd52c0a7 (patch) | |
tree | b38521375256620056dc4935ac7782b8feaff5a5 | |
parent | e1d8e378730ccff8491104575913a4943e9427a8 (diff) | |
download | systemtap-steved-e26df1cb46bf61450a3e9569cd892c91fd52c0a7.tar.gz systemtap-steved-e26df1cb46bf61450a3e9569cd892c91fd52c0a7.tar.xz systemtap-steved-e26df1cb46bf61450a3e9569cd892c91fd52c0a7.zip |
Check for required resources and tools before attempting tests using the client/server.
Ensure that tests run with/without the server have unique names.
-rw-r--r-- | testsuite/lib/systemtap.exp | 30 | ||||
-rwxr-xr-x | testsuite/systemtap.server/hello.stp | 8 | ||||
-rw-r--r-- | testsuite/systemtap.server/server.exp | 15 |
3 files changed, 42 insertions, 11 deletions
diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp index 9dea8a89..c80ad171 100644 --- a/testsuite/lib/systemtap.exp +++ b/testsuite/lib/systemtap.exp @@ -53,7 +53,9 @@ proc setup_systemtap_environment {} { # Find or start a systemtap server, if requested. if {[use_server_p]} then { - setup_server + if {! [setup_server]} then { + return 0 + } } # PATH, SYSTEMTAP_TAPSET, SYSTEMTAP_RUNTIME, LD_LIBRARY_PATH are already set. @@ -62,6 +64,8 @@ proc setup_systemtap_environment {} { verbose -log "env $var = $env($var)" } } + + return 1 } # Set up the environment so that tests will be performed using the systemtap @@ -69,6 +73,21 @@ proc setup_systemtap_environment {} { proc setup_server {} { global srcdir env server_pid net_path + # Make sure that the necessary resources are available to run the client/server. + if {[installtest_p]} then { + if {[exec /usr/bin/which stap-client-connect] == ""} then { + print "Unable to start a server: stap-client-connect is not found in PATH" + return 0 + } + } elseif {! [file exists [exec pwd]/../stap-client-connect]} then { + print "Unable to start a server: [exec pwd]/../stap-client-connect is not found" + return 0 + } + if {[exec /usr/bin/which avahi-publish-service] == ""} then { + print "Unable to start a server: avahi-publish-service is not found in PATH" + return 0 + } + print "Testing using a systemtap server" # A place for some temporary files and scripts. @@ -87,7 +106,7 @@ proc setup_server {} { if { "$server_pid" == "-1" } then { print "Cannot find or start a systemtap server" set server_pid 0 - # TODO: How do we abort here? + return 0 } elseif { "$server_pid" == "0" } then { print "A compatible systemtap server is already available" } else { @@ -103,6 +122,8 @@ proc setup_server {} { exec /bin/cp -p $srcdir/../stap-client $net_path/stap } set env(PATH) "$net_path:$env(PATH)" + + return 1 } proc shutdown_server {} { @@ -136,7 +157,10 @@ proc get_system_info {} { if [file exists /etc/debian_version] {set Distro [exec /bin/cat /etc/debian_version]} } -setup_systemtap_environment +if {! [setup_systemtap_environment]} then { + return 0 +} + print_systemtap_version get_system_info diff --git a/testsuite/systemtap.server/hello.stp b/testsuite/systemtap.server/hello.stp new file mode 100755 index 00000000..a1c4aacb --- /dev/null +++ b/testsuite/systemtap.server/hello.stp @@ -0,0 +1,8 @@ +#! stap + +probe begin +{ + printf("Hello "); + printf("From Server\n"); + exit() +} diff --git a/testsuite/systemtap.server/server.exp b/testsuite/systemtap.server/server.exp index f82abc27..c2c60b97 100644 --- a/testsuite/systemtap.server/server.exp +++ b/testsuite/systemtap.server/server.exp @@ -1,12 +1,10 @@ # 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 + if {! [setup_server]} then { + untested "Server Tests" + return + } } # Run the buildok tests using the server @@ -30,8 +28,9 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { # 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 + set test "Hello from server" + set rc [stap_run_batch $srcdir/systemtap.server/hello.stp] + if {$rc == 0} { pass $test } else { fail $test } } # Shudown the server, if we started it. |