Add some more sanity checks in run-tests.sh, and refactor that part of the script
authorWard Vandewege <ward@curoverse.com>
Tue, 30 Dec 2014 15:04:46 +0000 (10:04 -0500)
committerWard Vandewege <ward@curoverse.com>
Tue, 30 Dec 2014 15:04:46 +0000 (10:04 -0500)
a little.

No issue #

jenkins/run-tests.sh

index 23e89c0f8e2b1ac050da5e913b294f0ccff355c2..93d1c2b1c585a626243201302ff5dd60089cb7ed 100755 (executable)
@@ -124,6 +124,49 @@ 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
@@ -167,14 +210,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"