summaryrefslogtreecommitdiffstats
path: root/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/lib')
-rw-r--r--testsuite/lib/stap_run.exp1
-rw-r--r--testsuite/lib/stap_run2.exp23
-rw-r--r--testsuite/lib/systemtap.exp32
3 files changed, 45 insertions, 11 deletions
diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp
index a4beaa12..3043eeed 100644
--- a/testsuite/lib/stap_run.exp
+++ b/testsuite/lib/stap_run.exp
@@ -30,6 +30,7 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args }
if [file readable $test_file_name] {
lappend cmd $test_file_name
}
+ send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 180
diff --git a/testsuite/lib/stap_run2.exp b/testsuite/lib/stap_run2.exp
index cb1c6615..d1f02c83 100644
--- a/testsuite/lib/stap_run2.exp
+++ b/testsuite/lib/stap_run2.exp
@@ -10,12 +10,27 @@
proc stap_run2 { TEST_NAME args } {
# zap the srcdir prefix
- set test_file_name $TEST_NAME
+ set TEST_FILE $TEST_NAME
set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""]
-
+ if {[llength $args] == 0} {
+ stap_run3 $TEST_NAME $TEST_FILE
+ } else {
+ stap_run3 $TEST_NAME $TEST_FILE $args
+ }
+}
+
+# stap_run3 TEST_NAME TEST_FILE
+# TEST_NAME is the name of the test as shown in PASS/FAIL/SKIPPED messages.
+# TEST_FILE is the path to the current test
+# Additional arguments are passed to stap as-is.
+#
+# global result_string must be set to the expected output
+
+proc stap_run3 { TEST_NAME TEST_FILE args } {
if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return }
-
- set cmd [concat stap $args $test_file_name]
+
+ set cmd [concat stap $TEST_FILE $args]
+ send_log "executing: $cmd\n"
catch {eval exec $cmd} res
set n 0
diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp
index c80ad171..379f6c58 100644
--- a/testsuite/lib/systemtap.exp
+++ b/testsuite/lib/systemtap.exp
@@ -16,6 +16,16 @@ proc use_server_p {} {
}
+proc utrace_p {} {
+ set path "/proc/kallsyms"
+ if {! [catch {exec grep -q utrace_attach $path} dummy]} {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+
proc print_systemtap_version {} {
set version [exec /bin/uname -r]
set location "/boot/vmlinux-$version"
@@ -75,7 +85,7 @@ proc setup_server {} {
# 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 {
+ if {[catch {exec /usr/bin/which stap-client-connect} dummy]} then {
print "Unable to start a server: stap-client-connect is not found in PATH"
return 0
}
@@ -83,7 +93,7 @@ proc setup_server {} {
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 {
+ if {[catch {exec /usr/bin/which avahi-publish-service} dummy]} then {
print "Unable to start a server: avahi-publish-service is not found in PATH"
return 0
}
@@ -99,6 +109,7 @@ proc setup_server {} {
if {! [installtest_p]} then {
# Make sure the server management scripts and tools are on the $PATH.
set env(PATH) "$srcdir/..:[exec pwd]/..:$env(PATH)"
+ set env(SYSTEMTAP_SERVER_SCRIPTS) "$srcdir/.."
}
# Try to find or start the server.
@@ -118,8 +129,10 @@ proc setup_server {} {
# The server does not call this instance of 'stap'
if {[installtest_p]} then {
exec /bin/cp -p [exec which stap-client] $net_path/stap
+ exec /bin/cp -p [exec which stap-env] $net_path/stap-env
} else {
exec /bin/cp -p $srcdir/../stap-client $net_path/stap
+ exec /bin/cp -p $srcdir/../stap-env $net_path/stap-env
}
set env(PATH) "$net_path:$env(PATH)"
@@ -148,13 +161,18 @@ proc get_system_info {} {
set Snapshot [exec /bin/cat $env(SRCDIR)/../SNAPSHOT]
} else {
regexp {version [^)]*} [exec stap -V 2>@ stdout] version
- set Snapshot $version
+ set Snapshot $version
}
set Distro "Linux"
- if [file exists /etc/fedora-release] {set Distro [exec /bin/cat /etc/fedora-release]}
- if [file exists /etc/redhat-release] {set Distro [exec /bin/cat /etc/redhat-release]}
- if [file exists /etc/suse-release] {set Distro [exec /bin/cat /etc/suse-release]}
- if [file exists /etc/debian_version] {set Distro [exec /bin/cat /etc/debian_version]}
+ if [file exists /usr/bin/lsb_release] {
+ # this produces one line of this format:
+ # Distribution:\tSTRING
+ set Distro [lrange [exec /usr/bin/lsb_release -d] 1 end]
+ } else {
+ foreach f {/etc/fedora-release /etc/enterprise-release /etc/redhat-release /etc/suse-release /etc/debian_version} {
+ if [file exists $f] then {set Distro [exec /bin/cat $f]; break }
+ }
+ }
}
if {! [setup_systemtap_environment]} then {