[ARVADOS-DEV] created: 3385feb3cf354ae36672792b57ed4bb1821d7c75

git at public.curoverse.com git at public.curoverse.com
Sun Feb 8 22:27:03 EST 2015


        at  3385feb3cf354ae36672792b57ed4bb1821d7c75 (commit)


commit 3385feb3cf354ae36672792b57ed4bb1821d7c75
Author: Tom Clegg <tom at curoverse.com>
Date:   Sun Feb 8 18:59:26 2015 -0500

    Clean up and exit on SIGINT.

diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh
index 445509d..27c6ee6 100755
--- a/jenkins/run-tests.sh
+++ b/jenkins/run-tests.sh
@@ -126,6 +126,16 @@ report_outcomes() {
     fi
 }
 
+exit_cleanly() {
+    trap - INT
+    rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log"
+    stop_api
+    rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
+    report_outcomes
+    clear_temp
+    exit ${#failures}
+}
+
 sanity_checks() {
   # Make sure WORKSPACE is set
   if ! [[ -n "$WORKSPACE" ]]; then
@@ -165,7 +175,6 @@ sanity_checks() {
     echo >&2
     exit 1
   fi
-
 }
 
 rotate_logfile() {
@@ -221,6 +230,29 @@ do
     esac
 done
 
+start_api() {
+    echo 'Starting API server...'
+    cd "$WORKSPACE" \
+        && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \
+        && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \
+        && export ARVADOS_TEST_API_INSTALLED="$$" \
+        && (env | egrep ^ARVADOS)
+}
+
+stop_api() {
+    if [[ -n "$ARVADOS_TEST_API_HOST" ]]; then
+        unset ARVADOS_TEST_API_HOST
+        cd "$WORKSPACE" \
+            && python sdk/python/tests/run_test_server.py stop
+    fi
+}
+
+interrupt() {
+    failures+=("($(basename $0) interrupted)")
+    exit_cleanly
+}
+trap interrupt INT
+
 sanity_checks
 
 echo "WORKSPACE=$WORKSPACE"
@@ -529,21 +561,6 @@ install_workbench() {
 }
 do_install apps/workbench workbench
 
-start_api() {
-    echo 'Starting API server...'
-    cd "$WORKSPACE" \
-        && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \
-        && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \
-        && export ARVADOS_TEST_API_INSTALLED="$$" \
-        && (env | egrep ^ARVADOS)
-}
-
-stop_api() {
-    unset ARVADOS_TEST_API_HOST
-    cd "$WORKSPACE" \
-        && python sdk/python/tests/run_test_server.py stop
-}
-
 test_doclinkchecker() {
     (
         set -e
@@ -607,12 +624,4 @@ test_workbench_profile() {
 }
 do_test apps/workbench_profile workbench_profile
 
-rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log"
-
-stop_api
-rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
-
-report_outcomes
-clear_temp
-
-exit ${#failures}
+exit_cleanly

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list