]> git.cameronkatri.com Git - mandoc.git/blob - regress/regress.sh
Remove temp files on success.
[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 */*.1 */*/*.1; 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 if cmp -s test.mandoc test.nroff; then
27 rm -f test.mandoc test.nroff
28 echo "passed"
29 pass=`expr $pass + 1`
30 else
31 file2="output/$file"
32 mkdir -p `dirname $file2`
33 echo "failed, see $file2"
34 failed=`expr $failed + 1`
35 mv test.nroff "${file2}".nroff
36 mv test.mandoc "${file2}".mandoc
37 diff -u "${file2}".nroff "${file2}".mandoc > "${file2}".diff
38 fi
39 done
40 echo "Total: $pass passed, $failed failed"