[BACK]Return to regress.sh CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc / regress

File: [cvsweb.bsd.lv] / mandoc / regress / Attic / regress.sh (download)

Revision 1.6, Sun Jun 6 10:57:43 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1, VERSION_1_12_0, VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5, VERSION_1_11_4, VERSION_1_11_3, VERSION_1_11_2, VERSION_1_11_1, VERSION_1_10_9, VERSION_1_10_8, VERSION_1_10_7, VERSION_1_10_6, VERSION_1_10_5_PREPDF, VERSION_1_10_5, VERSION_1_10_4, VERSION_1_10_3, VERSION_1_10_2, VERSION_1_10_10, VERSION_1_10_1
Changes since 1.5: +6 -0 lines

Have regress.sh bail out if $MANDOC isn't found.

#!/bin/sh

MANDOC=${MANDOC:-../mandoc}
NROFF=${NROFF:-nroff}
OUTPUT=${NROFF_OUTPUT:--Tascii}

if [ ! -x $MANDOC ]
then
	echo "regress.sh: command not found: $MANDOC" 1>&2
	return 0
fi

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 */*.in */*/*.in; 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
	l=`wc -l < test.mandoc`
	head -n `expr $l - 1` test.mandoc | tail -n `expr $l - 2` > test.mandoc_
	l=`wc -l < test.nroff`
	head -n `expr $l - 1` test.nroff| tail -n `expr $l - 2` > test.nroff_
	if cmp -s test.mandoc_ test.nroff_; then
		rm -f test.mandoc test.nroff
		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
rm -f test.mandoc_ test.nroff_
echo "Total: $pass passed, $failed failed"