#!./common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ];then
    source ./common/TEST_ENV
fi

check_rms
rm=$RESOURCE_MANAGER

NODES=2
TASKS=4
ARGS=8

@test "[libs/OpenCoarrays] hello_multiverse binary runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -s hello ];then
	flunk "hello binary does not exist"
    fi

    if echo "$LMOD_FAMILY_MPI" | grep -q mvapich ; then
	export MV2_ENABLE_AFFINITY=0
    fi

    if [ "$LMOD_FAMILY_MPI" != "impi" ];then
    
	run_mpi_binary ./hello "" $NODES $TASKS
	assert_success
    fi

}
