Merge branch '10346-rearrange-api-docs' closes #10346
[arvados.git] / build / run-tests.sh
index c9cb2b2199a5b155b8334ce00182e14b276ded77..8959cfbe09c3ea7ac6ded2142b626259787d2121 100755 (executable)
@@ -93,6 +93,7 @@ sdk/go/streamer
 sdk/go/crunchrunner
 sdk/cwl
 tools/crunchstat-summary
+tools/keep-exercise
 tools/keep-rsync
 tools/keep-block-check
 
@@ -158,8 +159,8 @@ sanity_checks() {
     echo -n 'go: '
     go version \
         || fatal "No go binary. See http://golang.org/doc/install"
-    [[ $(go version) =~ go1.([0-9]+) ]] && [[ ${BASH_REMATCH[1]} -ge 6 ]] \
-        || fatal "Go >= 1.6 required. See http://golang.org/doc/install"
+    [[ $(go version) =~ go1.([0-9]+) ]] && [[ ${BASH_REMATCH[1]} -ge 7 ]] \
+        || fatal "Go >= 1.7 required. See http://golang.org/doc/install"
     echo -n 'gcc: '
     gcc --version | egrep ^gcc \
         || fatal "No gcc. Try: apt-get install build-essential"
@@ -520,6 +521,8 @@ do_test_once() {
             # mode makes Go show the wrong line numbers when reporting
             # compilation errors.
             go get -t "git.curoverse.com/arvados.git/$1" || return 1
+            cd "$WORKSPACE/$1" || return 1
+            gofmt -e -d . | egrep . && result=1
             if [[ -n "${testargs[$1]}" ]]
             then
                 # "go test -check.vv giturl" doesn't work, but this
@@ -530,7 +533,7 @@ do_test_once() {
                 # empty, so use this form in such cases:
                 go test ${short:+-short} ${coverflags[@]} "git.curoverse.com/arvados.git/$1"
             fi
-            result="$?"
+            result=${result:-$?}
             if [[ -f "$WORKSPACE/tmp/.$covername.tmp" ]]
             then
                 go tool cover -html="$WORKSPACE/tmp/.$covername.tmp" -o "$WORKSPACE/tmp/$covername.html"
@@ -538,10 +541,22 @@ do_test_once() {
             fi
         elif [[ "$2" == "pip" ]]
         then
-            # $3 can name a path directory for us to use, including trailing
-            # slash; e.g., the bin/ subdirectory of a virtualenv.
-            cd "$WORKSPACE/$1" \
-                && "${3}python" setup.py ${short:+--short-tests-only} test ${testargs[$1]}
+            tries=0
+            cd "$WORKSPACE/$1" && while :
+            do
+                tries=$((${tries}+1))
+                # $3 can name a path directory for us to use, including trailing
+                # slash; e.g., the bin/ subdirectory of a virtualenv.
+                "${3}python" setup.py ${short:+--short-tests-only} test ${testargs[$1]}
+                result=$?
+                if [[ ${tries} < 3 && ${result} == 137 ]]
+                then
+                    printf '\n*****\n%s tests killed -- retrying\n*****\n\n' "$1"
+                    continue
+                else
+                    break
+                fi
+            done
         elif [[ "$2" != "" ]]
         then
             "test_$2"
@@ -750,8 +765,9 @@ gostuff=(
     services/crunch-dispatch-local
     services/crunch-dispatch-slurm
     services/crunch-run
-    tools/keep-rsync
     tools/keep-block-check
+    tools/keep-exercise
+    tools/keep-rsync
     )
 for g in "${gostuff[@]}"
 do