#!/bin/sh -e

export PATH="/sbin:/usr/sbin:${PATH}"

cp -r tests "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"

if [ -z "$AUTOPKGTEST_NORMAL_USER" ]; then
    useradd -m -b "${AUTOPKGTEST_TMP}" -s /bin/bash -U "testuser"
    AUTOPKGTEST_NORMAL_USER=testuser
fi

py3versions -s | tr ' ' '\n' | xargs -I {} setpriv --reuid=$AUTOPKGTEST_NORMAL_USER env {} -Wd -m pytest -v -x -rs 2>&1
