-
Notifications
You must be signed in to change notification settings - Fork 358
/
Copy pathpycbc_test_suite.sh
executable file
·169 lines (145 loc) · 4.68 KB
/
pycbc_test_suite.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
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
#!/bin/bash
echo -e "\\n>> [`date`] Starting PyCBC test suite"
PYTHON_VERSION=`python -c 'import sys; print(sys.version_info.major)'`
echo -e "\\n>> [`date`] Python Major Version:" $PYTHON_VERSION
PYTHON_MINOR_VERSION=`python -c 'import sys; print(sys.version_info.minor)'`
echo -e "\\n>> [`date`] Python Minor Version:" $PYTHON_MINOR_VERSION
# This will work from anywhere within the pycbc directory
this_script_dir=`dirname -- "$( readlink -f -- "$0"; )"`
cd $this_script_dir
cd ..
LOG_FILE=$(mktemp -t pycbc-test-log.XXXXXXXXXX)
RESULT=0
cat_output=true
function test_result {
if test $? -ne 0 ; then
RESULT=1
echo -e " FAILED!"
if $cat_output ; then
echo -e "---------------------------------------------------------"
cat $LOG_FILE
echo -e "---------------------------------------------------------"
fi
else
echo -e " Pass"
fi
}
if [ "$PYCBC_TEST_TYPE" = "unittest" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
for prog in `find test -name '*.py' -print | egrep -v '(long|lalsim|test_waveform)'`
do
prog_short=`echo $prog | rev | cut -d"/" -f1 | rev`
echo -e ">> [`date`] running unit test for $prog_short"
python $prog &> $LOG_FILE
test_result
done
fi
if [ "$PYCBC_TEST_TYPE" = "help" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
# check that all executables that do not require
# special environments can return a help message
for prog in `find ${PATH//:/ } -maxdepth 1 -name 'pycbc*' -print 2>/dev/null | egrep -v '(pycbc_live_nagios_monitor|pycbc_mvsc_get_features)' | sort | uniq`
do
echo -e ">> [`date`] running $prog --help"
$prog --help &> $LOG_FILE
test_result
if [[ `echo $prog | egrep '(pycbc_copy_output_map|pycbc_submit_dax|pycbc_stageout_failed_workflow)'` ]] ; then
continue
fi
echo -e ">> [`date`] running $prog --version"
$prog --version &> $LOG_FILE
test_result
done
# also check that --version with increased modifiers works for one executable
echo -e ">> [`date`] running pycbc_inspiral --version with modifiers"
for modifier in "" 0 1 2 3
do
echo -e ">> [`date`] running pycbc_inspiral --version ${modifier}"
pycbc_inspiral --version ${modifier} &> $LOG_FILE
test_result
done
fi
cat_output=false
if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
# run pycbc inspiral test
pushd examples/inspiral
bash -e run.sh
test_result
popd
# run a quick bank placement example
pushd examples/tmpltbank
bash -e testNonspin2.sh
test_result
popd
# run PyCBC Live test
if ((${PYTHON_MINOR_VERSION} > 7)); then
# ligo.skymap is only supporting python3.8+, and older releases are
# broken by a new release of python-ligo-lw
pushd examples/live
bash -e run.sh
test_result
popd
fi
# run pycbc_multi_inspiral (PyGRB) test
pushd examples/multi_inspiral
bash -e run.sh
test_result
popd
fi
if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
# Run Inference Scripts
## Run inference on 2D-normal analytic likelihood function
pushd examples/inference/analytic-normal2d
bash -e run.sh
test_result
popd
## Run inference on BBH example; this will also run
## a test of create_injections
pushd examples/inference/bbh-injection
bash -e make_injection.sh
test_result
# now run inference
bash -e run_test.sh
test_result
popd
## Run inference on GW150914 data
pushd examples/inference/gw150914
bash -e run_test.sh
test_result
popd
## Run inference using single template model
pushd examples/inference/single
bash -e get.sh
bash -e run.sh
test_result
popd
## Run inference using relative model
pushd examples/inference/relative
bash -e get.sh
bash -e run.sh
test_result
popd
## Run inference using the hierarchical model
pushd examples/inference/hierarchical
bash -e run_test.sh
test_result
popd
## Run inference samplers
pushd examples/inference/samplers
bash -e run.sh
test_result
popd
## Run pycbc_make_skymap example
if ((${PYTHON_MINOR_VERSION} > 7)); then
# ligo.skymap is only supporting python3.8+, and older releases are
# broken by a new release of python-ligo-lw
pushd examples/make_skymap
bash -e simulated_data.sh
test_result
popd
fi
fi
if [ "$PYCBC_TEST_TYPE" = "docs" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
echo -e "\\n>> [`date`] Building documentation"
python setup.py build_gh_pages
test_result
fi
exit ${RESULT}