head	1.4;
access;
symbols;
locks; strict;
comment	@# @;


1.4
date	92.12.23.13.02.09;	author praveen;	state Exp;
branches;
next	1.3;

1.3
date	92.10.19.21.40.22;	author roth;	state Exp;
branches;
next	1.2;

1.2
date	92.08.13.02.13.13;	author roth;	state Exp;
branches;
next	1.1;

1.1
date	92.08.12.21.57.57;	author roth;	state Exp;
branches;
next	;


desc
@This is a c-shell script that runs the test suite for coral.
@


1.4
log
@*** empty log message ***
@
text
@#!/bin/csh
#
# A regressions test for coral
#
# Set a few varibles
#
# This scripts depends on 2 directories: the data directory, there the files containing
# the correct output are, and the diff directory, which contains the files describing
# the differneces between the expected resultsa and the actual results.
#
#
##
set coral = coral			# command to call coral
set rg = $cwd				# current working directory
set test = $rg/test			# where testing files are 
set data = $rg/data			# where benchmark files are.
set diffdir = $rg/diff			# where differences go.
set filter = "nawk -f $rg/strip.awk "	# filter out beginning and end messages
set diff  = diff			# set the diff program
set argc = $#argv			# the number of args from command line

# if sysV sort is available, use it
set sort = sort                        # the sort routine to use
#
# if BSD sort is being used, some of the programs will produce output lines 
# that are too long for sort to handle.
#
#set sort = sort
#
# set up the single output files.
#
@@ x = 0
foreach i ($argv)			# for each i in 
	@@ x++
	switch($argv[$x])
	case "-h":
	case "-help":
		goto usage
		breaksw
	case "-s":
		if($argc == 1) goto usage
		@@ y = $x + 1
		set sfiles = "$argv[${y}]"
		goto next
		breaksw
	default:
		echo Error in specifying command line options
		goto usage
		breaksw
	endsw
end

next:
#
# now, if sfiles has not been set, set it to the defaults
# NOTE: If you wish to add new files to be tested, add them to this list.
#
if($?sfiles == 0) then
set sfiles = (ackermann fib fac eventest nrev \
		appendbig appendbigopt appendbigpipe   \
		testbomtiny testbomsmall anc anc1 anc2 anc3 anc4 )
#		testbomtiny testbomsmall anc anc1 anc2 anc3 anc4 \
#	        qsort sg shortestpath tak grades algebratest parsetest palintest)
endif

onintr end 				# exit gracefully on end
echo " "
echo "Cleaning up old files."
echo " "
/bin/rm -f $diffdir/*.diff >& /dev/null

#
# If the test directory does not exist, exit
#
#if(!(-e $test)) then
#	echo " No test directory !"
#	exit 1
#endif
#
#


#
#
# If the data directory has not been written, create it and put all the output into the
# data directory.
#
#
if(!(-e $data)) then
	mkdir $data
	echo " "
	echo "Creating the data directory."
	echo " "
	set createoutput
endif

if(!(-e $diffdir)) then
	mkdir $diffdir
	echo "Creating the diff directory."
endif

####
#
#
#
# This will run a set of files to make sure that they are giving the right answers.
#
####
initial:
foreach i ($sfiles)
	echo -n "Testing the " $i " program..."
	if($?createoutput) then
#		$coral -q < $test/${i}.test |& $filter | $sort >& $data/${i}.out
		$coral -q < ${i}.F |& $filter | $sort >& $data/${i}.out
		echo "done."
		grep -si error $data/${i}.out
		@@ s = $status
		if ($s == 0) echo "*** Errors occurred creating" $data/${i}.out 
	else
#		$coral -q < $test/${i}.test |& $filter | $sort |& $diff - $data/${i}.out > $diffdir/${i}.diff
		$coral -q < ${i}.F |& $filter | $sort |& $diff - $data/${i}.out > $diffdir/${i}.diff
		echo "done."
#		if (!(-z $diffdir/${i}.diff)) then
#			echo "**** There might be problems with the " $i " program. *** "
#		endif
	endif
end

########
#
# Clean up.
#
#######
end:
if(!($?createoutput)) then
foreach i (`ls $diffdir`)
	set i = $diffdir/$i
	if(!(-z $i)) then
		set s = $i:t
		set s = $s:r
		echo "There are differences between expected output and actual ouput in the $s file."
	endif
end
endif
echo " "
echo End of tests.
exit 0

usage:

echo Usage: test_suite \[-help\] \[-s \"list of files to test\"\]
exit 1


@


1.3
log
@Added -s switch to run any program deom command line, and also
removed the anc test and merged it into the first testing section.
@
text
@d14 2
a15 1
set rg = $cwd				# where testing files are (assume cd).
d18 1
a18 1
set filter = "nawk -f $rg/strip.awk"	# filter out beginning and end messages
d21 8
d59 5
a63 2
set sfiles = (ackermann fib fac eventest nrev appendbig appendbigopt appendbigpipe \
		testbomtiny testbomsmall anc anc1 anc2 anc3 anc4)
d73 11
d113 2
a114 1
		$coral -f $rg/${i}.F |& $filter > $data/${i}.out
d120 2
a121 1
		$coral -f $rg/${i}.F |& $filter | $diff - $data/${i}.out > $diffdir/${i}.diff
d123 3
a125 3
		if (!(-z $diffdir/${i}.diff)) then
			echo "**** There are problems with the " $i " program. *** "
		endif
d141 1
a141 1
		echo "There are discrepancies between expected output and actual ouput in the $s file."
d153 1
@


1.2
log
@Removed junk having to do with temp files.
@
text
@d19 24
d44 1
d46 2
a47 1
# set up the single output files.
d49 1
d51 2
a52 1
		testbomtiny testbomsmall)
a78 3
if($#argv > 0) then			# a shortcut
	goto $1
endif
a103 23
#
# These test the following annotations multiset,check_subsumption,do_not_index_deltas,
# 	and use_factoring.
#
parent:
foreach i ( "" 1 2 3 4)
	echo -n "Testing file anc${i}.P..."
	if($?createoutput) then
		$coral -f $rg/anc${i}.F |& $filter > $data/anc${i}.out
		echo "done."
		grep -si error $data/anc${i}.out
		@@ s = $status
		if ($s == 0) echo "*** Errors occurred creating" $data/${i}.out 
	else
		$coral -f $rg/anc${i}.F |& $filter | $diff $data/anc${i}.out - > $diffdir/anc${i}.diff
		echo "done."
		@@ s = $status
		if(!(-z $diffdir/anc${i}.diff)) then
			echo "There is a problem with the output of program anc${i}.P"
		endif
	endif
end

d120 1
d123 6
@


1.1
log
@Initial revision
@
text
@a14 1
set tmp = $rg/tmp			# where temporary files go.
a29 1
/bin/rm -f $tmp/*.out >& /dev/null
@
