blob: 76c47af0fdd53b0b16a9a42c7ddd74f9877b9166 (
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
|
# $OpenBSD: Makefile,v 1.5 2017/06/25 21:59:59 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-Net-Pcap Perl interface for libpcap
# p5-NetPacket Perl interface for packet encoding/decoding
# p5-Crypt-Random To fill payloads with weak random data
#
# 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 NetPacket::Ethernet } or print $@; \
eval { require Net::Pcap } or print $@; \
eval { require Crypt::Random } or print $@; \
'
.if ! empty (PERL_REQUIRE)
regress:
@echo "${PERL_REQUIRE}"
@echo install these perl packages for additional tests
@echo SKIPPED
.endif
# Automatically generate regress targets from test cases in directory.
ARGS != cd ${.CURDIR} && ls args-*.pm
TARGETS ?= ${ARGS}
REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/}
CLEANFILES += stamp-* *.h *.ph *.conf *.log ktrace.out
SRC_PATH = ${.CURDIR}/../../../usr.sbin/switchd
SYS_PATH = ${.CURDIR}/../../../sys/net
OFP_HEADERS = ofp.h ofp10.h
OFP_PERLHEADERS = ${OFP_HEADERS:S/.h/.ph/}
# 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. Generally they consist of switch, switchd.
.for a in ${ARGS}
run-regress-$a: $a
@echo '\n======== $@ ========'
time SUDO=${SUDO} KTRACE=${KTRACE} SWITCHD=${SWITCHD} perl ${PERLINC} ${PERLPATH}run.pl ${PERLPATH}$a
.endfor
${OFP_HEADERS}:
@-mkdir -p ${.OBJDIR}/net
@-for i in ${SRC_PATH}/$@ ${SYS_PATH}/$@; do \
test -s $$i && grep -v '^#include' $$i > ${.OBJDIR}/$@; \
done
.SUFFIXES: .h .ph
.h.ph:
@h2ph -d ${.OBJDIR} $<
${REGRESS_TARGETS:M*}: ${OFP_PERLHEADERS}
# make perl syntax check for all args files
.PHONY: syntax
syntax: stamp-syntax
stamp-syntax: ${ARGS}
.for a in ${ARGS}
@perl -c ${PERLPATH}$a
.endfor
@date >$@
.include <bsd.regress.mk>
|