Debian Codegraph @

build-tools/pkgos-dh_auto_test

raw
1 #!/bin/sh
2
3 set -e
4 set -x
5
6 # Config vars
7 PKGOS_TEST_PARALLEL=yes
8 PKGOS_TEST_SERIAL=no
9
10 # Vars used in commands
11 PYTHONS=disabled
12 PYTHON3S=disabled
13 TEST_PARALLEL_OPT="--parallel"
14 TEST_SERIAL_OPT=""
15
16 for i in $@ ; do
17 case "${1}" in
18 "--no-py3")
19 echo "WARNING: --no-py3 is deprecated, and always off."
20 shift
21 ;;
22 "--no-py2")
23 echo "WARNING: --no-py2 is deprecated, and always on."
24 shift
25 ;;
26 "--no-parallel")
27 PKGOS_TEST_PARALLEL=no
28 shift
29 ;;
30 "--serial")
31 PKGOS_TEST_SERIAL=yes
32 PKGOS_TEST_PARALLEL=no
33 shift
34 ;;
35 *)
36 ;;
37 esac
38 done
39
40 PYTHON3S=$(py3versions -vr 2>/dev/null)
41 if [ "${PKGOS_TEST_PARALLEL}" = "no" ] ; then
42 TEST_PARALLEL_OPT=""
43 fi
44 if [ "${PKGOS_TEST_SERIAL}" = "yes" ] ; then
45 TEST_SERIAL_OPT="--serial"
46 fi
47
48 for pyvers in ${PYTHON3S}; do
49 if [ "${pyvers}" = "disabled" ] ; then
50 continue
51 fi
52 PYMAJOR=$(echo ${pyvers} | cut -d'.' -f1)
53 echo "===> Testing with python${pyers} (python${PYMAJOR})"
54 if [ -d `pwd`/debian/tmp/usr/lib/python3/dist-packages ] && [ -z "${PYTHONPATH}" ] ; then
55 echo "Implicitly adding PYTHONPATH="`pwd`"/debian/tmp/usr/lib/python3/dist-packages"
56 export PYTHONPATH=`pwd`/debian/tmp/usr/lib/python3/dist-packages
57 fi
58 if [ -e .stestr.conf ] ; then
59 if [ -x /usr/bin/python${PYMAJOR}-stestr ] ; then
60 STESTR=/usr/bin/python${PYMAJOR}-stestr
61 else
62 STESTR=stestr
63 fi
64 rm -rf .stestr
65 if ! PYTHON=python${pyvers} ${STESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | subunit2pyunit ; then
66 echo "======> STESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
67 if [ -x /usr/bin/pip3 ] ; then
68 pip3 freeze
69 fi
70 exit 1
71 fi
72 ${STESTR} slowest
73 rm -rf .stestr
74 elif [ -e .testr.conf ] ; then
75 if [ -x /usr/bin/testr-python${PYMAJOR} ] ; then
76 TESTR=/usr/bin/testr-python${PYMAJOR}
77 else
78 TESTR=testr
79 fi
80 rm -rf .testrepository
81 ${TESTR} init
82 TEMP_REZ=$(mktemp -t)
83 if ! PYTHON=python${pyvers} ${TESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | tee ${TEMP_REZ} | subunit2pyunit ; then
84 echo "======> TESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
85 if [ -x /usr/bin/pip3 ] ; then
86 pip3 freeze
87 fi
88 exit 1
89 fi
90 cat ${TEMP_REZ} | subunit-filter -s --no-passthrough | subunit-stats
91 rm -f ${TEMP_REZ}
92 ${TESTR} slowest
93 rm -rf .testrepository
94 fi
95 done