File: testone.sh

package info (click to toggle)
tidy 20080116cvs-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,296 kB
  • ctags: 3,259
  • sloc: ansic: 30,069; sh: 9,060; xml: 317; makefile: 41
file content (79 lines) | stat: -rwxr-xr-x 1,169 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /bin/sh

#
# testone.sh - execute a single testcase
#
# (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
# See tidy.c for the copyright notice.
#
# <URL:http://tidy.sourceforge.net/>
#
# CVS Info:
#
#    $Author: arnaud02 $
#    $Date: 2006/01/04 10:27:12 $
#    $Revision: 1.9 $
#
# set -x

VERSION='$Id'

echo Testing $1

set +f

TESTNO=$1
EXPECTED=$2
TIDY=../bin/tidy
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

$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
  exit 1
fi

exit 0