2011-11-17 02:44:16 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# testone.sh - execute a single testcase
|
|
|
|
#
|
|
|
|
# (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
|
|
|
|
# See tidy.c for the copyright notice.
|
|
|
|
#
|
2015-02-13 11:19:51 +00:00
|
|
|
# <URL:http://www.html-tidy.org/>
|
2011-11-17 02:44:16 +00:00
|
|
|
#
|
|
|
|
# set -x
|
2014-08-05 17:08:53 +00:00
|
|
|
BN=`basename $0`
|
2011-11-17 02:44:16 +00:00
|
|
|
VERSION='$Id'
|
|
|
|
|
|
|
|
echo Testing $1
|
|
|
|
|
|
|
|
set +f
|
|
|
|
|
|
|
|
TESTNO=$1
|
|
|
|
EXPECTED=$2
|
2014-08-05 17:08:53 +00:00
|
|
|
#TIDY=../bin/tidy
|
2015-09-09 11:57:14 +00:00
|
|
|
TIDY=../build/cmake/tidy
|
2014-08-05 17:08:53 +00:00
|
|
|
if [ ! -f "$TIDY" ]; then
|
|
|
|
echo "$BN: Can NOT locate binary '$TIDY'!"
|
|
|
|
echo "$BN: Fix me with the correct location of the binary to run."
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-11-17 02:44:16 +00:00
|
|
|
INFILES=./input/in_${TESTNO}.*ml
|
|
|
|
CFGFILE=./input/cfg_${TESTNO}.txt
|
|
|
|
|
|
|
|
TIDYFILE=./tmp/out_${TESTNO}.html
|
|
|
|
MSGFILE=./tmp/msg_${TESTNO}.txt
|
|
|
|
|
|
|
|
unset HTML_TIDY
|
|
|
|
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
|
|
|
|
# Remove any pre-exising test outputs
|
|
|
|
for INFIL in $MSGFILE $TIDYFILE
|
|
|
|
do
|
|
|
|
if [ -f $INFIL ]
|
|
|
|
then
|
|
|
|
rm $INFIL
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for INFILE in $INFILES
|
|
|
|
do
|
|
|
|
if [ -r $INFILE ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# If no test specific config file, use default.
|
|
|
|
if [ ! -f $CFGFILE ]
|
|
|
|
then
|
|
|
|
CFGFILE=./input/cfg_default.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure output directory exists.
|
|
|
|
if [ ! -d ./tmp ]
|
|
|
|
then
|
|
|
|
mkdir ./tmp
|
|
|
|
fi
|
|
|
|
|
2014-08-05 17:08:53 +00:00
|
|
|
echo "Doing: './$TIDY -f $MSGFILE -config $CFGFILE "$@" --tidy-mark no -o $TIDYFILE $INFILE'" >> tempall.txt
|
|
|
|
./$TIDY -f $MSGFILE -config $CFGFILE "$@" --tidy-mark no -o $TIDYFILE $INFILE
|
2011-11-17 02:44:16 +00:00
|
|
|
STATUS=$?
|
|
|
|
|
|
|
|
if [ $STATUS -ne $EXPECTED ]
|
|
|
|
then
|
|
|
|
echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)"
|
|
|
|
cat $MSGFILE
|
2014-08-05 17:08:53 +00:00
|
|
|
echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)" >> tempall.txt
|
|
|
|
cat $MSGFILE >> tempall.txt
|
2011-11-17 02:44:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|