-
Notifications
You must be signed in to change notification settings - Fork 135
/
run-tests.sh
executable file
·75 lines (61 loc) · 2.04 KB
/
run-tests.sh
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
#!/bin/sh
# Copyright 2016 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.
set -e
# When installing from sdist, the pip freeze output cannot be used to
# detect editable mode. Use the "--sdist-mode" flag.
sdist_mode=$1
python3 -m pip freeze | grep -qi /brainiak \
|| [ ${sdist_mode:-default} = "--sdist-mode" ] \
|| {
echo "You must install brainiak in editable mode"`
`" before calling "$(basename "$0")
exit 1
}
# Define MKL env variable that is required by Theano to run with MKL 2018
# If removing, also remove from .conda/*
export MKL_THREADING_LAYER=GNU
mpi_command=$BRAINIAKDEV_MPI_COMMAND
if [ -z $mpi_command ]
then
mpi_command=mpiexec
fi
echo "Using mpi command: ${mpi_command}"
$mpi_command -n 2 coverage run -m mpi4py -m pytest
# Check whether we are running on Princeton's della compute cluster.
# If so, run the notebook tests separately
if [[ $(hostname -s) == della* ]];
then
echo "Running non-MPI notebook tests on della"
$mpi_command -n 1 pytest -s --durations=0 tests/test_notebooks.py --enable_notebook_tests
fi
# Coverage produces empty files which trigger warnings on combine
find . -name ".coverage.*" -size 0 -print0 | xargs -0 rm -f
coverage combine
# Travis error workaround
coverage_report=$(mktemp -u coverage_report_XXXXX) || {
echo "mktemp -u error" >&2;
exit 1;
}
set +e
coverage report > $coverage_report
report_exit_code=$?
coverage html
coverage xml
cat $coverage_report
rm $coverage_report
if [ $report_exit_code = 2 ]
then
echo "WARNING: Coverage too low."
fi