-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests
executable file
·355 lines (317 loc) · 9.63 KB
/
run_tests
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#!/bin/bash
#
# Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------
# MODULE_LIST determines the order in which modules are run.
# Quicker tests should run before slower ones.
MODULE_LIST="
signing
cli
rest_api
poet
settings
permission
validator
go_sdk
java_sdk
javascript_sdk
python_sdk
rust_sdk
burrow_evm
integration
"
usage() {
echo "Usage:"
echo " $0 [-m Module] [-x Module] [-i Module]"
echo " (-m, -x and -i can be passed multiple times)"
echo ""
echo "Options:"
echo " -h print usage and exit"
echo " -m Module only run tests of specified module"
echo " -x Module exclude the tests of specified module"
echo " -i Module include the tests of specified module"
echo ""
echo "Current modules: $MODULE_LIST"
}
# Exit on non-zero exit code from subcommand
set -e
# Set sawtooth-core project directory relative to this file
PROJECT_DIR=$(cd $(dirname $(dirname $0)) && pwd)
# Make sawtooth scripts accessible
PATH=$PROJECT_DIR/bin:$PATH
if [ ! -d "$PROJECT_DIR/coverage" ]; then
mkdir $PROJECT_DIR/coverage
fi
# Default args
MODULES=""
EXCLUDE=""
INCLUDE=""
while getopts i:x:m:h opt
do
case $opt in
h)
usage
exit 0
;;
m)
MODULES="$MODULES $OPTARG"
;;
x)
EXCLUDE="$EXCLUDE $OPTARG"
;;
i)
INCLUDE="$INCLUDE $OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 2
;;
esac
done
# If no '-m' flags are passed, run these modules
if [[ $MODULES = "" ]]
then
MODULES=$MODULE_LIST
fi
MODULES="$INCLUDE $MODULES"
main() {
# Start in project directory
cd $PROJECT_DIR
for module in $MODULES
do
# Check if we are skipping this module
skip=0
for exclude in $EXCLUDE
do
if [[ $module == $exclude ]]
then
skip=1
break
fi
done
if [[ $skip == 1 ]]
then
echo "[---Skipping $module tests---]"
else
echo "[---Running $module tests---]"
case $module in
signing)
test_signing
;;
cli)
test_cli
;;
rest_api)
test_rest_api
;;
poet)
test_poet_cli
test_poet_common
test_poet_core
test_poet_simulator
test_poet_families
test_ias
;;
poet_cli)
test_poet_cli
;;
poet_common)
test_poet_common
;;
poet_core)
test_poet_core
;;
poet_simulator)
test_poet_simulator
;;
poet_families)
test_poet_families
;;
ias)
test_ias
;;
settings)
test_settings
;;
supplychain)
test_supplychain
;;
permission)
test_permission
;;
validator)
test_validator
;;
go_sdk)
test_go_sdk
;;
java_sdk)
test_java_sdk
;;
javascript_sdk)
test_javascript_sdk
;;
python_sdk)
test_python_sdk
;;
rust_sdk)
test_rust_sdk
;;
integration)
test_integration
;;
deployment)
test_deployment
;;
burrow_evm)
test_burrow_evm
;;
*)
echo "Module '$MODULE' not found."
;;
esac
fi
done
}
test_signing() {
run_docker_test ./signing/tests/unit_signing.yaml
copy_coverage .coverage.signing
}
test_cli() {
run_docker_test ./cli/tests/unit_cli.yaml
copy_coverage .coverage.cli
}
test_rest_api() {
run_docker_test ./rest_api/tests/unit_rest_api.yaml
copy_coverage .coverage.rest_api
}
test_poet_cli() {
run_docker_test ./consensus/poet/cli/tests/unit_poet_cli.yaml
copy_coverage .coverage.poet_cli
}
test_poet_common() {
run_docker_test ./consensus/poet/common/tests/unit_poet_common.yaml
copy_coverage .coverage.poet_common
}
test_poet_core() {
run_docker_test ./consensus/poet/core/tests/unit_poet_core.yaml
copy_coverage .coverage.poet_core
}
test_poet_simulator() {
run_docker_test ./consensus/poet/simulator/tests/unit_poet_simulator.yaml
copy_coverage .coverage.poet_simulator
}
test_poet_families() {
run_docker_test ./consensus/poet/families/tests/test_tp_validator_registry.yaml
copy_coverage .coverage.poet_families
}
test_ias() {
run_docker_test ./utility/ias_client/tests/unit_ias_client.yaml
copy_coverage .coverage.ias
}
test_settings() {
run_docker_test ./families/settings/tests/test_tp_settings.yaml
copy_coverage .coverage.config
run_docker_test test_config_smoke
copy_coverage .coverage.test_config_smoke
}
test_permission() {
run_docker_test test_permission
copy_coverage .coverage.permission
}
test_supplychain() {
run_docker_test ./families/supplychain/python/tests/unit_supplychain_python.yaml
copy_coverage .coverage.config
run_docker_test ./families/supplychain/python/tests/test_tp_supplychain_python.yaml
copy_coverage .coverage.config
run_docker_test ./families/supplychain/python/tests/int_supplychain_python.yaml
copy_coverage .coverage.config
}
test_validator() {
run_docker_test ./validator/tests/unit_validator.yaml
copy_coverage .coverage.validator
run_docker_test test_shutdown_smoke.yaml
copy_coverage .coverage.test_shutdown_smoke
}
test_go_sdk() {
run_docker_test ./sdk/go/tests/unit_go_client.yaml
run_docker_test ./sdk/examples/intkey_python/tests/test_tp_intkey_go.yaml
run_docker_test ./sdk/examples/xo_python/tests/test_tp_xo_go.yaml
copy_coverage .coverage.go_sdk
run_docker_test test_xo_smoke_go
copy_coverage .coverage.test_xo_smoke_go
run_docker_test test_intkey_smoke_go
copy_coverage .coverage.test_intkey_smoke_go
}
test_java_sdk() {
run_docker_test ./sdk/examples/intkey_python/tests/test_tp_intkey_java.yaml
copy_coverage .coverage.java_sdk
run_docker_test test_intkey_smoke_java
copy_coverage .coverage.test_intkey_smoke_java
run_docker_test ./sdk/examples/xo_python/tests/test_tp_xo_java.yaml
copy_coverage .coverage.test_tp_xo_java
run_docker_test test_xo_smoke_java
copy_coverage .coverage.test_xo_java_smoke
}
test_javascript_sdk() {
run_docker_test ./sdk/examples/intkey_python/tests/test_tp_intkey_javascript.yaml
copy_coverage .coverage.test_tp_intkey_javascript
run_docker_test test_intkey_smoke_javascript
copy_coverage .coverage.test_intkey_smoke_javascript
run_docker_test ./sdk/examples/xo_python/tests/test_tp_xo_javascript.yaml
copy_coverage .coverage.test_tp_xo_javascript
run_docker_test test_xo_smoke_javascript
copy_coverage .coverage.test_xo_smoke_javascript
}
test_python_sdk() {
run_docker_test ./sdk/examples/intkey_python/tests/test_tp_intkey_python.yaml
copy_coverage .coverage.test_tp_intkey_python
run_docker_test ./sdk/examples/xo_python/tests/test_tp_xo_python.yaml
copy_coverage .coverage.test_tp_xo_python
run_docker_test test_intkey_smoke_python
copy_coverage .coverage.test_intkey_smoke_python
run_docker_test test_workload
copy_coverage .coverage.workload
run_docker_test test_xo_smoke_python
copy_coverage .coverage.test_xo_smoke_python
run_docker_test test_two_families
copy_coverage .coverage.two_families
}
test_rust_sdk() {
run_docker_test ./sdk/rust/unit_rust_sdk.yaml
run_docker_test ./perf/sawtooth_workload/unit_perf_workload.yaml
}
test_burrow_evm() {
run_docker_test ./families/burrow_evm/tests/unit_burrow_evm.yaml
run_docker_test burrow_evm_intkey_test
run_docker_test burrow_evm_perm_test
}
test_integration() {
run_docker_test test_xo_smoke_all
copy_coverage .coverage.test_xo_smoke_all
run_docker_test test_poet_smoke
copy_coverage .coverage.test_poet_smoke
run_docker_test test_dynamic_network --timeout 600
copy_coverage .coverage.test_dynamic_network
run_docker_test test_basic_auth_proxy
copy_coverage .coverage.test_basic_auth_proxy
}
test_deployment() {
run_docker_test test_systemd_services
}
copy_coverage() {
mv -f .coverage $PROJECT_DIR/coverage/$1
}
main