testing/xpcshell/b2g_xpcshell_venv.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/xpcshell/b2g_xpcshell_venv.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +#!/bin/bash
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 +# You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +PYTHON=$1
    1.10 +
    1.11 +if [ -z "${PYTHON}" ]
    1.12 +then
    1.13 +    echo "No python found"
    1.14 +    exit 1
    1.15 +fi
    1.16 +
    1.17 +if [ -z "${MARIONETTE_HOME}" ]
    1.18 +then
    1.19 +    echo "No MARIONETTE_HOME found"
    1.20 +    exit 1
    1.21 +fi
    1.22 +
    1.23 +if [ -z "${XPCSHELLTEST_HOME}" ]
    1.24 +then
    1.25 +    echo "No XPCSHELLTEST_HOME found"
    1.26 +    exit 1
    1.27 +fi
    1.28 +
    1.29 +echo "Detected Marionette home in $MARIONETTE_HOME"
    1.30 +
    1.31 +# If a GECKO_OBJDIR environemnt variable exists, we will create the Python
    1.32 +# virtual envirnoment there. Otherwise we create it in the PWD.
    1.33 +VENV_DIR="marionette_venv"
    1.34 +if [ -z $GECKO_OBJDIR ]
    1.35 +then
    1.36 +    VENV_DIR="$MARIONETTE_HOME/$VENV_DIR"
    1.37 +else
    1.38 +    VENV_DIR="$GECKO_OBJDIR/$VENV_DIR"
    1.39 +fi
    1.40 +
    1.41 +# Check if environment exists, if not, create a virtualenv:
    1.42 +if [ -d $VENV_DIR ]
    1.43 +then
    1.44 +  echo "Using virtual environment in $VENV_DIR"
    1.45 +  cd $VENV_DIR
    1.46 +  . bin/activate
    1.47 +else
    1.48 +  echo "Creating a virtual environment in $VENV_DIR"
    1.49 +  curl https://raw.github.com/pypa/virtualenv/develop/virtualenv.py | ${PYTHON} - $VENV_DIR
    1.50 +  cd $VENV_DIR
    1.51 +  . bin/activate
    1.52 +  # set up mozbase
    1.53 +  git clone git://github.com/mozilla/mozbase.git
    1.54 +  cd mozbase
    1.55 +  python setup_development.py
    1.56 +fi
    1.57 +
    1.58 +# update the marionette_client
    1.59 +cd $MARIONETTE_HOME
    1.60 +python setup.py develop
    1.61 +
    1.62 +cd $XPCSHELLTEST_HOME
    1.63 +
    1.64 +# pop off the python parameter
    1.65 +shift
    1.66 +python runtestsb2g.py $@

mercurial