Skip to content

Commit 08cb8ed

Browse files
committed
[scripts/release_tests] Add matrix wrapper script
1 parent f0fef14 commit 08cb8ed

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/usr/bin/env bash
2+
3+
echo
4+
echo "-- Running python-odml package test installation matrix"
5+
6+
print_options () {
7+
echo
8+
echo "-- Missing or invalid test script selection letter (A|B|C|D|E), please provide one of the following"
9+
echo " A: local install test (odml)"
10+
echo " B: Test PyPI install test (odml)"
11+
echo " C: Test PyPI install test (odmltools)"
12+
echo " D: Test PyPI install test (nixodmlconverter)"
13+
echo " E: PyPI install test (odml)"
14+
}
15+
16+
if [[ $# != 1 ]]; then
17+
print_options
18+
exit 1
19+
fi
20+
21+
TEST_ARRAY=("|A|B|C|D|E|")
22+
TEST=$1
23+
24+
if [[ ! "${TEST_ARRAY}" =~ "|${TEST}|" ]]; then
25+
print_options
26+
exit 1
27+
fi
28+
29+
if [[ "${TEST}" == "A" ]]; then
30+
echo
31+
echo "-- Running local test odml installations"
32+
LOG_DIR=/tmp/odml/local_install_odml
33+
SCRIPT=./run_test_local_odml.sh
34+
echo "${SCRIPT}"
35+
fi
36+
37+
if [[ "${TEST}" == "B" ]]; then
38+
echo
39+
echo "-- Running PyPI test odml installations"
40+
LOG_DIR=/tmp/odml/pypi_test_install_odml
41+
SCRIPT=./run_test_pypi_odml.sh
42+
fi
43+
44+
if [[ "${TEST}" == "C" ]]; then
45+
echo
46+
echo "-- Running PyPI test odmltools installations"
47+
LOG_DIR=/tmp/odml/pypi_test_install_odmltools
48+
SCRIPT=./run_test_pypi_odmltools.sh
49+
fi
50+
51+
if [[ "${TEST}" == "D" ]]; then
52+
echo
53+
echo "-- Running PyPI test nixodmlconverter installations"
54+
LOG_DIR=/tmp/odml/pypi_test_install_nixodmlconverter
55+
SCRIPT=./run_test_pypi_nixodmlconverter.sh
56+
fi
57+
58+
if [[ "${TEST}" == "E" ]]; then
59+
echo
60+
echo "-- Running PyPI odml installations"
61+
LOG_DIR=/tmp/odml/pypi_install_odml
62+
SCRIPT=./run_pypi_odml.sh
63+
fi
64+
65+
ROOT_DIR=$(pwd)
66+
67+
echo
68+
echo "-- Running directory check: ${ROOT_DIR}"
69+
CHECK_DIR=$(basename ${ROOT_DIR})
70+
if [[ ! "${CHECK_DIR}" = "release_tests" ]]; then
71+
echo
72+
echo "-- In wrong directory ${ROOT_DIR}"
73+
exit 1
74+
fi
75+
76+
echo
77+
echo "-- Creating log directory ${LOG_DIR}"
78+
mkdir -vp ${LOG_DIR}
79+
if [[ ! -d "${LOG_DIR}" ]]; then
80+
echo
81+
echo "-- Cannot find ${LOG_DIR} output directory"
82+
exit 1
83+
fi
84+
85+
echo
86+
echo "-- Log files of all tests can be found in ${LOG_DIR}"
87+
88+
function run_script () {
89+
echo
90+
echo "-- Running script for Python version ${PYVER}"
91+
bash -i ${SCRIPT} ${PYVER} > ${LOG_DIR}/${PYVER}_testrun.log 2>&1
92+
FAIL_COUNT=$(cat ${LOG_DIR}/${PYVER}_testrun.log | grep -c FAILED)
93+
if [[ "${FAIL_COUNT}" -gt 0 ]]; then
94+
echo "-- Test fail in Python ${PYVER} tests. Check ${LOG_DIR}/${PYVER}_testrun.log"
95+
fi
96+
PY_ERR_COUNT=$(cat ${LOG_DIR}/${PYVER}_testrun.log | grep -c Traceback)
97+
if [[ "${PY_ERR_COUNT}" -gt 0 ]]; then
98+
echo "-- Runtime error in Python ${PYVER} tests. Check ${LOG_DIR}/${PYVER}_testrun.log"
99+
fi
100+
}
101+
102+
PYVER=3.9
103+
run_script
104+
105+
PYVER=3.8
106+
run_script
107+
108+
PYVER=3.7
109+
run_script
110+
111+
PYVER=3.6
112+
run_script
113+
114+
PYVER=3.5
115+
run_script
116+
117+
echo
118+
echo "-- Done"

0 commit comments

Comments
 (0)