]> git.cameronkatri.com Git - mandoc.git/blob - regress/regress.sh
Make -man check for tabs correctly print the column.
[mandoc.git] / regress / regress.sh
1 #!/bin/sh
2
3 MANDOC=${MANDOC:-../mandoc}
4 NROFF=${NROFF:-nroff}
5 OUTPUT=${NROFF_OUTPUT:--Tascii}
6
7 if [ ! -x $MANDOC ]
8 then
9 echo "regress.sh: command not found: $MANDOC" 1>&2
10 return 0
11 fi
12
13 check_skip_list() {
14 [ -f skip_list ] || return 1
15 while read file; do
16 [ "$file" != "$1" ] || return 0
17 done < skip_list
18 return 1
19 }
20
21 rm -rf output
22
23 echo "Starting regression tests..."
24 pass=0
25 failed=0
26 for file in */*.in */*/*.in; do
27 [ -f "$file" ] || continue
28 check_skip_list "$file" && break
29 printf "%s: " "$file"
30 ${MANDOC} "$file" > test.mandoc 2> /dev/null
31 ${NROFF} ${OUTPUT} -mandoc "$file" > test.nroff 2> /dev/null
32 l=`wc -l < test.mandoc`
33 head -n `expr $l - 1` test.mandoc | tail -n `expr $l - 2` > test.mandoc_
34 l=`wc -l < test.nroff`
35 head -n `expr $l - 1` test.nroff| tail -n `expr $l - 2` > test.nroff_
36 if cmp -s test.mandoc_ test.nroff_; then
37 rm -f test.mandoc test.nroff
38 echo "passed"
39 pass=`expr $pass + 1`
40 else
41 file2="output/$file"
42 mkdir -p `dirname $file2`
43 echo "failed, see $file2"
44 failed=`expr $failed + 1`
45 mv test.nroff "${file2}".nroff
46 mv test.mandoc "${file2}".mandoc
47 diff -u "${file2}".nroff "${file2}".mandoc > "${file2}".diff
48 fi
49 done
50 rm -f test.mandoc_ test.nroff_
51 echo "Total: $pass passed, $failed failed"