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