#!/bin/sh
#
# This autopkgtest runs a minimal  only specific test files instead of the full
# suite, as upstream test suite is very time consuming.

set -e -u

# Set openblas as the alternative.
MACHINE=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
BLASLIB=$(update-alternatives --list libblas.so.3-$MACHINE | grep openblas)
update-alternatives --set libblas.so.3-$MACHINE $BLASLIB

TEST_FILES="test_base.py test_numpy_func3.py"
# * test_base: basic tests.
# * test_numpy_func3: suggested during initial sponsorship, for
#   additional blas-specific coverage.

# Additionally, some tests are excluded manually, based on the output
# of "pytest --durations=0".
TEST_SELECTOR="not test__rbfinterp and not test_shallow_water and not test_compute_subpix_2d_gaussian2"

cd pythran/tests

for py in $(py3versions -s 2>/dev/null); do
    echo "Running testsuite with $py:"
    for test_file in $TEST_FILES; do
        $py -m pytest $test_file -k "${TEST_SELECTOR}"
    done
done
