#!./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

setup() {
    NODES=2
    TASKS=`tasks_count 8`
    ARGS=""
    export NODES TASKS ARGS
}

@test "[libs/adios2] MPI C binary runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -x arrays_write ];then
        flunk "arrays_write binary does not exist"
    fi

    run_mpi_binary ./arrays_write "$ARGS" $NODES $TASKS
    assert_success
}

@test "[libs/adios2] MPI F90 binary runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -x scalars_write ];then
        flunk "scalars_write binary does not exist"
    fi

    run_mpi_binary ./scalars_write "$ARGS" $NODES $TASKS
    assert_success
}
