[ARVADOS-DEV] created: 8c67902ccd67de79c0c86c85116c46b5dcfd82bb

git at public.curoverse.com git at public.curoverse.com
Thu Sep 18 17:04:43 EDT 2014


        at  8c67902ccd67de79c0c86c85116c46b5dcfd82bb (commit)


commit 8c67902ccd67de79c0c86c85116c46b5dcfd82bb
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Sep 18 17:00:58 2014 -0400

    3894: Fix backward empty/nonempty logic.

diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh
index f63267e..54c378b 100755
--- a/jenkins/run-tests.sh
+++ b/jenkins/run-tests.sh
@@ -64,6 +64,26 @@ then
     source /etc/profile.d/rvm.sh
 fi
 
+declare -A leave_temp
+clear_temp() {
+    leaving=""
+    for var in VENVDIR GOPATH
+    do
+        if [[ -z "${leave_temp[$var]}" ]]
+        then
+            if [[ -n "${!var}" ]]
+            then
+                rm -rf "${!var}"
+            fi
+        else
+            leaving+=" $var=\"${!var}\""
+        fi
+    done
+    if [[ -z "$leaving" ]]; then
+        echo "Leaving behind temp dirs: $leaving"
+    fi
+}
+
 fatal() {
     clear_temp
     echo >&2 "Fatal: $* in ${FUNCNAME[1]} at ${BASH_SOURCE[1]} line ${BASH_LINENO[0]}"
@@ -72,7 +92,6 @@ fatal() {
 
 declare -a failures
 declare -A skip
-declare -A leave_temp
 
 # Always skip CLI tests. They don't know how to use run_test_server.py.
 skip[cli]=1
@@ -118,14 +137,14 @@ fi
 
 # Set up temporary install dirs (unless existing dirs were supplied)
 if [[ -n "$VENVDIR" ]]; then
-    VENVDIR=$(mktemp -d)
-else
     leave_temp[VENVDIR]=1
+else
+    VENVDIR=$(mktemp -d)
 fi
 if [[ -n "$GOPATH" ]]; then
-    GOPATH=$(mktemp -d)
-else
     leave_temp[GOPATH]=1
+else
+    GOPATH=$(mktemp -d)
 fi
 export GOPATH
 mkdir -p "$GOPATH/src/git.curoverse.com"
@@ -193,21 +212,6 @@ title () {
     printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
 }
 
-clear_temp() {
-    for var in VENVDIR GOPATH
-    do
-        if [[ -z "${leave_temp[$var]}" ]]
-        then
-            if [[ -n "${!var}" ]]
-            then
-                rm -rf "${!var}"
-            fi
-        else
-            echo "Leaving $var=\"${!var}\""
-        fi
-    done
-}
-
 test_docs() {
     cd "$WORKSPACE/doc"
     bundle install --no-deployment

commit 3052322166d7f44270479f7421275732582542e0
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Sep 18 13:35:06 2014 -0400

    3894: Do not create and abandon new temp dirs if caller has already
    provided existing ones. Never delete temp dirs supplied by caller even
    if the caller (like the help text) forgets to specify --leave-temp.

diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh
index 30712eb..f63267e 100755
--- a/jenkins/run-tests.sh
+++ b/jenkins/run-tests.sh
@@ -48,8 +48,8 @@ unset $(env | cut -d= -f1 | grep \^ARVADOS_)
 
 COLUMNS=80
 
-export GOPATH=$(mktemp -d)
-VENVDIR=$(mktemp -d)
+GOPATH=
+VENVDIR=
 cli_test=
 workbench_test=
 apiserver_test=
@@ -72,6 +72,7 @@ fatal() {
 
 declare -a failures
 declare -A skip
+declare -A leave_temp
 
 # Always skip CLI tests. They don't know how to use run_test_server.py.
 skip[cli]=1
@@ -91,7 +92,8 @@ do
             skip_install=1
             ;;
         --leave-temp)
-            leave_temp=1
+            leave_temp[VENVDIR]=1
+            leave_temp[GOPATH]=1
             ;;
         *=*)
             eval $(echo $arg | cut -d= -f1)=\"$(echo $arg | cut -d= -f2-)\"
@@ -114,7 +116,18 @@ if [[ -n "$CONFIGSRC" ]]; then
     fi
 fi
 
-# Set up temporary install dirs
+# Set up temporary install dirs (unless existing dirs were supplied)
+if [[ -n "$VENVDIR" ]]; then
+    VENVDIR=$(mktemp -d)
+else
+    leave_temp[VENVDIR]=1
+fi
+if [[ -n "$GOPATH" ]]; then
+    GOPATH=$(mktemp -d)
+else
+    leave_temp[GOPATH]=1
+fi
+export GOPATH
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
     || fatal "symlink failed"
@@ -181,19 +194,18 @@ title () {
 }
 
 clear_temp() {
-    if [[ -z "$leave_temp" ]]
-    then
-        for t in "$VENVDIR" "$GOPATH"
-        do
-            if [[ -n "$t" ]]
+    for var in VENVDIR GOPATH
+    do
+        if [[ -z "${leave_temp[$var]}" ]]
+        then
+            if [[ -n "${!var}" ]]
             then
-                rm -rf "$t"
+                rm -rf "${!var}"
             fi
-        done
-    else
-        echo "Leaving VENVDIR=\"$VENVDIR\""
-        echo "Leaving GOPATH=\"$GOPATH\""
-    fi
+        else
+            echo "Leaving $var=\"${!var}\""
+        fi
+    done
 }
 
 test_docs() {

commit 9022eaebb83e9ab8c53e0ca61c1b44841f0cc809
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Sep 18 13:14:50 2014 -0400

    3894: Accept WORKSPACE=foo on command line. Copy config from CONFIGSRC
    instead of hard-coded location. Skip this if they don't exist in the
    previously hard-coded location and CONFIGSRC is not given.

diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh
index 8e04550..30712eb 100755
--- a/jenkins/run-tests.sh
+++ b/jenkins/run-tests.sh
@@ -7,6 +7,8 @@
 # Arguments:
 # --skip FOO     Do not test the FOO component.
 # --only FOO     Do not test anything except the FOO component.
+# WORKSPACE=path Arvados source tree to test.
+# CONFIGSRC=path Dir with api server config files to copy into source tree.
 # envvar=value   Set $envvar to value
 #
 # Regardless of which components are tested, install all components in
@@ -68,18 +70,6 @@ fatal() {
     exit 1
 }
 
-# Sanity check
-echo "WORKSPACE=$WORKSPACE"
-[[ -n "$WORKSPACE" ]] || fatal "WORKSPACE not set"
-
-# Set up temporary install dirs
-mkdir -p "$GOPATH/src/git.curoverse.com"
-ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
-    || fatal "symlink failed"
-
-virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
-PATH="$VENVDIR/bin:$PATH"
-
 declare -a failures
 declare -A skip
 
@@ -113,6 +103,25 @@ do
     esac
 done
 
+# Sanity check
+echo "WORKSPACE=$WORKSPACE"
+[[ -n "$WORKSPACE" ]] || fatal "WORKSPACE not set"
+
+if [[ -n "$CONFIGSRC" ]]; then
+    if [[ -d "$HOME/arvados-api-server" ]]; then
+        # Jenkins expects us to use this by default.
+        CONFIGSRC="$HOME/arvados-api-server"
+    fi
+fi
+
+# Set up temporary install dirs
+mkdir -p "$GOPATH/src/git.curoverse.com"
+ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
+    || fatal "symlink failed"
+
+virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
+PATH="$VENVDIR/bin:$PATH"
+
 checkexit() {
     if [[ "$?" != "0" ]]; then
         title "!!!!!! $1 FAILED !!!!!!"
@@ -241,8 +250,13 @@ install_apiserver() {
     rm -f config/environments/test.rb
     cp config/environments/test.rb.example config/environments/test.rb
 
-    cp $HOME/arvados-api-server/database.yml config/ || fatal "database.yml"
-    cp $HOME/arvados-api-server/application.yml config/ || fatal "application.yml"
+    if [ -n "$CONFIGSRC" ]
+    then
+        for f in database.yml application.yml
+        do
+            cp "$CONFIGSRC/$f" config/ || fatal "$f"
+        done
+    fi
 
     # Fill in a random secret_token and blob_signing_key for testing
     SECRET_TOKEN=`echo 'puts rand(2**512).to_s(36)' |ruby`

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list