15044: Override unusable nginx defaults. Test nginx startup success.
[arvados.git] / build / run-tests.sh
index c35b5442758d42d5fb3c1ff8c2c32a58189dbf44..9614ff5b10e919ff6defbd2afbc5f618f5adf7fb 100755 (executable)
@@ -85,6 +85,7 @@ lib/dispatchcloud/container
 lib/dispatchcloud/scheduler
 lib/dispatchcloud/ssh_executor
 lib/dispatchcloud/worker
+lib/service
 services/api
 services/arv-git-httpd
 services/crunchstat
@@ -123,6 +124,7 @@ sdk/cwl
 sdk/R
 tools/sync-groups
 tools/crunchstat-summary
+tools/crunchstat-summary:py3
 tools/keep-exercise
 tools/keep-rsync
 tools/keep-block-check
@@ -390,6 +392,10 @@ start_services() {
         && (env | egrep ^ARVADOS) \
         || fail=1
     deactivate
+    if [[ $fail = 0 ]] && ! kill -0 "$(cat "$WORKSPACE/tmp/nginx.pid")"; then
+        echo >&2 "ERROR: nginx seems to have died already"
+        fail=1
+    fi
     if [[ $fail != 0 ]]; then
         unset ARVADOS_TEST_API_HOST
     fi
@@ -952,6 +958,7 @@ gostuff=(
     lib/dispatchcloud/scheduler
     lib/dispatchcloud/ssh_executor
     lib/dispatchcloud/worker
+    lib/service
     sdk/go/arvados
     sdk/go/arvadosclient
     sdk/go/auth
@@ -1061,6 +1068,7 @@ test_apps/workbench_profile() {
 install_deps() {
     # Install parts needed by test suites
     do_install env
+    do_install cmd/arvados-server go
     do_install sdk/cli
     do_install sdk/perl
     do_install sdk/python pip
@@ -1146,13 +1154,14 @@ test_all() {
 
 help_interactive() {
     echo "== Interactive commands:"
-    echo "TARGET           (short for 'test DIR')"
+    echo "TARGET                 (short for 'test DIR')"
     echo "test TARGET"
-    echo "test TARGET:py3  (test with python3)"
+    echo "test TARGET:py3        (test with python3)"
+    echo "test TARGET -check.vv  (pass arguments to test)"
     echo "install TARGET"
-    echo "install env      (go/python libs)"
-    echo "install deps     (go/python libs + arvados components needed for integration tests)"
-    echo "reset            (...services used by integration tests)"
+    echo "install env            (go/python libs)"
+    echo "install deps           (go/python libs + arvados components needed for integration tests)"
+    echo "reset                  (...services used by integration tests)"
     echo "exit"
     echo "== Test targets:"
     echo "${!testfuncargs[@]}" | tr ' ' '\n' | sort | column
@@ -1166,32 +1175,42 @@ for g in "${gostuff[@]}"; do
 done
 for p in "${pythonstuff[@]}"; do
     dir=${p%:py3}
-    if [[ ${dir} = ${p} ]]; then
-        testfuncargs[$p]="$dir pip $VENVDIR/bin/"
-    else
-        testfuncargs[$p]="$dir pip $VENV3DIR/bin/"
-    fi
+    testfuncargs[$dir]="$dir pip $VENVDIR/bin/"
+    testfuncargs[$dir:py3]="$dir pip $VENV3DIR/bin/"
 done
 
 if [[ -z ${interactive} ]]; then
     install_all
     test_all
 else
+    skip=()
+    only=()
+    only_install=()
     if [[ -e "$VENVDIR/bin/activate" ]]; then stop_services; fi
-    setreaddefault() {
-        readdefault="$verb $target"
-        if [[ -n "$verb" && "$readdefault" != "install deps" ]]; then
+    setnextcmd() {
+        if [[ "$TERM" = dumb ]]; then
+            # assume emacs, or something, is offering a history buffer
+            # and pre-populating the command will only cause trouble
+            nextcmd=
+        elif [[ "$nextcmd" != "install deps" ]]; then
             :
         elif [[ -e "$VENVDIR/bin/activate" ]]; then
-            readdefault="test lib/cmd"
+            nextcmd="test lib/cmd"
         else
-            readdefault="install deps"
+            nextcmd="install deps"
         fi
     }
     echo
     help_interactive
-    setreaddefault
-    while read -p 'What next? ' -e -i "${readdefault}" verb target; do
+    nextcmd="install deps"
+    setnextcmd
+    while read -p 'What next? ' -e -i "${nextcmd}" nextcmd; do
+        read verb target opts <<<"${nextcmd}"
+        target="${target%/}"
+        target="${target/\/:/:}"
+        if [[ -z "${target}" ]]; then
+            verb=help
+        fi
         case "${verb}" in
             "" | "help")
                 help_interactive
@@ -1203,11 +1222,7 @@ else
                 stop_services
                 ;;
             *)
-                if [[ -z "${target}" ]]; then
-                    target="${verb}"
-                    verb=test
-                fi
-                target="${target%/}"
+                testargs["$target"]="${opts}"
                 case "$target" in
                     all | deps)
                         ${verb}_${target}
@@ -1226,7 +1241,7 @@ else
             failures=()
         fi
         cd "$WORKSPACE"
-        setreaddefault
+        setnextcmd
     done
     echo
 fi