#!/bin/sh
# Test whether the code generated by the Mercury compiler
# is producing the expected output.
# Return a status of 0 (true) if everything is all right, and 1 otherwise.

#  . ../../handle_options
#  . ../../startup
# Those two files are copied from the Mercury tests repository
. ./handle_options
. ./startup

eval mmake $mmakeopts depend || exit 1
eval mmake -k $mmakeopts check
checkstatus=$?

cat *.res > .allres
if test ! -s .allres -a "$checkstatus" = 0
then
	echo "the tests in the debugger/external directory succeeded"
	echo "mmakeopts=$mmakeopts"
	rm -f .allres
	. ./shutdown
#	. ../../shutdown
	exit 0
else
	echo "the tests in the debugger/external directory failed"
	echo "mmakeopts=$mmakeopts"
	echo "the differences are:"
	cat .allres
	exit 1
fi
