soem tweaks to the shell test scripts

This commit is contained in:
Geoff R. McLane 2014-08-05 19:08:53 +02:00
parent 90ddaa3662
commit 885cace8e8
4 changed files with 95 additions and 3 deletions

4
.gitignore vendored
View file

@ -21,3 +21,7 @@
/lib/
/test/testall.log
/test/tmp/
/test/tmp2/
*~
temp*

76
test/cmp.sh Executable file
View file

@ -0,0 +1,76 @@
#!/bin/sh
#< cmp.sh - 20140805
# If you have the tidied HTML output from two version of 'tidy' then
# this can COMPARE the files ONE BY ONE
#
BN=`basename $0`
TMPDIR1=$1
TMPDIR2=$2
OUTLOG="temp.diff"
usage()
{
echo ""
echo "Usage: ./$BN directory1 directory2"
echo ""
echo "$BN: If you have the tidied HTML output from two version of 'tidy' then "
echo "$BN: this can COMPARE the html files ONE BY ONE, output to $OUTLOG"
echo ""
}
if [ -z "$TMPDIR1" ] || [ -z "$TMPDIR2" ] || [ "$TMPDIR1" = "--help" ] || [ "$TMPDIR1" = "-h" ] || [ "$TMPDIR1" = "-?" ]; then
usage
exit 1
fi
if [ ! -d "$TMPDIR1" ]; then
usage
echo "$BN: Can NOT locate directory '$TMPDIR1'!"
exit 1
fi
if [ ! -d "$TMPDIR2" ]; then
usage
exit 1
fi
shift
shift
TMPCNT1=0
TMPCNT2=0
for fil in $TMPDIR1/*.html; do
TMPCNT1=`expr $TMPCNT1 + 1`
done
for fil in $TMPDIR2/*.html; do
TMPCNT2=`expr $TMPCNT2 + 1`
done
echo "$BN: Found $TMPCNT1 html files in $TMPDIR1"
echo "$BN: Found $TMPCNT2 html files in $TMPDIR2"
if [ -f "$OUTLOG" ]; then
rm -f $OUTLOG
fi
echo "$BN: Found $TMPCNT1 html files in $TMPDIR1" >> $OUTLOG
echo "$BN: Found $TMPCNT2 html files in $TMPDIR2" >> $OUTLOG
for fil in $TMPDIR1/*.html; do
bfil=`basename $fil`
if [ -f "$TMPDIR2/$bfil" ]; then
diff -uw $TMPDIR1/$bfil $TMPDIR2/$bfil >> $OUTLOG
else
echo "$BN: File $bfil not found the 2" >> $OUTLOG
fi
done
echo "$BN: Results are in $OUTLOG"
# eof

View file

@ -25,6 +25,9 @@ BUGS="426885 427633 427662 427664 427671 427672 427675 427676 427677\
620531 629885 634889 640473 640474 646946 647255 647900 649812 655338\
656889 658230 660397 661606 676156 676205 688746 695408 696799"
if [ -f testall.txt ]; then
rm -f testall.txt
fi
# for bugNo in ${BUGS}
while read bugNo expected

View file

@ -9,7 +9,7 @@
# <URL:http://tidy.sourceforge.net/>
#
# set -x
BN=`basename $0`
VERSION='$Id'
echo Testing $1
@ -18,7 +18,13 @@ set +f
TESTNO=$1
EXPECTED=$2
TIDY=../bin/tidy
#TIDY=../bin/tidy
TIDY=../build/cmake/tidy5
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
INFILES=./input/in_${TESTNO}.*ml
CFGFILE=./input/cfg_${TESTNO}.txt
@ -59,13 +65,16 @@ then
mkdir ./tmp
fi
$TIDY -f $MSGFILE -config $CFGFILE "$@" --tidy-mark no -o $TIDYFILE $INFILE
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
STATUS=$?
if [ $STATUS -ne $EXPECTED ]
then
echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)"
cat $MSGFILE
echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)" >> tempall.txt
cat $MSGFILE >> tempall.txt
exit 1
fi