#!/bin/sh

set -e -u

PY2V="$(pyversions -r 2>/dev/null)"
PY3V="$(py3versions -r 2>/dev/null)"

# Keep the test dir rather than copy to the root of $AUTOPKGTEST_TMP.
# Upstream scripts add the parent dir to the python path; this way
# one can be sure it will only find an (otherwise) empty dir there.
cp -va test "$AUTOPKGTEST_TMP"/
cd "$AUTOPKGTEST_TMP"/test

for py in $PY2V $PY3V; do
	echo "Running testsuite with $py:"
	for t in testlex.py testyacc.py testcpp.py; do
		echo "$t:"
		$py $t
	done
	# cleanup
	/bin/sh cleanup.sh
done
