From 23224f1fbb32ce91c5a261fb94cfb17df475cb30 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 22 Feb 2010 13:43:41 +0100 Subject: 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. --- testsuite/systemtap.syscall/test.tcl | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'testsuite/systemtap.syscall/test.tcl') diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index 477fae70..5d64e998 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -1,42 +1,42 @@ -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 set current_dir "" } - if {$dir != ""} { -# puts "rm -rf $dir" - exec rm -rf $dir - set dir "" + if {$syscall_dir != ""} { +# puts "rm -rf $syscall_dir" + exec rm -rf $syscall_dir + set syscall_dir "" } } -proc cleanup_and_exit {} { -# puts "cleanup_and_exit" - cleanup +proc syscall_cleanup_and_exit {} { +# puts "syscall_cleanup_and_exit" + syscall_cleanup exit 0 } proc bgerror {error} { puts "ERROR: $error" - cleanup + syscall_cleanup } -trap {cleanup_and_exit} SIGINT +trap {syscall_cleanup_and_exit} SIGINT proc run_one_test {filename flags bits} { - global dir current_dir test_script + global syscall_dir current_dir test_script set testname [file tail [string range $filename 0 end-2]] - if {[catch {exec mktemp -d [pwd]/staptestXXXXXX} dir]} { - puts stderr "Failed to create temporary directory: $dir" - cleanup + if {[catch {exec mktemp -d [pwd]/staptestXXXXXX} syscall_dir]} { + puts stderr "Failed to create temporary directory: $syscall_dir" + syscall_cleanup } - set res [target_compile $filename $dir/$testname executable $flags] + set res [target_compile $filename $syscall_dir/$testname executable $flags] if { $res != "" } { send_log "$bits-bit $testname : no corresponding devel environment found\n" untested "$bits-bit $testname" @@ -44,7 +44,7 @@ proc run_one_test {filename flags bits} { } set sys_prog "[file dirname [file normalize $filename]]/${test_script}" - set cmd "stap --skip-badvars -c $dir/${testname} ${sys_prog}" + set cmd "stap --skip-badvars -c $syscall_dir/${testname} ${sys_prog}" # Extract additional C flags needed to compile set add_flags "" @@ -92,13 +92,13 @@ proc run_one_test {filename flags bits} { if {$ind == 0} { # unsupported - cleanup + syscall_cleanup unsupported "$bits-bit $testname not supported on this arch" return } set current_dir [pwd] - cd $dir + cd $syscall_dir catch {eval exec $cmd} output @@ -139,6 +139,6 @@ proc run_one_test {filename flags bits} { } fail "$bits-bit $testname" } - cleanup + syscall_cleanup return } -- cgit