summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2010-05-16 17:40:09 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2010-05-16 17:40:09 +0000
commitadffb4e59396c1fea163795dbd725a84fbf604cd (patch)
treee50c7741a1552965cd1acd20458786b63445d291
parent8c86f5c006dd946ff0a5770011e29d64bf46a395 (diff)
downloadmandoc-adffb4e59396c1fea163795dbd725a84fbf604cd.tar.gz
Add a basic regression testing script.
-rwxr-xr-xregress/regress.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/regress/regress.sh b/regress/regress.sh
new file mode 100755
index 00000000..baa7e819
--- /dev/null
+++ b/regress/regress.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+MANDOC=${MANDOC:-../mandoc}
+NROFF=${NROFF:-nroff}
+OUTPUT=${NROFF_OUTPUT:--Tascii}
+
+check_skip_list() {
+ [ -f skip_list ] || return 1
+ while read file; do
+ [ "$file" != "$1" ] || return 0
+ done < skip_list
+ return 1
+}
+
+rm -rf output
+
+echo "Starting regression tests..."
+pass=0
+failed=0
+for file in */*.1 */*/*.1; do
+ [ -f "$file" ] || continue
+ check_skip_list "$file" && break
+ printf "%s: " "$file"
+ mandoc "$file" > test.mandoc 2> /dev/null
+ ${NROFF} ${OUTPUT} -mandoc "$file" > test.nroff 2> /dev/null
+ if cmp -s test.mandoc test.nroff; then
+ echo "passed"
+ pass=`expr $pass + 1`
+ else
+ file2="output/$file"
+ mkdir -p `dirname $file2`
+ echo "failed, see $file2"
+ failed=`expr $failed + 1`
+ mv test.nroff "${file2}".nroff
+ mv test.mandoc "${file2}".mandoc
+ diff -u "${file2}".nroff "${file2}".mandoc > "${file2}".diff
+ fi
+done
+echo "Total: $pass passed, $failed failed"