#!/bin/sh
set -e

export OMPI_MCA_rmaps_base_oversubscribe=yes

for py in $(py3versions -s 2>/dev/null);
do
    cd "$AUTOPKGTEST_TMP"

    echo "\n=== Testing mpi build with $py ==="
    mpirun -n 4 $py -c "from sys import exit; import h5py; exit(h5py.run_tests('-v --with-mpi -p no:xvfb -k \"not ros3 and not TestMPI\"'))"
    mpirun -n 4 $py -mpytest -v --with-mpi -p no:xvfb -k TestMPI /usr/lib/python3/dist-packages/h5py/_debian_h5py_mpi/tests/test_file.py
done
