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

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

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

check_rms

@test "[libs/Scotch] graph_map binary runs under resource manager (${RESOURCE_MANAGER}/$LMOD_FAMILY_COMPILER)" {
	if [ ! -s graph_map ]; then
		flunk "graph_map binary does not exist"
	fi

	run_serial_binary -t 5 ./graph_map "m4x4.grf"
	assert_success
}

@test "[libs/Scotch] strat_seq binary runs under resource manager (${RESOURCE_MANAGER}/$LMOD_FAMILY_COMPILER)" {
	if [ ! -s strat_seq ]; then
		flunk "strat_seq does not exist"
	fi

	run_serial_binary -t 5 ./strat_seq ""
	assert_success
}

@test "[libs/Scotch] gout binary runs under resource manager (${RESOURCE_MANAGER}/$LMOD_FAMILY_COMPILER)" {
	if [ ! -s "${SCOTCH_BIN}/gout" ]; then
		flunk "gout does not exist"
	fi

	rm -f m4x4.ps
	run_serial_binary -t 5 gout "-om -gn -mn m4x4.grf - - m4x4.ps"
	assert_success

	if [ ! -f m4x4.ps ]; then
		flunk "gout failed to produce output"
	fi

	rm -f m4x4.ps
}
