author Gregory Szorc <>
Sat, 24 Jan 2015 19:42:03 -0800
changeset 360256 17f4091a1f7b876e4d3a4f50ef06e3886ba80e03
parent 360204 b92cd183053f4d04481e8eb37eef5c6ee807ff28
child 360276 7db4622ae530570abaf69b6ce2ffc6b08bdaa3d8
permissions -rwxr-xr-x
testing: prevent double virtualenv activation The bootstrap code was potentially activating a virtualenv on top of itself. This results in the virtualenv's bin directory always being first in PATH. This threw off hg binary detection when running under --with-hg. Prevent double virtualenv activation.


set -e

if [ ! -d venv ]; then
  virtualenv venv

source venv/bin/activate
pip install --upgrade pip
pip install --upgrade -r test-requirements.txt

# ReviewBoard doesn't work with pip, sadly.
easy_install ReviewBoard==2.0.12

cd pylib/Bugsy
python develop
cd ../..

cd pylib/mozreview
python develop
cd ../..

# rbmozui requires Node.js when installed normally. But in local
# development mode it doesn't. So use local development node.
cd pylib/rbmozui;
python develop
cd ../..

cd pylib/rbbz
python develop
cd ../..

cd hghooks
python develop
cd ..

# Collect code coverage from all Python processes if environment variable
# is set.
cat > venv/bin/ << EOF
import os

if os.environ.get('CODE_COVERAGE', False):
    import uuid
    import coverage

    covpath = os.path.join(os.environ['COVERAGE_DIR'],
        'coverage.%s' % uuid.uuid1())
    cov = coverage.coverage(data_file=covpath, auto_data=True)
    cov._warn_no_data = False
    cov._warn_unimported_source = False

# Ensure system settings don't sneak in and change behavior.
export HGRCPATH=/dev/null

# Install various Mercurial versions for multi-version testing.
if [ ! -d venv/hg ]; then
  hg clone venv/hg

hg -R venv/hg pull


for old in 2.5.4 2.6 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.2 2.8 2.8.1 2.8.2 2.9 2.9.1 2.9.2 3.0 3.0.1 3.1 3.1.1 3.2 3.2.1 3.2.2; do
  rm -rf $mercurials/$old

for v in 3.0.2 3.1.2 3.2.3 3.2.4; do
  if [ ! -d $destdir ]; then
    cd venv/hg
    hg up $v
    make install-bin PREFIX=$destdir
    hg --config extensions.purge= purge --all
    cd ../..

# Install the bleeding edge of Mercurial so we find regressions early.
rm -rf $mercurials/@
cd venv/hg
hg up @
make install-bin PREFIX=$mercurials/@
hg --config extensions.purge= purge --all
cd ../..
echo finished installing Mercurials

DOCKER_STATE_FILE=.docker-state.json testing/ build-mozreview || {
  echo "You will not be able to run tests that require Docker.";
  echo "Please see for how to install Docker.";
  echo "When Docker is installed, re-run this script";

echo finished creating test environment