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

setup() {
    if [ -z "$MODULEPATH" ];then
        . /etc/profile.d/lmod.sh || exit 1
    fi
    module purge        || exit 1
    module load spack || exit 1
}

@test "[spack] check for RPM" {
    check_if_rpm_installed "spack${DELIM}"
}

@test "[spack] add compiler" {
    module load  gnu12
    spack compiler find
    assert_success
}

@test "[spack] test build" {
    spack install bats
    assert_success
}

@test "[spack] test module refresh" {
    echo y | spack module tcl refresh
    assert_success
}
