#!/bin/bash

set -e

PYVER=$(py3versions -sv)

# single process
for pyver in $PYVER; do
  echo "=== test serial, python $pyver ==="
  python$pyver -m pytest ./test/
done

# MPI test
N_MPI=`nproc`
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
export OMPI_MCA_btl_base_warn_component_unused=0
for pyver in $PYVER; do
  echo "=== test MPI, python $pyver ==="
  mpirun -n ${N_MPI} python$pyver -m pytest ./test/
done
