summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/rebound/Makefile
blob: e82ed8bbf1a580430a1eb585ac31b287cf3189d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# $OpenBSD: Makefile,v 1.4 2018/10/31 19:59:37 anton Exp $

REBOUND=	/usr/sbin/rebound

PROG=		rebound-ns
CFLAGS+=	-Wall -Wextra

TESTS=	cache localhost record reload

# IP address prefix.
PREFIX=		172.16.0
# IP address suffixes.
IFS=		100 101 102

.if ! (make(clean) || make(cleandir) || make(obj) || make(rebound-ns))
PREREQ1!=	for v in ${IFS}; do \
			ifconfig lo$$v >/dev/null 2>&1 && echo lo$$v; \
		done; \
		exit 0
PREREQ2!=	pgrep rebound || exit 0

.  if ! empty(PREREQ1)
regress:
	@echo "${PREREQ1}: interface(s) already exists"
	@echo "SKIPPED"
.  elif ! empty(PREREQ2)
regress:
	@echo "rebound: already running"
	@echo "SKIPPED"
.  endif
.endif

REGRESS_SETUP_ONCE=	setup
setup: rebound-ns
	@echo '\n======== ${@} ========'
.for i in ${IFS}
	${SUDO} ifconfig lo${i} create
	${SUDO} ifconfig lo${i} inet ${PREFIX}.${i} netmask 255.255.255.0
.endfor

REGRESS_CLEANUP=	cleanup
cleanup:
	@echo '\n======== ${@} ========'
.for i in ${IFS}
	-${SUDO} ifconfig lo${i} destroy
.endfor

.for t in ${TESTS}
REGRESS_TARGETS+=	$t
${t}:
	@echo '\n======== $t ========'
	${SUDO} sh ${.CURDIR}/run.sh \
		-n ${.OBJDIR}/rebound-ns \
		-r ${REBOUND} \
		${IFS:C/^/-a ${PREFIX}./} \
		-- ${.CURDIR}/$t.sh
.endfor


.include <bsd.regress.mk>