summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-06-20 18:27:52 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-06-20 18:27:52 +0000
commit5096d7e683aad7c818b3577c0b16983c273a4983 (patch)
tree8d2e97b287f16fc4866545e1b3a60bea1b699c8f /regress
parent8ab408b8b2772f1c44cf224241dff23de210a312 (diff)
Infrastructure for regression tests of mandoc messages.
Even though messages are not going to be as stable as formatted output, that is, even though the *.out_lint files are expected to change now and then, from now on, i want to be able to catch unintended changes in messages.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/mandoc/Makefile5
-rw-r--r--regress/usr.bin/mandoc/Makefile.inc78
-rw-r--r--regress/usr.bin/mandoc/Makefile.sub9
-rw-r--r--regress/usr.bin/mandoc/char/Makefile5
-rw-r--r--regress/usr.bin/mandoc/man/Makefile5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile5
-rw-r--r--regress/usr.bin/mandoc/roff/Makefile5
7 files changed, 77 insertions, 35 deletions
diff --git a/regress/usr.bin/mandoc/Makefile b/regress/usr.bin/mandoc/Makefile
index 36e9d64e001..75022c93c99 100644
--- a/regress/usr.bin/mandoc/Makefile
+++ b/regress/usr.bin/mandoc/Makefile
@@ -1,7 +1,6 @@
-# $OpenBSD: Makefile,v 1.8 2012/05/27 02:01:38 schwarze Exp $
+# $OpenBSD: Makefile,v 1.9 2014/06/20 18:27:51 schwarze Exp $
SUBDIR+= roff char mdoc man tbl
-ascii groff groff-clean obj-clean tman: _SUBDIRUSE
-
+.include "Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/Makefile.inc b/regress/usr.bin/mandoc/Makefile.inc
index ad24ead4796..fc434164844 100644
--- a/regress/usr.bin/mandoc/Makefile.inc
+++ b/regress/usr.bin/mandoc/Makefile.inc
@@ -1,11 +1,12 @@
-# $OpenBSD: Makefile.inc,v 1.10 2013/12/24 15:58:07 schwarze Exp $
+# $OpenBSD: Makefile.inc,v 1.11 2014/06/20 18:27:51 schwarze Exp $
+
+.include "Makefile.sub"
# --- programs ---
DIFF = diff -au
MANDOC ?= mandoc
-
# --- lists of targets ---
SKIP_ASCII ?=
@@ -29,11 +30,17 @@ _MANDIFFS += ${t}.diff_man
_UTF8FILES = ${UTF8_TARGETS:C/$/.mandoc_utf8/}
_UTF8DIFFS = ${UTF8_TARGETS:C/$/.diff_utf8/}
+_LINTFILES =
+_LINTDIFFS =
+.for t in ${LINT_TARGETS}
+_LINTFILES += ${t}.mandoc_lint
+_LINTDIFFS += ${t}.diff_lint
+.endfor
# --- convenience targets ---
# Note that bsd.regress.mk automatically adds REGRESS_TARGETS to all.
-all: ascii-clean utf8-clean tman-clean
+all: clean ${LINT_TARGETS}
ascii: ascii-clean ${_ASCIIDIFFS}
@@ -41,12 +48,13 @@ utf8: utf8-clean ${_UTF8DIFFS}
tman: tman-clean ${_MANDIFFS}
+lint: lint-clean ${_LINTDIFFS}
# --- suffix rules ---
-.SUFFIXES: .diff_ascii .diff_utf8 .diff_man .in .in_man \
- .mandoc_ascii .mandoc_utf8 .mandoc_man \
- .out_ascii .out_utf8
+.SUFFIXES: .diff_ascii .diff_lint .diff_man .diff_utf8 .in .in_man \
+ .mandoc_ascii .mandoc_lint .mandoc_man .mandoc_utf8 \
+ .out_ascii .out_lint .out_utf8
.in.mandoc_ascii:
@echo "${MANDOC} -Tascii ${.IMPSRC:T} > ${.TARGET}"
@@ -71,6 +79,14 @@ tman: tman-clean ${_MANDIFFS}
.in_man.mandoc_man:
${MANDOC} -Tascii -Omdoc ${.IMPSRC} > ${.TARGET}
+.in.mandoc_lint:
+ @echo "${MANDOC} -Tlint ${.IMPSRC:T} > ${.TARGET} 2>&1"
+ @-${MANDOC} -Tlint ${.IMPSRC} 2>&1 | \
+ sed -E 's/^mandoc: \/[^:]+\//mandoc: /' > ${.TARGET}
+
+.mandoc_lint.diff_lint:
+ @echo "${DIFF} ${.IMPSRC:S/mandoc_lint$/out_lint/} ${.IMPSRC}"
+ @${DIFF} ${.CURDIR}/${.IMPSRC:S/mandoc_lint$/out_lint/} ${.IMPSRC}
# --- single-file targets ---
@@ -86,22 +102,24 @@ ${t}.diff_man:
@echo "TODO: -Tman disabled for: ${.TARGET}"
. endif
. endif
-
${t}: ${t}.diff_ascii ${t}.diff_man
. else
${t}:
@echo "TODO: -Tascii disabled for: ${.TARGET}"
. endif
-
.endfor
+
.for t in ${UTF8_TARGETS}
${t}: ${t}.diff_utf8
.endfor
+.for t in ${LINT_TARGETS}
+${t}: ${t}.diff_lint
+.endfor
# --- phony targets ---
-clean: ascii-clean utf8-clean tman-clean
+clean: ${_CLEAN_TARGETS}
ascii-clean:
.if !empty(_ASCIIFILES)
@@ -118,8 +136,12 @@ tman-clean:
rm -f ${_MANFILES}
.endif
-.PHONY: ascii ascii-clean utf8 utf8-clean tman tman-clean \
- ${_ASCIIDIFFS} ${_UTF8DIFFS} ${_MANDIFFS}
+lint-clean:
+.if !empty(_LINTFILES)
+ rm -f ${_LINTFILES}
+.endif
+
+.PHONY: ${_ASCIIDIFFS} ${_LINTDIFFS} ${_MANDIFFS} ${_UTF8DIFFS}
# ----------------------------------------------------------------------
@@ -130,31 +152,34 @@ tman-clean:
NROFF = /usr/local/bin/nroff -c -mandoc
-
# --- the list of targets ---
SKIP_GROFF ?=
_OUTFILES =
+_LINTOUTFILES =
.for t in ${REGRESS_TARGETS}
. if empty(SKIP_GROFF:M${t}) && \
empty(SKIP_ASCII:M${t}) && empty(SKIP_ASCII:MALL)
_OUTFILES += ${t}.out_ascii
. endif
.endfor
+
.for t in ${UTF8_TARGETS}
. if empty(SKIP_GROFF:M${t})
_OUTFILES += ${t}.out_utf8
. endif
.endfor
+.for t in ${LINT_TARGETS}
+_LINTOUTFILES += ${t}.out_lint
+.endfor
-# --- the convenience target ---
+# --- the convenience targets ---
-groff: ${_OUTFILES}
- @test ! -e ${.CURDIR}/obj || \
- (echo "*** obj exists, run make obj-clean"; exit 1)
+groff: obj-check ${_OUTFILES}
+lint-out: obj-check ${_LINTOUTFILES}
# --- single-file targets ---
@@ -170,6 +195,7 @@ ${t}.out_ascii:
. endif
. endif
.endfor
+
.for t in ${UTF8_TARGETS}
. if empty(SKIP_GROFF:M${t})
${t}.out_utf8: ${t}.in
@@ -181,15 +207,27 @@ ${t}.out_utf8:
. endif
.endfor
+.for t in ${LINT_TARGETS}
+${t}.out_lint: ${t}.in
+ -${MANDOC} -Tlint ${.ALLSRC} > ${.TARGET} 2>&1
+.endfor
# --- phony targets ---
-groff-clean: obj-clean
+groff-clean: obj-check
+.if !empty(_OUTFILES)
rm -f ${_OUTFILES}
+.endif
+
+lint-out-clean: obj-check
+.if !empty(_LINTOUTFILES)
+ rm -f ${_LINTOUTFILES}
+.endif
-obj-clean: clean
+obj-clean:
rm -rf ${.CURDIR}/obj/*
rm -f ${.CURDIR}/obj
-.PHONY: groff groff-clean obj-clean
-
+obj-check:
+ @test ! -e ${.CURDIR}/obj || \
+ (echo '*** obj exists, run make obj-clean first'; false)
diff --git a/regress/usr.bin/mandoc/Makefile.sub b/regress/usr.bin/mandoc/Makefile.sub
new file mode 100644
index 00000000000..15689d4826c
--- /dev/null
+++ b/regress/usr.bin/mandoc/Makefile.sub
@@ -0,0 +1,9 @@
+# $OpenBSD: Makefile.sub,v 1.1 2014/06/20 18:27:51 schwarze Exp $
+
+_MAIN_TARGETS = ascii utf8 tman lint
+_CLEAN_TARGETS = ascii-clean utf8-clean tman-clean lint-clean
+_OUT_TARGETS = groff groff-clean lint-out lint-out-clean obj-clean
+
+${_MAIN_TARGETS} ${_CLEAN_TARGETS} ${_OUT_TARGETS}: _SUBDIRUSE
+
+.PHONY: ${_MAIN_TARGETS} ${_CLEAN_TARGETS} ${_OUT_TARGETS} obj-check
diff --git a/regress/usr.bin/mandoc/char/Makefile b/regress/usr.bin/mandoc/char/Makefile
index 59d722105bc..dbd922e0df4 100644
--- a/regress/usr.bin/mandoc/char/Makefile
+++ b/regress/usr.bin/mandoc/char/Makefile
@@ -1,7 +1,6 @@
-# $OpenBSD: Makefile,v 1.8 2014/03/08 18:00:59 schwarze Exp $
+# $OpenBSD: Makefile,v 1.9 2014/06/20 18:27:51 schwarze Exp $
SUBDIR = accent bar hyphen space unicode N
-ascii groff groff-clean obj-clean tman: _SUBDIRUSE
-
+.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/man/Makefile b/regress/usr.bin/mandoc/man/Makefile
index b9a74e228c0..f600a3ae93c 100644
--- a/regress/usr.bin/mandoc/man/Makefile
+++ b/regress/usr.bin/mandoc/man/Makefile
@@ -1,7 +1,6 @@
-# $OpenBSD: Makefile,v 1.13 2013/10/17 20:51:28 schwarze Exp $
+# $OpenBSD: Makefile,v 1.14 2014/06/20 18:27:51 schwarze Exp $
SUBDIR = BI EX HP IP PD PP RS TH TP TS UR nf blank
-ascii groff groff-clean obj-clean tman: _SUBDIRUSE
-
+.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index b2bd7682a86..3ee9f9fa6c7 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,10 +1,9 @@
-# $OpenBSD: Makefile,v 1.25 2012/07/18 16:55:54 schwarze Exp $
+# $OpenBSD: Makefile,v 1.26 2014/06/20 18:27:51 schwarze Exp $
SUBDIR = Ad An Ap Aq Ar At Bd Bf Bk Bl Brq Bx Cd Cm
SUBDIR += D1 Dl Dq Dv Em Eo Er Ev Fd Fl Fo Ft Ic In Lb Li Lk
SUBDIR += Ms Mt Nd Nm No Ns Oo Op Ox Pa Pf Pp Qq Rs
SUBDIR += Sm Sq St Sx Sy Tn Ux Va Vt Xr blank
-ascii groff groff-clean obj-clean tman: _SUBDIRUSE
-
+.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/roff/Makefile b/regress/usr.bin/mandoc/roff/Makefile
index 900c6ec99c0..439457f2827 100644
--- a/regress/usr.bin/mandoc/roff/Makefile
+++ b/regress/usr.bin/mandoc/roff/Makefile
@@ -1,8 +1,7 @@
-# $OpenBSD: Makefile,v 1.15 2014/03/30 19:47:32 schwarze Exp $
+# $OpenBSD: Makefile,v 1.16 2014/06/20 18:27:51 schwarze Exp $
SUBDIR = args cond esc string
SUBDIR += br cc de ds it ll na nr ps rm sp
-ascii groff groff-clean obj-clean tman: _SUBDIRUSE
-
+.include "../Makefile.sub"
.include <bsd.subdir.mk>