#! /bin/sh

set -e

# armhf fails strangely; see https://bugs.debian.org/1056460
DEB_BUILD_ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH)

if [ "$DEB_BUILD_ARCH" = armhf ]
then
   HOMEDIR=$(pwd)
   patch -p1 < debian/armhf.patch
fi

cp -a tests "$AUTOPKGTEST_TMP"
for py in $(py3versions -s) ; do
    cd "$AUTOPKGTEST_TMP"
    echo "Testing with $py:"
    $py -m pytest tests
done

if [ "$DEB_BUILD_ARCH" = armhf ]
then
   cd $HOMEDIR
   patch -p1 -R < debian/armhf.patch
fi
