#!/bin/bash
set -e

pkg=trinculo
CUR_DIR=`pwd`

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
 AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
 trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cp -a ${PWD}/bin/testing.py "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"

for py in $(py3versions -s 2> /dev/null)
do echo "Testing with $py in $(pwd):"
    $py testing.py > test.out
    cat test.out
    if [ "$(cat test.out | grep 'FAILED' | wc -l)" -eq "0" ]; then
	echo "PASSED"
    else
	exit 1
    fi
    rm -f test.out
done
