summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-02-16 14:58:40 -0600
committerDavid Smith <dsmith@redhat.com>2009-02-16 14:58:40 -0600
commitea1248d39b26b7f4288751cdf9eb019266bfd91b (patch)
treeb6024e5ff6f4c4fcf44a8abcc976ec9082801d02 /testsuite
parentf5438dfc723aa0a8175efb03fe7096d393e86ee9 (diff)
downloadsystemtap-steved-ea1248d39b26b7f4288751cdf9eb019266bfd91b.tar.gz
systemtap-steved-ea1248d39b26b7f4288751cdf9eb019266bfd91b.tar.xz
systemtap-steved-ea1248d39b26b7f4288751cdf9eb019266bfd91b.zip
Improved cleanup in tests.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog8
-rwxr-xr-xtestsuite/systemtap.base/bz5274.exp13
-rw-r--r--testsuite/systemtap.base/bz6850.exp13
-rw-r--r--testsuite/systemtap.base/static_uprobes.exp47
-rw-r--r--testsuite/systemtap.base/uprobes.exp14
5 files changed, 73 insertions, 22 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 89e59075..8b47860c 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2009-02-16 David Smith <dsmith@redhat.com>
+
+ * systemtap.base/bz5274.exp: Better cleanup.
+ * systemtap.base/bz6850.exp: Ditto.
+ * systemtap.base/uprobes.exp: Ditto.
+ * systemtap.base/static_uprobes.exp: Ditto. Also changed a
+ 'spawn' to an 'exec' to avoid needing to wait.
+
2009-02-15 Stan Cox <scox@redhat.com>
* systemtap.base/static_uprobes.exp: Test with both c++ and c.
diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp
index db0e0a46..92441e9e 100755
--- a/testsuite/systemtap.base/bz5274.exp
+++ b/testsuite/systemtap.base/bz5274.exp
@@ -8,11 +8,14 @@ if {$arch == "ppc64"} {
catch {exec gcc -o $test -g $srcdir/$subdir/$test.c} err
}
-
if {$err == "" && [file exists $test]} then { pass "$test compile"
} else {fail "$test compile"}
-if {! [installtest_p]} { untested "$test -p5"; return }
+if {! [installtest_p]} {
+ catch {exec rm -f $test}
+ untested "$test -p5"
+ return
+}
# Try to find utrace_attach symbol in /proc/kallsyms
# copy from utrace_p5.exp
@@ -21,7 +24,11 @@ set path "/proc/kallsyms"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
set utrace_support_found 1
}
-if {$utrace_support_found == 0} { untested "$test -p5"; return }
+if {$utrace_support_found == 0} {
+ catch {exec rm -f $test}
+ untested "$test -p5"
+ return
+}
if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} {
untested "$test longjmp to a uretprobed function"
diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp
index 73fedc8a..b96ed95c 100644
--- a/testsuite/systemtap.base/bz6850.exp
+++ b/testsuite/systemtap.base/bz6850.exp
@@ -10,12 +10,21 @@ set path "/proc/kallsyms"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
set utrace_support_found 1
}
-if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return }
+if {$utrace_support_found == 0} {
+ catch {exec rm -f $test}
+ untested "$test -p4"
+ untested "$test -p5"
+ return
+}
set rc [stap_run_batch $srcdir/$subdir/bz6850.stp]
if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" }
-if {! [installtest_p]} { untested "$test -p5"; return }
+if {! [installtest_p]} {
+ catch {exec rm -f $test}
+ untested "$test -p5"
+ return
+}
# Pick up the stap being tested.
set stapexe [exec /usr/bin/which stap]
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp
index 34e230ac..d86fef85 100644
--- a/testsuite/systemtap.base/static_uprobes.exp
+++ b/testsuite/systemtap.base/static_uprobes.exp
@@ -53,11 +53,16 @@ set path "/proc/kallsyms"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
set utrace_support_found 1
}
-if {$utrace_support_found == 0} { untested "$test"; return }
+if {$utrace_support_found == 0} {
+ untested "$test"
+ catch {exec rm -f $sup_srcpath}
+ return
+}
set ok 0
-set fp [open "[pwd]/static_uprobes.stp" "w"]
+set sup_stppath "[pwd]/static_uprobes.stp"
+set fp [open $sup_stppath "w"]
puts $fp "
probe process(\"static_uprobes.x\").mark(\"test_probe_0\")
{
@@ -78,7 +83,9 @@ probe process(\"static_uprobes.x\").mark(\"test_probe_4\")
"
close $fp
-set fp [open "[pwd]/static_uprobes.d" "w"]
+set sup_dpath "[pwd]/static_uprobes.d"
+set sup_hpath "[pwd]/static_uprobes.h"
+set fp [open $sup_dpath "w"]
puts $fp "
provider static_uprobes {
probe test_probe_1 ();
@@ -88,20 +95,30 @@ provider static_uprobes {
};
"
close $fp
-spawn dtrace -h -s [pwd]/static_uprobes.d
+exec dtrace -h -s $sup_dpath
+if {[file exists $sup_hpath]} then {
+ pass "generating $sup_hpath"
+} else {
+ fail "generating $sup_hpath"
+ catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath}
+ return
+}
+
+catch {exec rm -f $sup_dpath}
set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=-I."
set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags]
if { $res != "" } {
verbose "target_compile failed: $res" 2
- fail "compiling sduprobes.c -g"
+ fail "compiling $sup_srcpath -g"
+ catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath}
return
} else {
- pass "compiling sduprobes.c -g"
+ pass "compiling $sup_srcpath -g"
}
-verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp"
-spawn stap -c $sup_exepath [pwd]/static_uprobes.stp
+verbose -log "spawn stap -c $sup_exepath $sup_stppath"
+spawn stap -c $sup_exepath $sup_stppath
expect {
-timeout 180
-re {In test_probe_2 probe 0x2} { incr ok; exp_continue }
@@ -117,20 +134,22 @@ wait
if {$ok == 4} { pass "$test" } { fail "$test ($ok)" }
spawn mv $sup_srcpath "[pwd]/static_uprobes.cc"
+set sup_srcpath "[pwd]/static_uprobes.cc"
set sup_flags "$sup_flags c++"
-set res [target_compile "[pwd]/static_uprobes.cc" $sup_exepath executable $sup_flags]
+set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags]
if { $res != "" } {
verbose "target_compile failed: $res" 2
- fail "compiling sduprobes.c -g"
+ fail "compiling $sup_srcpath -g"
+ catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath}
return
} else {
- pass "compiling sduprobes.c -g"
+ pass "compiling $sup_srcpath -g"
}
set ok 0
-verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp"
-spawn stap -c $sup_exepath [pwd]/static_uprobes.stp
+verbose -log "spawn stap -c $sup_exepath $sup_stppath"
+spawn stap -c $sup_exepath $sup_stppath
expect {
-timeout 180
-re {In test_probe_1 probe} { incr ok; exp_continue }
@@ -145,4 +164,4 @@ expect {
wait
if {$ok == 4} { pass "$test" } { fail "$test ($ok)" }
-
+catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath}
diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp
index e8318586..89250e7b 100644
--- a/testsuite/systemtap.base/uprobes.exp
+++ b/testsuite/systemtap.base/uprobes.exp
@@ -25,12 +25,20 @@ set path "/proc/kallsyms"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
set utrace_support_found 1
}
-if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return }
+if {$utrace_support_found == 0} {
+ untested "$test -p4"; untested "$test -p5"
+ catch {exec rm -f jennie.c jennie}
+ return
+}
set rc [stap_run_batch $srcdir/$subdir/uprobes.stp]
if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" }
-if {! [installtest_p]} { untested "$test -p5"; exec rm -f jennie.c jennie; return }
+if {! [installtest_p]} {
+ untested "$test -p5";
+ catch {exec rm -f jennie.c jennie}
+ return
+}
# Pick up the stap being tested.
set stapexe [exec /usr/bin/which stap]
@@ -46,4 +54,4 @@ expect {
if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
catch {wait; close}
-exec rm -f jennie.c jennie
+catch {exec rm -f jennie.c jennie}