summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/test-debug.tcl
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2010-02-22 13:43:41 +0100
committerMark Wielaard <mjw@redhat.com>2010-02-22 13:43:41 +0100
commit23224f1fbb32ce91c5a261fb94cfb17df475cb30 (patch)
treea53e511c1f13e356037c076a7a687b37c12c73a5 /testsuite/systemtap.syscall/test-debug.tcl
parent7abde14bde6410e5138e968be7c7b95b78759c17 (diff)
downloadsystemtap-steved-23224f1fbb32ce91c5a261fb94cfb17df475cb30.tar.gz
systemtap-steved-23224f1fbb32ce91c5a261fb94cfb17df475cb30.tar.xz
systemtap-steved-23224f1fbb32ce91c5a261fb94cfb17df475cb30.zip
Prevent accidental global cleanup triggering for syscall test.tcl.
Later tests might trigger a cleanup and might set the global dir variable leading to the syscall test.tcl trying to do an exec rm -rf on whatever dir was set. So rename proc cleanup and global dir in syscall test.tcl to something a bit less likely to clash. * testsuite/systemtap.syscall/test.tcl: Rename proc cleanup to syscall_cleanup and global dir to syscall_dir. * testsuite/systemtap.syscall/test-debug.tcl: Likewise.
Diffstat (limited to 'testsuite/systemtap.syscall/test-debug.tcl')
-rwxr-xr-xtestsuite/systemtap.syscall/test-debug.tcl26
1 files changed, 13 insertions, 13 deletions
diff --git a/testsuite/systemtap.syscall/test-debug.tcl b/testsuite/systemtap.syscall/test-debug.tcl
index 3eb6bbf0..320558bf 100755
--- a/testsuite/systemtap.syscall/test-debug.tcl
+++ b/testsuite/systemtap.syscall/test-debug.tcl
@@ -1,14 +1,14 @@
#!/usr/bin/env wish
package require Expect
-set dir ""
+set syscall_dir ""
set current_dir ""
-proc cleanup {} {
- global dir current_dir
+proc syscall_cleanup {} {
+ global syscall_dir current_dir
if {$current_dir != ""} {
cd $current_dir
- if {$dir != ""} {exec rm -rf $dir}
+ if {$syscall_dir != ""} {exec rm -rf $syscall_dir}
set current_dir ""
}
exit 0
@@ -16,14 +16,14 @@ proc cleanup {} {
proc usage {progname} {
puts "Usage: $progname testname"
- cleanup
+ syscall_cleanup
}
proc bgerror {error} {
puts "ERROR: $error"
- cleanup
+ syscall_cleanup
}
-trap {cleanup} SIGINT
+trap {syscall_cleanup} SIGINT
set testname [lindex $argv 0]
if {$testname == ""} {
usage $argv0
@@ -75,17 +75,17 @@ foreach line [split $output "\n"] {
if {$ind == 0} {
puts "UNSUPP"
- cleanup
+ syscall_cleanup
exit
}
-if {[catch {exec mktemp -d staptestXXXXXX} dir]} {
- puts stderr "Failed to create temporary directory: $dir"
- cleanup
+if {[catch {exec mktemp -d staptestXXXXXX} syscall_dir]} {
+ puts stderr "Failed to create temporary directory: $syscall_dir"
+ syscall_cleanup
}
set current_dir [pwd]
-cd $dir
+cd $syscall_dir
catch {eval exec $cmd} output
set i 0
@@ -151,5 +151,5 @@ for {} {$i < $ind} {incr i} {
.t2 insert end "\n"
}
-bind . <Destroy> {cleanup}
+bind . <Destroy> {syscall_cleanup}