diff options
author | David Smith <dsmith@redhat.com> | 2010-03-24 11:04:16 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2010-03-24 11:04:16 -0500 |
commit | a3dd4dbe0e0e699aa9406cebf36f1acd63c37f19 (patch) | |
tree | f7c6eb55ea23e6acb9a6330e956e0f7345521cb5 | |
parent | 6c62bc429ffee4fc1baa798c6b800d98e5698c00 (diff) | |
download | systemtap-steved-a3dd4dbe0e0e699aa9406cebf36f1acd63c37f19.tar.gz systemtap-steved-a3dd4dbe0e0e699aa9406cebf36f1acd63c37f19.tar.xz systemtap-steved-a3dd4dbe0e0e699aa9406cebf36f1acd63c37f19.zip |
Small cleanup of context.exp.
* testsuite/systemtap.context/context.exp: Used "make -C $build_dir" to
avoid using 'cd'. Added error handling.
-rw-r--r-- | testsuite/systemtap.context/context.exp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/testsuite/systemtap.context/context.exp b/testsuite/systemtap.context/context.exp index da9910b6..46b24a2c 100644 --- a/testsuite/systemtap.context/context.exp +++ b/testsuite/systemtap.context/context.exp @@ -16,48 +16,51 @@ proc cleanup {} { 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} + if {$build_dir != ""} { + catch { exec rm -rf $build_dir } + } } proc build_modules {} { global build_dir global srcdir subdir + # Create the build directory and populate it if {[catch {exec mktemp -d staptestXXXXXX} build_dir]} { verbose -log "Failed to create temporary directory: $build_dir" return 0 } - foreach f [glob $srcdir/$subdir/systemtap_test_module*.c] { - exec cp $f $build_dir + exec cp $f $build_dir/ } - set old_dir [pwd] - cd $build_dir + # Build the modules foreach n {2 1} { - exec cp -p $srcdir/$subdir/makefile$n Makefile - if {[catch {exec make clean} res]} { + exec cp -p $srcdir/$subdir/makefile$n $build_dir/Makefile + if {[catch {exec make -C $build_dir clean} res]} { verbose -log "$res" - cd $old_dir return 0 } - catch {exec make} res - if {![file exists systemtap_test_module$n.ko]} { + catch {exec make -C $build_dir} res + if {![file exists $build_dir/systemtap_test_module$n.ko]} { verbose -log "$res" - cd $old_dir return 0 } - set res [as_root [list cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel]] + set res [as_root [list cp $build_dir/systemtap_test_module$n.ko /lib/modules/$::uname/kernel]] if { $res != 0 } { verbose -log "$res" - cd $old_dir return 0 } } + + # Install the modules foreach n {2 1} { - as_root [list /sbin/insmod systemtap_test_module$n.ko] + set res [as_root [list /sbin/insmod $build_dir/systemtap_test_module$n.ko]] + if {$res != 0} { + verbose -log "$res" + return 0 + } } - cd $old_dir return 1 } |