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