3021: Do not install *.egg after running tests: "pip install PyYAML" does what we...
[arvados-dev.git] / jenkins / run-tests.sh
index e437a21262ceaa4558650b76098a2a905471cd00..6f425f89ff590529e66e52ff9e3580220f4bf448 100755 (executable)
@@ -47,7 +47,8 @@ https://arvados.org/projects/arvados/wiki/Running_tests
 Available tests:
 
 apps/workbench
-apps/workbench_performance
+apps/workbench_benchmark
+apps/workbench_profile
 doc
 services/api
 services/crunchstat
@@ -124,9 +125,53 @@ report_outcomes() {
         done
     fi
 }
+
+sanity_checks() {
+  # Make sure WORKSPACE is set
+  if ! [[ -n "$WORKSPACE" ]]; then
+    echo >&2 "$helpmessage"
+    echo >&2
+    echo >&2 "Error: WORKSPACE environment variable not set"
+    echo >&2
+    exit 1
+  fi
+
+  # Make sure virtualenv is installed
+  `virtualenv --help >/dev/null 2>&1`
+
+  if [[ "$?" != "0" ]]; then
+    echo >&2
+    echo >&2 "Error: virtualenv could not be found"
+    echo >&2
+    exit 1
+  fi
+
+  # Make sure go is installed
+  `go env >/dev/null 2>&1`
+
+  if [[ "$?" != "0" ]]; then
+    echo >&2
+    echo >&2 "Error: go could not be found"
+    echo >&2
+    exit 1
+  fi
+
+  # Make sure gcc is installed
+  `gcc --help >/dev/null 2>&1`
+
+  if [[ "$?" != "0" ]]; then
+    echo >&2
+    echo >&2 "Error: gcc could not be found"
+    echo >&2
+    exit 1
+  fi
+
+}
+
 declare -a failures
 declare -A skip
 declare -A testargs
+skip[apps/workbench_profile]=1
 
 while [[ -n "$1" ]]
 do
@@ -142,7 +187,7 @@ do
             skip[$skipwhat]=1
             ;;
         --only)
-            only="$1"; shift
+            only="$1"; skip[$1]=""; shift
             ;;
         --skip-install)
             skip_install=1
@@ -167,14 +212,7 @@ do
     esac
 done
 
-# Sanity check
-if ! [[ -n "$WORKSPACE" ]]; then
-  echo >&2 "$helpmessage"
-  echo >&2
-  echo >&2 "Error: WORKSPACE environment variable not set"
-  echo >&2
-  exit 1
-fi
+sanity_checks
 
 echo "WORKSPACE=$WORKSPACE"
 
@@ -287,7 +325,7 @@ then
 fi
 
 # Needed for run_test_server.py which is used by certain (non-Python) tests.
-pip install PyYAML
+pip install PyYAML || fatal "pip install PyYAML failed"
 
 checkexit() {
     if [[ "$?" != "0" ]]; then
@@ -313,19 +351,11 @@ do_test() {
         timer_reset
         if [[ "$2" == "go" ]]
         then
-            go test "${testargs[$1]}" "git.curoverse.com/arvados.git/$1"
+            go test ${testargs[$1]} "git.curoverse.com/arvados.git/$1"
         elif [[ "$2" == "pip" ]]
         then
-           # Other test suites can depend on tests_require
-           # dependencies of this package. For example, keepproxy runs
-           # run_test_server.py, which depends on the yaml package,
-           # which is in sdk/python's tests_require but not
-           # install_requires, and therefore does not get installed by
-           # setuptools until we run "setup.py test" *and* install the
-           # .egg files that setup.py downloads.
            cd "$WORKSPACE/$1" \
-                && python setup.py test ${testargs[$1]} \
-                && (easy_install *.egg || true)
+                && python setup.py test ${testargs[$1]}
         elif [[ "$2" != "" ]]
         then
             "test_$2"
@@ -453,8 +483,8 @@ install_apiserver() {
 
     cd "$WORKSPACE/services/api" \
         && RAILS_ENV=test bundle exec rake db:drop \
-        && RAILS_ENV=test bundle exec rake db:create \
-        && RAILS_ENV=test bundle exec rake db:setup
+        && RAILS_ENV=test bundle exec rake db:setup \
+        && RAILS_ENV=test bundle exec rake db:fixtures:load
 }
 do_install services/api apiserver
 
@@ -504,12 +534,10 @@ do_test sdk/cli cli
 
 test_apiserver() {
     cd "$WORKSPACE/services/api"
-    RAILS_ENV=test bundle exec rake test ${testargs[apiserver]}
+    RAILS_ENV=test bundle exec rake test ${testargs[services/api]}
 }
 do_test services/api apiserver
 
-# We must test sdk/python before testing services/keepproxy, because
-# keepproxy depends on sdk/python's test dependencies.
 for p in "${pythonstuff[@]}"
 do
     do_test "$p" pip
@@ -522,15 +550,21 @@ done
 
 test_workbench() {
     cd "$WORKSPACE/apps/workbench" \
-        && RAILS_ENV=test bundle exec rake test ${testargs[workbench]}
+        && RAILS_ENV=test bundle exec rake test ${testargs[apps/workbench]}
 }
 do_test apps/workbench workbench
 
-test_workbench_performance() {
+test_workbench_benchmark() {
+    cd "$WORKSPACE/apps/workbench" \
+        && RAILS_ENV=test bundle exec rake test:benchmark ${testargs[apps/workbench_benchmark]}
+}
+do_test apps/workbench_benchmark workbench_benchmark
+
+test_workbench_profile() {
     cd "$WORKSPACE/apps/workbench" \
-        && RAILS_ENV=test bundle exec rake test:benchmark
+        && RAILS_ENV=test bundle exec rake test:profile ${testargs[apps/workbench_profile]}
 }
-do_test apps/workbench_performance workbench_performance
+do_test apps/workbench_profile workbench_profile
 
 report_outcomes
 clear_temp