-
Notifications
You must be signed in to change notification settings - Fork 14
/
test_all.sh
executable file
·110 lines (97 loc) · 2.65 KB
/
test_all.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
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
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
MYNAME=$(basename $(readlink -f $0))
MYDIR=$(dirname $(readlink -f $0))
toaddr() {
if [ $(whoami) == 'userrig' ]; then
echo "rpd@gis.a-star.edu.sg";
else
echo "$(whoami)@gis.a-star.edu.sg";
fi
}
usage() {
echo "$MYNAME: run all pipeline tests"
echo " -d: Run dry-run tests"
echo " -r: Run real-run tests"
}
skip_dry_runs=1
skip_real_runs=1
while getopts "dr" opt; do
case $opt in
d)
skip_dry_runs=0
;;
r)
skip_real_runs=0
;;
\?)
usage
exit 1
;;
esac
done
args=""
if [ $skip_dry_runs -ne 1 ]; then
args="$args -d"
fi
if [ $skip_real_runs -ne 1 ]; then
args="$args -r"
fi
#echo "DEBUG args=$args" 1>&2
cd $(dirname $0)
commit=$(git describe --always --dirty)
for sh in $(find * -maxdepth 3 -mindepth 1 -name tests.sh); do
disabled_pipelines=""
if [ -s .disabled-pipelines.txt ]; then
disabled_pipelines=$(cat .disabled-pipelines.txt | xargs -n 1 dirname)
fi
#echo "DEBUG: disabled_pipelines=$disabled_pipelines" 1>&2
skip=0
for p in $disabled_pipelines; do
if echo $sh | grep -q $p; then
skip=1
break
fi
done
if [ $skip -eq 1 ]; then
echo "WARNING: skipping $sh as requested" 1>&2
continue
fi
echo "------------------------------------------------------------"
echo "Running $sh"
echo "------------------------------------------------------------"
pushd $(dirname $sh) >/dev/null
bash $(basename $sh) $args
if [ $? -ne 0 ]; then
echo "ERROR: Tests failed"
else
echo "OK: Tests passed"
fi
echo "------------------------------------------------------------"
echo "Running static code checks in $(pwd)"
echo "------------------------------------------------------------"
# only warn
set +e
# ignore essential_genes_from_tables.py (python2)
for f in $(find . -maxdepth 1 -name \*py -type f | grep -v flymake | grep -v essential_genes_from_tables.py); do
echo "Checking $f"
PYTHONPATH=$MYDIR/lib pylint -j 2 -E --rcfile pylintrc $f
done
popd >/dev/null
set -e
echo "Done"
echo
done
echo "------------------------------------------------------------"
echo "Running static code checks with pylint in lib"
echo "------------------------------------------------------------"
set +e
for f in $(ls ./lib/*py); do
echo "Checking $f"
PYTHONPATH=$(dirname $MYNAME)/lib pylint -j 2 -E --rcfile pylintrc $f
done
echo "Done"
set -e
echo
echo "*** All tests completed/started"