#!/bin/bash

# Regression test script.

# Something is fishy if file $1.minreg != current.minreg

# The file $1.minreg was created by a supposedly correct code.
# The file current.minreg is created by running the current code.

# Read the .functions file
. .functions

# ==============================================
function usage {
  echo "Usage minreg simple|ttcc"
  exit 1
}
# ==============================================

if [ -z "$PERL" ]
then
  PERL=perl
fi

case  $1 in
  simple|ttcc )
  ;;
 * ) usage
  ;;
esac

java org.apache.log4j.test.Min $1 > $TEMP
$PERL minreg.pl $1 < $TEMP > $OUTPUT

if [ $? != 0 ]
then
  echo "The output is not in expected format. See the file [$OUTPUT]."
  popd;
  exit 1   
fi 

check witness/$1.minreg $OUTPUT; echo "minreg $1 - OK."


