#!/bin/sh
#	This code copyright (c) by the Grail project.
#	No commercial use permitted without written consent.
#	March 1993

#######################################################################
# add valid path by ray, at UPEI, 2010/MAY/18
#######################################################################


# Absolute path to this script. 
SCRIPT=$(readlink -f $0)
# Absolute path this script is in.
SCRIPTPATH=`dirname $SCRIPT`	



BIN=$SCRIPTPATH/../../bin
MACHINES=$SCRIPTPATH/../machines
ERRORS=$SCRIPTPATH/../errors

for i in d1 d2 d3 d4 d5 d6 d7 d8 n1 n2
do	
	echo -n "Testing	$1	on	$i..."
	$BIN/$1 ${MACHINES}/$i ${MACHINES}/d1 | sort >$$.tmp 2>/dev/null
	sort $SCRIPTPATH/../$1/$i >out
	if diff $$.tmp out
	then
		rm $$.tmp
		echo "results match !"
		echo "Testing $1 on $i passed !"|cat >> passed
	else
		mv $$.tmp ${ERRORS}/$1.$i
		echo "fail to match, results recorded !"
		echo "Testing $1 on $i failed !"|cat >> failed
	fi
	rm out
done
