summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-01-01 22:54:29 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-01-01 22:54:29 +0000
commitc9d518452bfddc63f00a995132317442cb5ead9f (patch)
tree3408ab6801b6e9727f4a6d2c9ea5362b9b56dae3
parentce5d09a9ccafbd43f6f028fde6d380804d13f010 (diff)
Start for a framework for regression tests. Simplifies the most common
regress test targets, provides logging of success/failure and various minor features. Much Makefile magic from espie@ who thinks that my shell programming skills are "atrocious" (and I agree).
-rw-r--r--share/mk/bsd.regress.mk49
1 files changed, 49 insertions, 0 deletions
diff --git a/share/mk/bsd.regress.mk b/share/mk/bsd.regress.mk
new file mode 100644
index 00000000000..2e11ce1b734
--- /dev/null
+++ b/share/mk/bsd.regress.mk
@@ -0,0 +1,49 @@
+# No man pages for regression tests.
+NOMAN=
+
+# No installation.
+install:
+
+# If REGRESSTARGETS is defined and PROG is not defined, set a dummy
+# PROG
+.if defined(REGRESSTARGETS) && !defined(PROG)
+PROG=
+.endif
+
+.include <bsd.prog.mk>
+
+# XXX - Need full path to REGRESSLOG, otherwise there will be much pain.
+
+REGRESSLOG?=/dev/null
+REGRESSNAME=${.CURDIR:S/${BSDSRCDIR}\/regress\///}
+
+.if defined(PROG) && !empty(PROG)
+run-regress-${PROG}: ./${PROG}
+ ./${PROG}
+.endif
+
+.if !defined(REGRESSTARGETS)
+REGRESSTARGETS=run-regress-${PROG}
+. if defined(REGRESSSKIP)
+REGRESSSKIPTARGETS=run-regress-${PROG}
+. endif
+.endif
+
+REGRESSSKIPTARGETS?=
+
+regress:
+.for RT in ${REGRESSTARGETS}
+. if ${REGRESSSKIPTARGETS:M${RT}}
+ @echo -n "SKIP " >> ${REGRESSLOG}
+. else
+ @if cd ${.CURDIR} && ${MAKE} ${RT}; then \
+ echo -n "SUCCESS " >> ${REGRESSLOG} ; \
+ else \
+ echo -n "FAIL " >> ${REGRESSLOG} ; \
+ echo FAILED ; \
+ fi
+. endif
+ @echo ${REGRESSNAME}/${RT:S/^run-regress-//} >> ${REGRESSLOG}
+.endfor
+
+.PHONY: regress