blob: f6a836dcb381a9ba0a267ec3464a881154cc4499 (
plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#!/bin/bash
NUM_OF_CORES=''
TRIAL_PATH=''
function getTrialAbsolutePath {
TRIAL_PATH="$(which trial)"
}
function resolveNumOfCores {
if [ "$(uname)" == "Darwin" ]; then
NUM_OF_CORES="$(sysctl -n hw.ncpu)"
else
NUM_OF_CORES="$(nproc)"
fi
}
function setuppy {
echo "Installing Pixelated User Agent."
pip install -r test_requirements.txt
python setup.py develop $*
pip uninstall -y scrypt; pip install scrypt
pip uninstall -y gnupg; pip install gnupg==1.2.5
echo "Done."
}
function setupjs {
echo "Installing node and bower libraries."
cd ../web-ui
npm install
node_modules/bower/bin/bower install --config.interactive=false --allow-root
LC_ALL=en_US.UTF-8 ./go build
cd -
echo "Done."
}
function runIntegrationTests {
echo "Executing Integration Tests."
resolveNumOfCores
trial -j $NUM_OF_CORES --reporter=text $* test.integration
echo "Done."
}
function runUnitTests {
echo "Executing Unit Tests."
trial --reporter=text $* test.unit
echo "Done."
}
function runPep8 {
echo "Verifying conformation to pep8."
pep8 pixelated test --ignore=E501
echo "Done."
}
function runJSHint {
echo "Executing JSHint."
cd ../web-ui
LC_ALL=en_US.UTF-8 ./go jshint
cd -
echo "Done."
}
function runCoverageUnit {
echo "Generating Unit Test Converage Information."
coverage erase
getTrialAbsolutePath
coverage run -p --source=pixelated $TRIAL_PATH --reporter=text $* test.unit
coverage combine
coverage html
echo "Done."
}
function runCoverageIntegration {
echo "Generating Integration Test Converage Information."
coverage erase
getTrialAbsolutePath
coverage run -p --source=pixelated $TRIAL_PATH --reporter=text $* test.integration
coverage combine
coverage html
echo "Done."
}
function runCoverageUnitAndIntegration {
echo "Generating Unit and Integration Test Converage Information."
coverage erase
getTrialAbsolutePath
coverage run -p --source=pixelated $TRIAL_PATH --reporter=text test.unit
coverage run -p --source=pixelated $TRIAL_PATH --reporter=text test.integration
coverage combine
coverage html
echo "Done."
}
function runFunctionalTests {
echo "Executing Functional Tests on headless PhantomJS."
echo "You should execute it on Debian box for more similar results with CI environment."
behave --tags ~@wip test/functional/features
echo "Done."
}
if [ "$1" == 'test' ]; then
set -e
runPep8
runUnitTests "${@:2}"
runIntegrationTests "${@:2}"
elif [ "$1" == 'unit' ]; then
set -e
runUnitTests
elif [ "$1" == 'integration' ]; then
set -e
runIntegrationTests
elif [ "$1" == 'pep8' ]; then
set -e
runPep8
elif [ "$1" == 'setuppy' ]; then
setuppy
elif [ "$1" == 'setupjs' ]; then
setupjs
elif [ "$1" == 'setup' ]; then
setupjs
setuppy "${@:2}"
elif [ "$1" == 'coverage_unit' ]; then
runCoverageUnit "${@:2}"
elif [ "$1" == 'coverage_integration' ]; then
runCoverageIntegration "${@:2}"
elif [ "$1" == 'coverage_all' ]; then
runCoverageUnitAndIntegration "${@:2}"
elif [ "$1" == 'start' ]; then
/usr/bin/env pixelated-user-agent "${@:2}"
elif [ "$1" == "functional" ]; then
runFunctionalTests "${@:2}"
else
python setup.py $*
fi
|