bsd.regress.mk revision 1.9
1#	$OpenBSD: bsd.regress.mk,v 1.9 2002/02/17 01:10:15 marc Exp $
2# No man pages for regression tests.
3NOMAN=
4
5# No installation.
6install:
7
8# If REGRESSTARGETS is defined and PROG is not defined, set NOPROG
9.if defined(REGRESSTARGETS) && !defined(PROG)
10NOPROG=
11.endif
12
13.include <bsd.prog.mk>
14
15.MAIN: all
16all: regress
17
18# XXX - Need full path to REGRESSLOG, otherwise there will be much pain.
19
20REGRESSLOG?=/dev/null
21REGRESSNAME=${.CURDIR:S/${BSDSRCDIR}\/regress\///}
22
23.if defined(PROG) && !empty(PROG)
24run-regress-${PROG}: ${PROG}
25	./${PROG}
26.endif
27
28.if !defined(REGRESSTARGETS)
29REGRESSTARGETS=run-regress-${PROG}
30.  if defined(REGRESSSKIP)
31REGRESSSKIPTARGETS=run-regress-${PROG}
32.  endif
33.endif
34
35REGRESSSKIPSLOW?=no
36
37.if (${REGRESSSKIPSLOW:L} == "yes") && defined(REGRESSSLOWTARGETS)
38REGRESSSKIPTARGETS+=${REGRESSSLOWTARGETS}
39.endif
40
41.if defined(REGRESSROOTTARGETS)
42ROOTUSER!=id -g
43SUDO?=
44. if (${ROOTUSER} != 0) && empty(SUDO)
45REGRESSSKIPTARGETS+=${REGRESSROOTTARGETS}
46. endif
47.endif
48
49REGRESSSKIPTARGETS?=
50
51regress:
52.for RT in ${REGRESSTARGETS} 
53.  if ${REGRESSSKIPTARGETS:M${RT}}
54	@echo -n "SKIP " >> ${REGRESSLOG}
55.  else
56# XXX - we need a better method to see if a test fails due to timeout or just
57#       normal failure.
58.   if !defined(REGRESSMAXTIME)
59	@if cd ${.CURDIR} && ${MAKE} ${RT}; then \
60	    echo -n "SUCCESS " >> ${REGRESSLOG} ; \
61	else \
62	    echo -n "FAIL " >> ${REGRESSLOG} ; \
63	    echo FAILED ; \
64	fi
65.   else
66	@if cd ${.CURDIR} && (ulimit -t ${REGRESSMAXTIME} ; ${MAKE} ${RT}); then \
67	    echo -n "SUCCESS " >> ${REGRESSLOG} ; \
68	else \
69	    echo -n "FAIL (possible timeout) " >> ${REGRESSLOG} ; \
70	    echo FAILED ; \
71	fi
72.   endif
73.  endif
74	@echo ${REGRESSNAME}/${RT:S/^run-regress-//} >> ${REGRESSLOG}
75.endfor
76
77.PHONY: regress
78