#!/bin/sh
# Test whether the compiler succeeds in generating code for each test.
# Return a status of 0 (true) if everything is all right, and 1 otherwise.

. ../handle_options

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

files=`mmake printtests`
failed=""
for file in $files
do
	if test ! -f "$file.o"
	then
		failed="$failed $file"
	fi
done

if test "$failed" = "" -a "$checkstatus" = 0
then
	echo "the tests in the valid directory succeeded"
	exit 0
else
	echo "some tests in the valid directory failed: $failed"
	exit 1
fi
