File: pkgos-dh_auto_test

package info (click to toggle)
openstack-pkg-tools 135
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 928 kB
  • sloc: sh: 4,181; makefile: 31
file content (95 lines) | stat: -rwxr-xr-x 2,448 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

set -e
set -x

# Config vars
PKGOS_TEST_PARALLEL=yes
PKGOS_TEST_SERIAL=no

# Vars used in commands
PYTHONS=disabled
PYTHON3S=disabled
TEST_PARALLEL_OPT="--parallel"
TEST_SERIAL_OPT=""

for i in $@ ; do
	case "${1}" in
	"--no-py3")
		echo "WARNING: --no-py3 is deprecated, and always off."
		shift
		;;
	"--no-py2")
		echo "WARNING: --no-py2 is deprecated, and always on."
		shift
		;;
        "--no-parallel")
                PKGOS_TEST_PARALLEL=no
                shift
                ;;
        "--serial")
                PKGOS_TEST_SERIAL=yes
                PKGOS_TEST_PARALLEL=no
                shift
                ;;
	*)
		;;
	esac
done

PYTHON3S=$(py3versions -vr 2>/dev/null)
if [ "${PKGOS_TEST_PARALLEL}" = "no" ] ; then
	TEST_PARALLEL_OPT=""
fi
if [ "${PKGOS_TEST_SERIAL}" = "yes" ] ; then
	TEST_SERIAL_OPT="--serial"
fi

for pyvers in ${PYTHON3S}; do
	if [ "${pyvers}" = "disabled" ] ; then
		continue
	fi
	PYMAJOR=$(echo ${pyvers} | cut -d'.' -f1)
	echo "===> Testing with python${pyers} (python${PYMAJOR})"
	if [ -d `pwd`/debian/tmp/usr/lib/python3/dist-packages ] && [ -z "${PYTHONPATH}" ] ; then
		echo "Implicitly adding PYTHONPATH="`pwd`"/debian/tmp/usr/lib/python3/dist-packages"
		export PYTHONPATH=`pwd`/debian/tmp/usr/lib/python3/dist-packages
	fi
	if [ -e .stestr.conf ] ; then
		if [ -x /usr/bin/python${PYMAJOR}-stestr ] ; then
			STESTR=/usr/bin/python${PYMAJOR}-stestr
		else
			STESTR=stestr
		fi
		rm -rf .stestr
		if ! PYTHON=python${pyvers} ${STESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | subunit2pyunit ; then
			echo "======> STESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
			if [ -x /usr/bin/pip3 ] ; then
				pip3 freeze
			fi
			exit 1
		fi
		${STESTR} slowest
		rm -rf .stestr
	elif [ -e .testr.conf ] ; then
		if [ -x /usr/bin/testr-python${PYMAJOR} ] ; then
			TESTR=/usr/bin/testr-python${PYMAJOR}
		else
			TESTR=testr
		fi
		rm -rf .testrepository
		${TESTR} init
		TEMP_REZ=$(mktemp -t)
		if ! PYTHON=python${pyvers} ${TESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | tee ${TEMP_REZ} | subunit2pyunit ; then
			echo "======> TESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
			if [ -x /usr/bin/pip3 ] ; then
				pip3 freeze
			fi
			exit 1
		fi
		cat ${TEMP_REZ} | subunit-filter -s --no-passthrough | subunit-stats
		rm -f ${TEMP_REZ}
		${TESTR} slowest
		rm -rf .testrepository
	fi
done