Merge branch 'master' into 8654-arv-jobs-cwl-runner
[arvados.git] / build / run-tests.sh
index 41b237bc7f8c88f4d31686ac87afee3be46bcfdd..041c7c2f90d4d3d508e18846ec0d7a406ad66eec 100755 (executable)
@@ -2,6 +2,9 @@
 
 . `dirname "$(readlink -f "$0")"`/libcloud-pin
 
+COLUMNS=80
+. `dirname "$(readlink -f "$0")"`/run-library.sh
+
 read -rd "\000" helpmessage <<EOF
 $(basename $0): Install and test Arvados components.
 
@@ -68,7 +71,9 @@ services/keepproxy
 services/keepstore
 services/login-sync
 services/nodemanager
+services/crunch-run
 services/crunch-dispatch-local
+services/crunch-dispatch-slurm
 sdk/cli
 sdk/pam
 sdk/python
@@ -99,8 +104,6 @@ PYTHONPATH=
 GEMHOME=
 PERLINSTALLBASE=
 
-COLUMNS=80
-
 skip_install=
 temp=
 temp_preserve=
@@ -122,24 +125,6 @@ fatal() {
     exit 1
 }
 
-report_outcomes() {
-    for x in "${successes[@]}"
-    do
-        echo "Pass: $x"
-    done
-
-    if [[ ${#failures[@]} == 0 ]]
-    then
-        echo "All test suites passed."
-    else
-        echo "Failures (${#failures[@]}):"
-        for x in "${failures[@]}"
-        do
-            echo "Fail: $x"
-        done
-    fi
-}
-
 exit_cleanly() {
     trap - INT
     create-plot-data-from-log.sh $BUILD_NUMBER "$WORKSPACE/apps/workbench/log/test.log" "$WORKSPACE/apps/workbench/log/"
@@ -468,25 +453,8 @@ then
     gem install --user-install bundler || fatal 'Could not install bundler'
 fi
 
-checkexit() {
-    if [[ "$1" != "0" ]]; then
-        title "!!!!!! $2 FAILED !!!!!!"
-        failures+=("$2 (`timer`)")
-    else
-        successes+=("$2 (`timer`)")
-    fi
-}
-
-timer_reset() {
-    t0=$SECONDS
-}
-
-timer() {
-    echo -n "$(($SECONDS - $t0))s"
-}
-
-do_test() {
-    while ! do_test_once ${@} && [[ "$retry" == 1 ]]
+retry() {
+    while ! ${@} && [[ "$retry" == 1 ]]
     do
         read -p 'Try again? [Y/n] ' x
         if [[ "$x" != "y" ]] && [[ "$x" != "" ]]
@@ -496,6 +464,10 @@ do_test() {
     done
 }
 
+do_test() {
+    retry do_test_once ${@}
+}
+
 do_test_once() {
     unset result
     if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
@@ -548,6 +520,10 @@ do_test_once() {
 }
 
 do_install() {
+    retry do_install_once ${@}
+}
+
+do_install_once() {
     if [[ -z "$skip_install" || (-n "$only_install" && "$only_install" == "$1") ]]
     then
         title "Running $1 install"
@@ -580,18 +556,15 @@ do_install() {
         else
             "install_$1"
         fi
-        checkexit $? "$1 install"
+        result=$?
+        checkexit $result "$1 install"
         title "End of $1 install (`timer`)"
+        return $result
     else
         title "Skipping $1 install"
     fi
 }
 
-title () {
-    txt="********** $1 **********"
-    printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
-}
-
 bundle_install_trylocal() {
     (
         set -e
@@ -733,6 +706,7 @@ gostuff=(
     services/datamanager/keep
     services/datamanager
     services/crunch-dispatch-local
+    services/crunch-dispatch-slurm
     services/crunch-run
     tools/keep-rsync
     )
@@ -763,6 +737,7 @@ do_test doc doclinkchecker
 stop_services
 
 test_apiserver() {
+    rm -f "$WORKSPACE/services/api/git-commit.version"
     cd "$WORKSPACE/services/api" \
         && RAILS_ENV=test bundle exec rake test TESTOPTS=-v ${testargs[services/api]}
 }