#!/bin/sh
# Test whether the code generated by the Mercury compiler is producing 
# the same output as code generated by the NU-Prolog compiler.
# Return a status of 0 (true) if everything is all right, and 1 otherwise.
#
# The .exp files containing the expected output of each test should be under
# CVS control. They can be updated by running
#
#	mmake realclean
#	mmake depend
#	mmake exp
#
# on a machine that has NU-Prolog installed.

. ../handle_options

mmake $jfactor clean > /dev/null 2>&1
mmake $jfactor depend || exit 1
eval mmake -k $jfactor $gradeopt $flagsopt $cflagsopt check
checkstatus=$?

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