Bug 805297 - Marionette doesn't recognize relative test path from current working directory. r=jgriffin
authorHenrik Skupin <hskupin@mozilla.com>
Thu, 25 Oct 2012 16:30:32 -0400
changeset 111573 48d71f46115247b5d309233f9dd4a23ed7794d2b
parent 111572 a63eeede2d15cc6ed00eedb512ae2fecd3e7b522
child 111574 4ceee39f20faf19152037b65cfdf59cbfea208cf
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjgriffin
bugs805297
milestone19.0a1
Bug 805297 - Marionette doesn't recognize relative test path from current working directory. r=jgriffin
testing/marionette/client/marionette/venv_test.sh
--- a/testing/marionette/client/marionette/venv_test.sh
+++ b/testing/marionette/client/marionette/venv_test.sh
@@ -1,54 +1,56 @@
 #!/bin/bash
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PYTHON=$1
 
+# Store the current working directory so we can change back into it after
+# preparing the Marionette virtualenv
+CWD=$(pwd)
+
 if [ -z "${PYTHON}" ]
 then
     echo "No python found"
     exit 1
 fi
 
-# Determine the absolute path of our location.
-MARIONETTE_HOME=`dirname $0`
-cd $MARIONETTE_HOME
-MARIONETTE_HOME=`dirname $PWD`
+# Determine the absolute path of the Marionette home folder
+MARIONETTE_HOME=$(cd `dirname $BASH_SOURCE`; dirname `pwd`)
 echo "Detected Marionette home in $MARIONETTE_HOME"
 
 # If a GECKO_OBJDIR environemnt variable exists, we will create the Python
 # virtual envirnoment there. Otherwise we create it in the PWD.
 VENV_DIR="marionette_venv"
 if [ -z $GECKO_OBJDIR ]
 then
     VENV_DIR="$MARIONETTE_HOME/$VENV_DIR"
 else
     VENV_DIR="$GECKO_OBJDIR/$VENV_DIR"
 fi
 
 # Check if environment exists, if not, create a virtualenv:
 if [ -d $VENV_DIR ]
 then
   echo "Using virtual environment in $VENV_DIR"
-  cd $VENV_DIR
-  . bin/activate
+  . $VENV_DIR/bin/activate
 else
   echo "Creating a virtual environment in $VENV_DIR"
   curl https://raw.github.com/pypa/virtualenv/develop/virtualenv.py | ${PYTHON} - $VENV_DIR
-  cd $VENV_DIR
-  . bin/activate
+  . $VENV_DIR/bin/activate
+
   # set up mozbase
-  git clone git://github.com/mozilla/mozbase.git
-  cd mozbase
-  python setup_development.py
+  git clone git://github.com/mozilla/mozbase.git $VENV_DIR/mozbase
+  python $VENV_DIR/mozbase/setup_development.py
 fi
 
-# update the marionette_client
+# Updating the marionette_client needs us to change into its package folder.
+# Otherwise the call to setup.py will hang
 cd $MARIONETTE_HOME
 python setup.py develop
-cd marionette
+cd $CWD
 
 # pop off the python parameter
 shift
-python runtests.py $@
+
+python $MARIONETTE_HOME/marionette/runtests.py $@