#!/bin/sh
# Copyright 1999-2002 Carnegie Mellon University.  
# Portions Copyright 2002 Sun Microsystems, Inc.  
# Portions Copyright 2002 Mitsubishi ElectricResearch Laboratories.
# All Rights Reserved.  Use is subject to license terms.
# 
# See the file "license.terms" for information on usage and
# redistribution of this file, and for a DISCLAIMER OF ALL 
# WARRANTIES.
#
#
# This script runs a particular test in the given directory
#
# usage: runTest directory label [makeTargetName]
#
# Goes to the given directory and runts the test. The makeTargetName
# is used to run the test if it is given, in its absence, the label
# serves as the target name.  In either case, the label is used as the
# label for the test in the regression log
#

base=`pwd`

directory=$1
shift
label=$1
shift

target=${*:-"$label"}

rawOutput=$label.out
alignOutput=$label.align

cd $directory
if ant -emacs $target > $base/$rawOutput
then
  status="OK";
else
  status="FAILED"; cat $base/$rawOutput;
fi

cd $base

$base/parseS4Output $rawOutput $label $status | $base/updateLog
