diff options
author | Dave Brolley <brolley@redhat.com> | 2008-07-29 13:40:08 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2008-07-29 13:40:08 -0400 |
commit | 0e47827d5f461ceb0e67540adba7bc2fe3a360da (patch) | |
tree | 804fe937a06c7ee71ec6d438d8d8bf6d1a70f32d /stap-server | |
parent | b1af668d224b0673f27f991a77455d6e0ecb6891 (diff) | |
download | systemtap-steved-0e47827d5f461ceb0e67540adba7bc2fe3a360da.tar.gz systemtap-steved-0e47827d5f461ceb0e67540adba7bc2fe3a360da.tar.xz systemtap-steved-0e47827d5f461ceb0e67540adba7bc2fe3a360da.zip |
Ensure that a systemtap server is available if 'server' is specified
in EXTRA_TOOL_OPTS for 'make check' and 'make installcheck'
Diffstat (limited to 'stap-server')
-rwxr-xr-x | stap-server | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/stap-server b/stap-server index 16ffe8ee..7df324b4 100755 --- a/stap-server +++ b/stap-server @@ -13,6 +13,9 @@ # contained in the unpacked tree to build the requested systemtap kernel module. # This module is then written to stdout. +# Catch ctrl-c and other termination signals +trap 'terminate' SIGTERM SIGINT + #----------------------------------------------------------------------------- # Helper functions. #----------------------------------------------------------------------------- @@ -312,6 +315,7 @@ function call_stap { else server_p_phase=$p_phase fi + eval stap $cmdline -k -p $server_p_phase \ >> $tmpdir_server/stdout \ 2>> $tmpdir_server/stderr @@ -328,19 +332,21 @@ function create_response { tmpdir_line=`cat stderr | grep "Keeping temp"` tmpdir_stap=`expr "$tmpdir_line" : '.*"\(.*\)".*'` - # Remove the message about keeping th<e stap temp directory from stderr, unless + # Remove the message about keeping the stap temp directory from stderr, unless # the user did request to keep it. - if test $keep_temps != 1; then - sed -i "/^Keeping temp/d" stderr + if test "X$tmpdir_stap" != "X"; then + if test $keep_temps != 1; then + sed -i "/^Keeping temp/d" stderr + fi + + # Add the contents of the stap temp directory to the server output directory + ln -s $tmpdir_stap `basename $tmpdir_stap` fi # If the user specified -p5, remove the name of the kernel module from stdout. if test $p_phase = 5; then sed -i '/\.ko$/d' stdout fi - - # Add the contents of the stap temp directory to the server output directory - ln -s $tmpdir_stap `basename $tmpdir_stap` } # function: package_response @@ -404,6 +410,15 @@ function cleanup { fi } +# function: terminate +# +# Terminate gracefully. +function terminate { + # Clean up + cleanup + exit +} + #----------------------------------------------------------------------------- # Beginning of main line execution. #----------------------------------------------------------------------------- |