mozreview: added MOZREVIEW_BUILD_FORKS environment variable (
bug 1277903)
The MOZREVIEW_BUILD_FORKS environment variable controls the
create-test-environment and start-local-mozreview scripts. Its value is
passed to the --forks option in the underlying tools. The intention is
that developers set the new environment variable in low-resource or
debugging environments.
MozReview-Commit-ID: JIiBWsOnZux
--- a/create-test-environment
+++ b/create-test-environment
@@ -1,12 +1,19 @@
#!/bin/bash
set -e
+if [ -n "$MOZREVIEW_BUILD_FORKS" ]; then
+ # include --forks switch to build scripts
+ FORKS="--forks=$MOZREVIEW_BUILD_FORKS"
+else
+ FORKS=''
+fi
+
vercheck=`python -c 'import sys; print(sys.version_info[0:3] >= (2, 7, 9))'`
if [ "x${vercheck}" != "xTrue" ]; then
echo "Python version too old. Test environment requires 2.7.9+"
exit 1
fi
# We need node.js for tools required to package/install Review Board
# (eg. lessc, uglifyjs)
@@ -218,16 +225,16 @@ fi
git -C venv/git-cinnabar pull
echo ""
echo "Building Docker images."
echo "This could take a while and may consume a lot of internet bandwidth."
echo "If you don't want Docker images, it is safe to hit CTRL+c to abort this."
-./d0cker build-all || {
+./d0cker build-all $FORKS || {
echo "You will not be able to run tests that require Docker.";
echo "Please see https://docs.docker.com/installation/ for how to install Docker.";
echo "When Docker is installed, re-run this script";
exit 1
}
echo finished creating test environment
--- a/start-local-mozreview
+++ b/start-local-mozreview
@@ -1,33 +1,40 @@
#!/bin/bash
# This script starts the mozreview servers, creates a default user, some bugs
# and a properly configured mercurial repository for pushing reviews.
# You need to source this script (e.g. run with ". start-local-mozreview") in
# order for the environment variables to be set correctly.
set -eo pipefail
+if [ -n "$MOZREVIEW_BUILD_FORKS" ]; then
+ # include --forks switch to build scripts
+ FORKS="--forks=$MOZREVIEW_BUILD_FORKS"
+else
+ FORKS=''
+fi
+
TEST_MOZREVIEW_NAME=mozreview-test
TEST_REPO_NAME=local-mozreview-test-repo
VCT_PATH=`pwd`
cd ..
PARENT_PATH=`pwd`
cd $VCT_PATH
REPO_PATH=$PARENT_PATH/$TEST_REPO_NAME
TEST_MOZREVIEW_PATH=$PARENT_PATH/$TEST_MOZREVIEW_NAME
export MOZREVIEW_HOME=$TEST_MOZREVIEW_PATH
. venv/bin/activate
./mozreview stop $TEST_MOZREVIEW_PATH
-./mozreview start --reviewboard-port=55556 $TEST_MOZREVIEW_PATH
+./mozreview start --reviewboard-port=55556 $FORKS $TEST_MOZREVIEW_PATH
$(./mozreview shellinit)
./mozreview create-repo test-repo
./mozreview create-user default@example.com password 'Default User :default' \
--uid 2000 --scm-level 1 --bugzilla-group editbugs
./reviewboard associate-ldap-user default default@example.com