forked from mozilla/version-control-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-test-environment
executable file
·122 lines (97 loc) · 2.92 KB
/
create-test-environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
set +e
# Quick and dirty check for SSL support provided with this Python. We check
# this way because some distros have backported the necessary SSL support
# into early Python versions, and we can't tell if we have what we need from
# the Python version alone.
python -c 'import ssl; ssl.SSLContext; ssl.PROTOCOL_TLSv1_2'
sslcheck=$?
set -e
if [ "$sslcheck" -ne 0 ]; then
echo "Python version does not support verifying SSL certificates for secure"
echo "downloads! Please upgrade your version of Python."
exit 1
fi
ROOT=`pwd`
VENV=${ROOT}/venv
if [ ! -d ${VENV}/lib ]; then
# There is a bug in pycrypto where it tries to invoke `configure` instead
# of a path qualified configure. So if there is a "configure" on $PATH
# it will invoke the wrong one.
configure=which configure &>/dev/null || true
if [ "x" != "x${configure}" ]; then
echo "configure in PATH; pycrypto install will fail!"
echo "Remove the path containing ${configure} from PATH"
exit 1
fi
. ${ROOT}/testing/create-virtualenv
fi
cd ${ROOT}
source ${VENV}/bin/activate
pip install --upgrade --require-hashes -r test-requirements.txt
cd hgserver/hgmolib
python setup.py develop
cd ../..
cd pylib/Bugsy
python setup.py develop
cd ../..
cd pylib/mozansible
python setup.py develop
cd ../..
cd pylib/mozhg
python setup.py develop
cd ../..
cd pylib/mozhginfo
python setup.py develop
cd ../..
cd pylib/mozautomation
python setup.py develop
cd ../..
cd pylib/vcsreplicator
python setup.py develop
cd ../..
cd hghooks
python setup.py develop
cd ..
cd testing
python setup.py develop
cd ..
# Collect code coverage from all Python processes if environment variable
# is set.
cat > venv/bin/sitecustomize.py << 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
cov.start()
EOF
python -m vcttesting.environment install-mercurials
if [ ! -d venv/git-cinnabar ]; then
echo "Cloning git-cinnabar"
git clone --branch release https://github.com/glandium/git-cinnabar.git venv/git-cinnabar
fi
cd venv/git-cinnabar
git pull
git submodule update --init
make -j4 helper NO_OPENSSL=1 NO_GETTEXT=1
cd ../..
if [ -z "${NO_DOCKER}" ]; then
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 || {
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
}
else
echo "Not building Docker images because NO_DOCKER is set."
fi
echo finished creating test environment!