From 885cace8e89a089354425479dae6bc6f9f191374 Mon Sep 17 00:00:00 2001 From: "Geoff R. McLane" Date: Tue, 5 Aug 2014 19:08:53 +0200 Subject: [PATCH] soem tweaks to the shell test scripts --- .gitignore | 4 +++ test/cmp.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ test/testall.sh | 3 ++ test/testone.sh | 15 ++++++++-- 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100755 test/cmp.sh diff --git a/.gitignore b/.gitignore index 0d06cf6..6feb9e2 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ /lib/ /test/testall.log /test/tmp/ +/test/tmp2/ +*~ +temp* + diff --git a/test/cmp.sh b/test/cmp.sh new file mode 100755 index 0000000..5e04dc6 --- /dev/null +++ b/test/cmp.sh @@ -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 + diff --git a/test/testall.sh b/test/testall.sh index adc0ee7..4a2f7d3 100755 --- a/test/testall.sh +++ b/test/testall.sh @@ -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 diff --git a/test/testone.sh b/test/testone.sh index b8ec0b2..212535f 100755 --- a/test/testone.sh +++ b/test/testone.sh @@ -9,7 +9,7 @@ # # # 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