set testlist {backtrace args pid num_args} if {![installtest_p]} { foreach test $testlist { untested $test } return } set build_dir "" proc cleanup {} { global build_dir catch { exec kill -INT -[exp_pid] } foreach n {1 2} { as_root [list /bin/rm -f /lib/modules/$::uname/kernel/systemtap_test_module$n.ko] as_root [list /sbin/rmmod systemtap_test_module$n] } if {$build_dir != ""} {exec rm -rf $build_dir} } proc build_modules {} { global build_dir global srcdir subdir if {[catch {exec mktemp -d staptestXXXXX} build_dir]} { puts stderr "Failed to create temporary directory: $build_dir" return 0 } foreach f [glob $srcdir/$subdir/systemtap_test_module*.c] { exec cp $f $build_dir } set old_dir [pwd] cd $build_dir foreach n {2 1} { exec cp $srcdir/$subdir/makefile$n Makefile if {[catch {exec make clean} res]} { puts $res cd $old_dir return 0 } catch {exec make} res if {![file exists systemtap_test_module$n.ko]} { puts $res cd $old_dir return 0 } set res [as_root [list cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel]] if { $res != 0 } { puts $res cd $old_dir return 0 } } foreach n {2 1} { as_root [list /sbin/insmod systemtap_test_module$n.ko] } cd $old_dir return 1 } # first build the modules # NB: We cannot "cd" on behalf the whole dejagnu process, especially # without going back to the build tree, and especially not to the # source tree expecting to be able to write there. # # cd $srcdir/$subdir set uname [exec /bin/uname -r] if {[build_modules] == 0} { puts "BUILD FAILED" foreach test $testlist { fail "$test - could not build modules" } return } foreach test $testlist { source $srcdir/$subdir/$test.tcl } cleanup