blob: 45abbc16e0d847a118c1bbfb9d46413d1050b0db (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# $OpenBSD: Makefile,v 1.6 2016/09/28 12:40:35 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-AnyEvent provide framework for multiple event loops
# p5-Hash-Merge merge associative arrays
# p5-YAML YAML ain't a markup language
#
# Check wether all required perl packages are installed. If some
# are missing print a warning and skip the tests, but do not fail.
PERL_REQUIRE != perl -Mstrict -Mwarnings -e ' \
eval { require AnyEvent } or print $@; \
eval { require Hash::Merge } or print $@; \
eval { require YAML } or print $@; \
'
.if ! empty (PERL_REQUIRE)
regress:
@echo "${PERL_REQUIRE}"
@echo install these perl packages for additional tests
@echo SKIPPED
.endif
# Fill out these variables with your own system parameters
# You need a tap device and an unused /24 IPv4 network.
TAPNUM ?= 3
TAPIP ?= 10.188.6.17
RTRID ?= 10.188.0.17
# Automatically generate regress targets from test cases in directory.
ARGS != cd ${.CURDIR} && ls args-*.pl
TARGETS ?= ${ARGS}
REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/}
CLEANFILES += *.log ospfd.conf ktrace.out stamp-* opentap
PERLHEADER != perl -MConfig -e 'print "$$Config{archlib}/CORE"'
CLEANFILES += PassFd.c PassFd.o PassFd.so
CFLAGS = -Wall
.MAIN: all
.if make (regress) || make (all)
.BEGIN:
@echo
[ -c /dev/tap${TAPNUM} ]
[ -z "${SUDO}" ] || ${SUDO} -C 4 true
${SUDO} ifconfig tap${TAPNUM} ${TAPIP} netmask 255.255.255.0
.endif
# Set variables so that make runs with and without obj directory.
# Only do that if necessary to keep visible output short.
.if ${.CURDIR} == ${.OBJDIR}
PERLINC =
PERLPATH =
.else
PERLINC = -I${.CURDIR}
PERLPATH = ${.CURDIR}/
.endif
# The arg tests take a perl hash with arguments controlling the
# test parameters.
.for a in ${ARGS}
run-regress-$a: $a opentap PassFd.so
@echo '\n======== $@ ========'
time TAPNUM=${TAPNUM} TAPIP=${TAPIP} RTRID=${RTRID} SUDO=${SUDO} KTRACE=${KTRACE} OSPFD=${OSPFD} perl ${PERLINC} ${PERLPATH}ospfd.pl ${PERLPATH}$a
.endfor
# make perl syntax check for all args files
.PHONY: syntax
syntax: stamp-syntax
stamp-syntax: ${ARGS} stamp-passfd
.for a in ${ARGS}
@TAPNUM=${TAPNUM} TAPIP=${TAPIP} RTRID=${RTRID} perl ${PERLINC} -c ${PERLPATH}$a
.endfor
@date >$@
# build and test file descriptor passing perl xs module
.PHONY: passfd
passfd: stamp-passfd
stamp-passfd: PassFd.so
perl ${PERLINC} ${PERLPATH}testfd.pl
@date >$@
.SUFFIXES: .xs .so
.xs.so:
xsubpp -prototypes $> >${@:S/.so$/.c/}
gcc -shared -Wall -I${PERLHEADER} -o $@ ${@:S/.so$/.c/}
perl ${PERLINC} -M${@:R} -e ''
.include <bsd.regress.mk>
|