#!/bin/sh
PLATFORM=`uname -smr | sed 's/[ \.]/_/g'`
OUTDIR=OUTPUT_${PLATFORM}
BINDIR=BINARY_${PLATFORM}
#
# the good True64 folks are smarter than the rest of us and use a
# different checksum algorithm.  Let's see if we can get them to
# dumb down temporarily and join us at our puny level :-(
#
CMD_ENV=xpg4
export CMD_ENV
#
#
DIFFS=DIFFS
#
echo "Platform is ${PLATFORM}"
#
echo "Cleaning..."
rm -rf ${OUTDIR} ${DIFFS} *.xpl
echo "Preparing output directory..."
mkdir ${OUTDIR}
#
echo "Running each regression trace file"
for FILE in *.*; do
  echo -n "  ${FILE}:	"
  # short output format
  echo -n " short"
  ../tcptrace +t -nr ${FILE} 2>&1 | bin/cleanup > ${OUTDIR}/$FILE.short
  # long output format
  echo -n " long"
  ../tcptrace +t -lnrW ${FILE} 2>&1 | bin/cleanup  > ${OUTDIR}/$FILE.long
  # first 100 packets
  echo -n " packets"
  ../tcptrace +t -pn -E100 --checksum ${FILE} | bin/cleanup > ${OUTDIR}/$FILE.packets
  # ALL PLOTS for first 1000 packets
  echo -n " plots"
  ../tcptrace +t -n -G -E1000  --output_dir=. ${FILE} > /dev/null 2>&1
  cksum *.xpl 2>/dev/null | sed 's/[ 	][ 	]*/	/g' > ${OUTDIR}/$FILE.xplots.cksum
#  tar cf ${OUTDIR}/$FILE.xplots.tar *.xpl 2>/dev/null
  # cleanup
  rm -f *.xpl 
  echo "."
done
#
echo "Testing for differences from benchmark output"
diff -r OUTPUTbench ${OUTDIR} | tee ${DIFFS}
#
exit 0
