diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-10-31 01:24:07 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-10-31 01:24:07 +0000 |
commit | 5b31eb5c5eb741a110a3483a2deff84a482dc265 (patch) | |
tree | 7ef24917e3920d7e011f510cac16ec665a96704a /regress/sys | |
parent | 6f0b30198be4c138b5b645e793acbc0c9d1c49e7 (diff) |
Do not fail the regression tests if python or the scapy package is
not installed. Print a warning, explain the problem and skip the
test in this case. Also skip the test if the environment has not
been configured for the remote test target machine. Fix the Makefile
to run the tests with or without an obj directory. Finally link
the netinet6 regression tests into the build.
Diffstat (limited to 'regress/sys')
-rw-r--r-- | regress/sys/Makefile | 4 | ||||
-rw-r--r-- | regress/sys/netinet6/Makefile | 5 | ||||
-rw-r--r-- | regress/sys/netinet6/frag6/Makefile | 70 | ||||
-rw-r--r-- | regress/sys/netinet6/nd6/Makefile | 45 | ||||
-rw-r--r-- | regress/sys/netinet6/rh0/Makefile | 80 |
5 files changed, 153 insertions, 51 deletions
diff --git a/regress/sys/Makefile b/regress/sys/Makefile index 5b6768fc376..045e46e63dc 100644 --- a/regress/sys/Makefile +++ b/regress/sys/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.18 2008/08/22 00:48:33 bluhm Exp $ +# $OpenBSD: Makefile,v 1.19 2013/10/31 01:24:06 bluhm Exp $ # $NetBSD: Makefile,v 1.4 1995/04/20 22:41:08 cgd Exp $ -SUBDIR+= copy crypto ddb fifofs kern net ptrace sys uvm dev +SUBDIR+= copy crypto ddb fifofs kern net netinet6 ptrace sys uvm dev .if exists(arch/${MACHINE}) SUBDIR+= arch/${MACHINE} .endif diff --git a/regress/sys/netinet6/Makefile b/regress/sys/netinet6/Makefile new file mode 100644 index 00000000000..baed3eb60d9 --- /dev/null +++ b/regress/sys/netinet6/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2013/10/31 01:24:06 bluhm Exp $ + +SUBDIR = frag6 nd6 rh0 + +.include <bsd.subdir.mk> diff --git a/regress/sys/netinet6/frag6/Makefile b/regress/sys/netinet6/frag6/Makefile index 83d761ada24..ad0beb72ce4 100644 --- a/regress/sys/netinet6/frag6/Makefile +++ b/regress/sys/netinet6/frag6/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2013/07/23 22:38:45 bluhm Exp $ +# $OpenBSD: Makefile,v 1.9 2013/10/31 01:24:06 bluhm Exp $ # The following ports must be installed: # @@ -6,6 +6,15 @@ # py-libdnet python interface to libdnet # scapy powerful interactive packet manipulation in python +# Check wether all required python packages are installed. If some +# are missing print a warning and skip the tests, but do not fail. +PYTHON_IMPORT != python2.7 -c 'from scapy.all import *' 2>&1 || true +.if ! empty(PYTHON_IMPORT) +regress: + @echo '${PYTHON_IMPORT}' + @echo install python and the scapy module for additional tests +.endif + # This test needs a manual setup of two machines # Set up machines: SRC DST # SRC is the machine where this makefile is running. @@ -20,12 +29,20 @@ # Configure Addresses on the machines. # Adapt interface and addresse variables to your local setup. # -SRC_IF = tun0 -SRC_MAC = fe:e1:ba:d1:56:1f -DST_MAC = 52:54:00:12:34:50 +SRC_IF ?= +SRC_MAC ?= +DST_MAC ?= + +SRC_OUT6 ?= +DST_IN6 ?= -SRC_OUT6 = fdd7:e83e:66bc:211:fce1:baff:fed1:561f -DST_IN6 = fdd7:e83e:66bc:211:5054:ff:fe12:3450 +.if empty (SRC_IF) || empty (SRC_MAC) || empty (DST_MAC) || \ + empty (SRC_OUT6) || empty (DST_IN6) +regress: + @echo this tests needs a remote machine to operate on + @echo SRC_IF SRC_MAC DST_MAC SRC_OUT6 DST_IN6 are empty + @echo fill out these variables for additional tests +.endif depend: addr.py @@ -36,11 +53,18 @@ addr.py: Makefile echo 'SRC_MAC = "${SRC_MAC}"' >>$@.tmp echo 'DST_MAC = "${DST_MAC}"' >>$@.tmp .for var in SRC_OUT DST_IN - echo '${var} = "${${var}}"' >>$@.tmp echo '${var}6 = "${${var}6}"' >>$@.tmp .endfor mv $@.tmp $@ +# Set variables so that make runs with and without obj directory. +# Only do that if necessary to keep visible output short. +.if ${.CURDIR} == ${.OBJDIR} +PYTHON = python2.7 ./ +.else +PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/ +.endif + # Ping all addresses. This ensures that the ip addresses are configured # and all routing table are set up to allow bidirectional packet flow. TARGETS += ping6 @@ -66,112 +90,112 @@ TARGETS += frag6 run-regress-frag6: addr.py @echo '\n======== $@ ========' @echo Check ping6 reassembly - ${SUDO} python2.7 frag6.py + ${SUDO} ${PYTHON}frag6.py # An hop by hop options extension header before the fragment header TARGETS += frag6-ext run-regress-frag6-ext: addr.py @echo '\n======== $@ ========' @echo Check ping6 extension header reassembly - ${SUDO} python2.7 frag6_ext.py + ${SUDO} ${PYTHON}frag6_ext.py # An destination options extension header after the fragment header TARGETS += frag6-opt run-regress-frag6-opt: addr.py @echo '\n======== $@ ========' @echo Check ping6 destination option reassembly - ${SUDO} python2.7 frag6_opt.py + ${SUDO} ${PYTHON}frag6_opt.py # fragmented packet with head overlapping first fragment TARGETS += frag6-overhead0 run-regress-frag6-overhead0: addr.py @echo '\n======== $@ ========' @echo Check ping6 head overlapping first fragment - ${SUDO} python2.7 frag6_overhead0.py + ${SUDO} ${PYTHON}frag6_overhead0.py # fragmented packet with head overlapping second fragment TARGETS += frag6-overhead run-regress-frag6-overhead: addr.py @echo '\n======== $@ ========' @echo Check ping6 head overlapping second fragment - ${SUDO} python2.7 frag6_overhead.py + ${SUDO} ${PYTHON}frag6_overhead.py # fragmented packet with tail overlapping last fragment TARGETS += frag6-overtail run-regress-frag6-overtail: addr.py @echo '\n======== $@ ========' @echo Check ping6 tail overlapping last fragment - ${SUDO} python2.7 frag6_overtail.py + ${SUDO} ${PYTHON}frag6_overtail.py # fragmented packet with overlap, drop future fragments TARGETS += frag6-overdrop run-regress-frag6-overdrop: addr.py @echo '\n======== $@ ========' @echo Check ping6 overlap drop future fragments - ${SUDO} python2.7 frag6_overdrop.py + ${SUDO} ${PYTHON}frag6_overdrop.py # fragmented packet with overlap, atomic fragment must be processed TARGETS += frag6-overatomic run-regress-frag6-overatomic: addr.py @echo '\n======== $@ ========' @echo Check ping6 overlapping and atomic fragments - ${SUDO} python2.7 frag6_overatomic.py + ${SUDO} ${PYTHON}frag6_overatomic.py # atomic fragment with short fragmented payload TARGETS += frag6-shortatomic run-regress-frag6-shortatomic: addr.py @echo '\n======== $@ ========' @echo Check ping6 short atomic fragments - ${SUDO} python2.7 frag6_shortatomic.py + ${SUDO} ${PYTHON}frag6_shortatomic.py # fragmented packet permuted fragments TARGETS += frag6-permute run-regress-frag6-permute: addr.py @echo '\n======== $@ ========' @echo Check ping6 permuted fragments - ${SUDO} python2.7 frag6_permute.py + ${SUDO} ${PYTHON}frag6_permute.py # fragmented packet with zero length first fragment TARGETS += frag6-zerofirst run-regress-frag6-zerofirst: addr.py @echo '\n======== $@ ========' @echo Check ping6 zero length first fragment - ${SUDO} python2.7 frag6_zerofirst.py + ${SUDO} ${PYTHON}frag6_zerofirst.py # fragmented packet with zero length second fragment TARGETS += frag6-zerosecond run-regress-frag6-zerosecond: addr.py @echo '\n======== $@ ========' @echo Check ping6 zero length second fragment - ${SUDO} python2.7 frag6_zerosecond.py + ${SUDO} ${PYTHON}frag6_zerosecond.py # atomic fragmented udp packet TARGETS += frag6-udpatomic run-regress-frag6-udpatomic: addr.py @echo '\n======== $@ ========' @echo Check ping6 atomic udp fragment - ${SUDO} python2.7 frag6_udpatomic.py + ${SUDO} ${PYTHON}frag6_udpatomic.py # fragmented udp packet after header TARGETS += frag6-udpheader run-regress-frag6-udpheader: addr.py @echo '\n======== $@ ========' @echo Check ping6 udp header fragment - ${SUDO} python2.7 frag6_udpheader.py + ${SUDO} ${PYTHON}frag6_udpheader.py # fragmented udp packet within payload TARGETS += frag6-udppayload run-regress-frag6-udppayload: addr.py @echo '\n======== $@ ========' @echo Check ping6 udp payload fragment - ${SUDO} python2.7 frag6_udppayload.py + ${SUDO} ${PYTHON}frag6_udppayload.py # fragmented icmp packet not within 60 second timeout, test takes 90 seconds TARGETS += frag6-timeout run-regress-frag6-timeout: addr.py @echo '\n======== $@ ========' @echo Check ping6 fragment timeout - ${SUDO} python2.7 frag6_timeout.py + ${SUDO} ${PYTHON}frag6_timeout.py REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} diff --git a/regress/sys/netinet6/nd6/Makefile b/regress/sys/netinet6/nd6/Makefile index 3b0d54a4585..3c665ad62b4 100644 --- a/regress/sys/netinet6/nd6/Makefile +++ b/regress/sys/netinet6/nd6/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2012/01/31 00:14:02 bluhm Exp $ +# $OpenBSD: Makefile,v 1.2 2013/10/31 01:24:06 bluhm Exp $ # The following ports must be installed: # @@ -6,6 +6,15 @@ # py-libdnet python interface to libdnet # scapy powerful interactive packet manipulation in python +# Check wether all required python packages are installed. If some +# are missing print a warning and skip the tests, but do not fail. +PYTHON_IMPORT != python2.7 -c 'from scapy.all import *' 2>&1 || true +.if ! empty(PYTHON_IMPORT) +regress: + @echo '${PYTHON_IMPORT}' + @echo install python and the scapy module for additional tests +.endif + # This test needs a manual setup of two machines # Set up machines: SRC DST # SRC is the machine where this makefile is running. @@ -19,12 +28,12 @@ # Configure Addresses on the machines. # Adapt interface and addresse variables to your local setup. # -SRC_IF = tun0 -SRC_MAC = fe:e1:ba:d1:56:1f -DST_MAC = 52:54:00:12:34:50 +SRC_IF ?= +SRC_MAC ?= +DST_MAC ?= -SRC_OUT6 = fdd7:e83e:66bc:211:fce1:baff:fed1:561f -DST_IN6 = fdd7:e83e:66bc:211:5054:ff:fe12:3450 +SRC_OUT6 ?= +DST_IN6 ?= # pf rules on DST should look like this: # @@ -50,6 +59,14 @@ DST_IN6 = fdd7:e83e:66bc:211:5054:ff:fe12:3450 # - request NS from interface address to target unicast # - response NA from interface address to source of NS +.if empty (SRC_IF) || empty (SRC_MAC) || empty (DST_MAC) || \ + empty (SRC_OUT6) || empty (DST_IN6) +regress: + @echo this tests needs a remote machine to operate on + @echo SRC_IF SRC_MAC DST_MAC SRC_OUT6 DST_IN6 are empty + @echo fill out these variables for additional tests +.endif + depend: addr.py # Create python include file containing the addresses. @@ -64,6 +81,14 @@ addr.py: Makefile .endfor mv $@.tmp $@ +# Set variables so that make runs with and without obj directory. +# Only do that if necessary to keep visible output short. +.if ${.CURDIR} == ${.OBJDIR} +PYTHON = python2.7 ./ +.else +PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/ +.endif + # Clear neighbor cache and ping all addresses. This ensures that # the ip addresses are configured and all routing table are set up # to allow bidirectional packet flow. @@ -81,28 +106,28 @@ TARGETS += nd6_dad run-regress-nd6_dad: addr.py @echo '\n======== $@ ========' @echo Check duplicate address detection - ${SUDO} python2.7 nd6_dad.py + ${SUDO} ${PYTHON}nd6_dad.py # Send hand-crafted address resolution neighbor solicitation packet TARGETS += nd6_ar run-regress-nd6_ar: addr.py @echo '\n======== $@ ========' @echo Check address resolution - ${SUDO} python2.7 nd6_ar.py + ${SUDO} ${PYTHON}nd6_ar.py # Send hand-crafted unsolicited neighbor advertisement packet TARGETS += nd6_una run-regress-nd6_una: addr.py @echo '\n======== $@ ========' @echo Check unsolicited neighbor advertisement - ${SUDO} python2.7 nd6_una.py + ${SUDO} ${PYTHON}nd6_una.py # Send hand-crafted neighbor unreachability detection solicitation packet TARGETS += nd6_nud run-regress-nd6_nud: addr.py @echo '\n======== $@ ========' @echo Check neighbor unreachability detection - ${SUDO} python2.7 nd6_nud.py + ${SUDO} ${PYTHON}nd6_nud.py REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} diff --git a/regress/sys/netinet6/rh0/Makefile b/regress/sys/netinet6/rh0/Makefile index 11417bd9535..7cc58297246 100644 --- a/regress/sys/netinet6/rh0/Makefile +++ b/regress/sys/netinet6/rh0/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2013/10/20 13:45:44 bluhm Exp $ +# $OpenBSD: Makefile,v 1.2 2013/10/31 01:24:06 bluhm Exp $ # The following ports must be installed: # @@ -6,6 +6,15 @@ # py-libdnet python interface to libdnet # scapy powerful interactive packet manipulation in python +# Check wether all required python packages are installed. If some +# are missing print a warning and skip the tests, but do not fail. +PYTHON_IMPORT != python2.7 -c 'from scapy.all import *' 2>&1 || true +.if ! empty(PYTHON_IMPORT) +regress: + @echo '${PYTHON_IMPORT}' + @echo install python and the scapy module for additional tests +.endif + # This test needs a manual setup of two machines # Set up machines: SRC DST # SRC is the machine where this makefile is running. @@ -21,15 +30,25 @@ # Configure Addresses on the machines. # Adapt interface and address variables to your local setup. # -SRC_IF ?= tun0 -SRC_MAC ?= fe:e1:ba:d1:56:1f -DST_MAC ?= 70:5f:ca:21:8d:70 +SRC_IF ?= +SRC_MAC ?= +DST_MAC ?= + +SRC_OUT6 ?= +DST_IN6 ?= +DST_OUT6 ?= +SRT_IN6 ?= +SRT_OUT6 ?= -SRC_OUT6 ?= fdd7:e83e:66bc:7:fce1:baff:fed2:26be -DST_IN6 ?= fdd7:e83e:66bc:7:725f:caff:fe21:8d70 -DST_OUT6 ?= fdd7:e83e:66bc:70:725f:caff:fe21:8d70 -SRT_IN6 ?= fdd7:e83e:66bc:70::1 -SRT_OUT6 ?= fdd7:e83e:66bc:71::1 +.if empty (SRC_IF) || empty (SRC_MAC) || empty (DST_MAC) || \ + empty (SRC_OUT6) || empty (DST_IN6) || empty (DST_OUT6) || \ + empty (SRT_IN6) || empty (SRT_OUT6) +regress: + @echo this tests needs a remote machine to operate on + @echo SRC_IF SRC_MAC DST_MAC SRC_OUT6 DST_IN6 DST_OUT6 + @echo SRT_IN6 SRT_OUT6 are empty + @echo fill out these variables for additional tests +.endif depend: addr.py @@ -44,6 +63,23 @@ addr.py: Makefile .endfor mv $@.tmp $@ +# Set variables so that make runs with and without obj directory. +# Only do that if necessary to keep visible output short. +.if ${.CURDIR} == ${.OBJDIR} +PYTHON = python2.7 ./ +.else +PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/ +.endif + +# Check routes. This ensures that and the local routing tables is set up. +TARGETS += route6 +run-regress-route6: + @echo '\n======== $@ ========' +.for ip in DST_OUT SRT_IN + @echo Check route6 destination ${ip}6 gateway DST_IN6: + route -n get -inet6 ${${ip}6}/64 | grep 'gateway: ${DST_IN6}$$' +.endfor + # Ping all addresses. This ensures that the ip addresses are configured # and all routing tables are set up to allow bidirectional packet flow. TARGETS += ping6 @@ -54,14 +90,26 @@ run-regress-ping6: ping6 -n -c 1 ${${ip}6} .endfor -.for i in empty final route -# Send hand-crafted routing header type 0 packets -TARGETS += rh0-${i} -run-regress-rh0-${i}: addr.py +# Send ping6 packet with routing header type 0 but empty address list +TARGETS += rh0-empty +run-regress-rh0-empty: addr.py @echo '\n======== $@ ========' - @echo Check routing header type 0 ${i} - ${SUDO} python2.7 rh0_${i}.py -.endfor + @echo Check routing header type 0 with empty address list + ${SUDO} ${PYTHON}rh0_empty.py + +TARGETS += rh0-final +# Send ping6 packet with routing header type 0 to the final destination +run-regress-rh0-final: addr.py + @echo '\n======== $@ ========' + @echo Check routing header type 0 to the final destination + ${SUDO} ${PYTHON}rh0_final.py + +TARGETS += rh0-route +# Send ping6 packet with routing header type 0 to be source routed +run-regress-rh0-route: addr.py + @echo '\n======== $@ ========' + @echo Check routing header type 0 to be source routed + ${SUDO} ${PYTHON}rh0_route.py REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} |