diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index c0959189..a24f6dda 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -278,10 +278,11 @@ fi # Run pre test hook if we have one if function_exists "pre_test_hook"; then + local xtrace=$(set +o | grep xtrace) set -o xtrace tsfilter pre_test_hook | tee $WORKSPACE/devstack-gate-pre-test-hook.txt sudo mv $WORKSPACE/devstack-gate-pre-test-hook.txt $BASE/logs/ - set +o xtrace + $xtrace fi # Run the gate function @@ -291,11 +292,13 @@ RETVAL=$GATE_RETVAL # Run post test hook if we have one if [ $GATE_RETVAL -eq 0 ] && function_exists "post_test_hook"; then + local xtrace=$(set +o | grep xtrace) set -o xtrace -o pipefail tsfilter post_test_hook | tee $WORKSPACE/devstack-gate-post-test-hook.txt RETVAL=$? sudo mv $WORKSPACE/devstack-gate-post-test-hook.txt $BASE/logs/ - set +o xtrace +o pipefail + set +o pipefail + $xtrace fi if [ $GATE_RETVAL -eq 137 ] && [ -f $WORKSPACE/gate.pid ] ; then diff --git a/functions.sh b/functions.sh index 9001ea50..15268cfa 100644 --- a/functions.sh +++ b/functions.sh @@ -221,6 +221,7 @@ function re_exec_devstack_gate { function setup_workspace { local base_branch=$1 local DEST=$2 + local xtrace=$(set +o | grep xtrace) # Enabled detailed logging, since output of this function is redirected set -o xtrace @@ -252,7 +253,7 @@ function setup_workspace { find ~/cache/files/ -mindepth 1 -maxdepth 1 -exec mv {} $DEST/devstack/files/ \; # Disable detailed logging as we return to the main script - set +o xtrace + $xtrace } function select_mirror { @@ -283,6 +284,7 @@ function select_mirror { function setup_host { # Enabled detailed logging, since output of this function is redirected + local xtrace=$(set +o | grep xtrace) set -o xtrace # This is necessary to keep sudo from complaining @@ -342,11 +344,12 @@ function setup_host { select_mirror fi # Disable detailed logging as we return to the main script - set +o xtrace + $xtrace } function cleanup_host { # Enabled detailed logging, since output of this function is redirected + local xtrace=$(set +o | grep xtrace) set -o xtrace cd $WORKSPACE @@ -456,5 +459,5 @@ function cleanup_host { sudo chmod a+r $BASE/logs/nosetests*.xml # Disable detailed logging as we return to the main script - set +o xtrace + $xtrace }