summaryrefslogtreecommitdiff
path: root/regress/sys/netinet6
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-05-10 02:22:35 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-05-10 02:22:35 +0000
commitc3c5c7c78ac1fe591d9e71172fe2873dae432ba7 (patch)
tree9b1f0eefae527172a47a6f47b5bd6adfde843e86 /regress/sys/netinet6
parentef94837688901fc304db17f56151d91cbd05fe77 (diff)
Simplify the detection for installed python and scapy. Refactor
these tests to make them similar. Use the setup and cleanup variables.
Diffstat (limited to 'regress/sys/netinet6')
-rw-r--r--regress/sys/netinet6/frag6/Makefile45
-rw-r--r--regress/sys/netinet6/nd6/Makefile24
-rw-r--r--regress/sys/netinet6/rh0/Makefile30
-rw-r--r--regress/sys/netinet6/rip6cksum/Makefile43
4 files changed, 62 insertions, 80 deletions
diff --git a/regress/sys/netinet6/frag6/Makefile b/regress/sys/netinet6/frag6/Makefile
index 06f5ebae0fb..06555b1eb05 100644
--- a/regress/sys/netinet6/frag6/Makefile
+++ b/regress/sys/netinet6/frag6/Makefile
@@ -1,22 +1,14 @@
-# $OpenBSD: Makefile,v 1.24 2018/09/10 13:00:58 bluhm Exp $
+# $OpenBSD: Makefile,v 1.25 2019/05/10 02:22:34 bluhm Exp $
# The following ports must be installed:
#
# python-2.7 interpreted object-oriented programming language
-# py-libdnet python interface to libdnet
# scapy powerful interactive packet manipulation in python
-.if ! (make(clean) || make(cleandir) || make(obj))
-# 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
-.endif
-
-.if ! empty(PYTHON_IMPORT)
+.if ! exists(/usr/local/bin/python2.7) || ! exists(/usr/local/bin/scapy)
.BEGIN:
@true
regress:
- @echo '${PYTHON_IMPORT}'
@echo Install python and the scapy module for additional tests.
@echo SKIPPED
.endif
@@ -54,7 +46,7 @@ regress:
.MAIN: all
.if make (regress) || make (all)
-.BEGIN: addr.py
+.BEGIN:
@echo
${SUDO} true
ssh -t ${REMOTE_SSH} ${SUDO} true
@@ -75,18 +67,20 @@ addr.py: Makefile
# 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 ./
+PYTHON = python2.7 -u ./
.else
-PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/
+PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/
.endif
stamp-stack:
+ @echo '\n======== $@ ========'
rm -f stamp-stack stamp-pf
-ssh ${REMOTE_SSH} ${SUDO} pfctl -d
ssh ${REMOTE_SSH} ${SUDO} pfctl -a regress -Fr
date >$@
stamp-pf: addr.py pf.conf
+ @echo '\n======== $@ ========'
rm -f stamp-stack stamp-pf
cat addr.py ${.CURDIR}/pf.conf | pfctl -n -f -
cat addr.py ${.CURDIR}/pf.conf | \
@@ -94,10 +88,9 @@ stamp-pf: addr.py pf.conf
-ssh ${REMOTE_SSH} ${SUDO} pfctl -e
date >$@
-REGRESS_TARGETS =
FRAG6_SCRIPTS !!= cd ${.CURDIR} && ls -1 frag6*.py
-run-regress-stack-frag6_queuelimit.py:
+run-stack-frag6_queuelimit.py:
@echo '\n======== $@ ========'
# the stack does not limit the amount of fragments during reassembly
@echo DISABLED
@@ -106,8 +99,9 @@ run-regress-stack-frag6_queuelimit.py:
# Ping all addresses. This ensures that the ip addresses are configured
# and all routing table are set up to allow bidirectional packet flow.
-${sp}: run-regress-${sp}-ping6
-run-regress-${sp}-ping6: stamp-${sp}
+${sp}: run-${sp}-ping6
+REGRESS_TARGETS += run-${sp}-ping6
+run-${sp}-ping6: stamp-${sp}
@echo '\n======== $@ ========'
.for ip in LOCAL_ADDR REMOTE_ADDR
@echo Check ping6 ${ip}6:
@@ -116,8 +110,9 @@ run-regress-${sp}-ping6: stamp-${sp}
# Ping all addresses again but with 5000 bytes payload. These large
# packets get fragmented by LOCAL and must be handled by REMOTE.
-${sp}: run-regress-${sp}-fragping6
-run-regress-${sp}-fragping6: stamp-${sp}
+${sp}: run-${sp}-fragping6
+REGRESS_TARGETS += run-${sp}-fragping6
+run-${sp}-fragping6: stamp-${sp}
@echo '\n======== $@ ========'
.for ip in LOCAL_ADDR REMOTE_ADDR
@echo Check ping6 ${ip}6:
@@ -125,27 +120,23 @@ run-regress-${sp}-fragping6: stamp-${sp}
.endfor
.for s in ${FRAG6_SCRIPTS}
-${sp}: run-regress-${sp}-${s}
-run-regress-${sp}-${s}: addr.py stamp-${sp}
+${sp}: run-${sp}-${s}
+REGRESS_TARGETS += run-${sp}-${s}
+run-${sp}-${s}: addr.py stamp-${sp}
@echo '\n======== $@ ========'
${SUDO} ${PYTHON}${s}
.endfor
-REGRESS_TARGETS += run-regress-${sp}-ping6 run-regress-${sp}-fragping6 \
- ${FRAG6_SCRIPTS:S/^/run-regress-${sp}-/}
-
.endfor
# After running the tests, turn on pf on remote machine.
# This is the expected default configuration.
-
+REGRESS_CLEANUP += cleanup-pf
cleanup-pf:
rm -f stamp-stack stamp-pf
ssh ${REMOTE_SSH} ${SUDO} pfctl -a regress -Fa
-ssh ${REMOTE_SSH} ${SUDO} pfctl -e || true
-REGRESS_TARGETS += cleanup-pf
-
CLEANFILES += addr.py *.pyc *.log stamp-*
.PHONY: check-setup check-setup-local check-setup-remote
diff --git a/regress/sys/netinet6/nd6/Makefile b/regress/sys/netinet6/nd6/Makefile
index 99f92483254..856b16adc20 100644
--- a/regress/sys/netinet6/nd6/Makefile
+++ b/regress/sys/netinet6/nd6/Makefile
@@ -1,20 +1,12 @@
-# $OpenBSD: Makefile,v 1.8 2017/12/20 23:37:56 bluhm Exp $
+# $OpenBSD: Makefile,v 1.9 2019/05/10 02:22:34 bluhm Exp $
# The following ports must be installed:
#
# python-2.7 interpreted object-oriented programming language
-# py-libdnet python interface to libdnet
# scapy powerful interactive packet manipulation in python
-.if ! (make(clean) || make(cleandir) || make(obj))
-# 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
-.endif
-
-.if ! empty(PYTHON_IMPORT)
+.if ! exists(/usr/local/bin/python2.7) || ! exists(/usr/local/bin/scapy)
regress:
- @echo '${PYTHON_IMPORT}'
@echo Install python and the scapy module for additional tests.
@echo SKIPPED
.endif
@@ -85,15 +77,16 @@ addr.py: Makefile
# 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 ./
+PYTHON = python2.7 -u ./
.else
-PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/
+PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.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.
-run-regress-ping6:
+REGRESS_TARGETS = run-ping6
+run-ping6:
@echo '\n======== $@ ========'
${SUDO} ndp -c
.for ip in LOCAL_ADDR REMOTE_ADDR
@@ -104,13 +97,12 @@ run-regress-ping6:
ND6_SCRIPTS !!= cd ${.CURDIR} && ls -1 nd6*.py
.for s in ${ND6_SCRIPTS}
-run-regress-${s}: addr.py
+REGRESS_TARGETS = run-${s}
+run-${s}: addr.py
@echo '\n======== $@ ========'
${SUDO} ${PYTHON}${s}
.endfor
-REGRESS_TARGETS = run-regress-ping6 ${ND6_SCRIPTS:S/^/run-regress-/}
-
CLEANFILES += addr.py *.pyc *.log
.PHONY: check-setup check-setup-local check-setup-remote
diff --git a/regress/sys/netinet6/rh0/Makefile b/regress/sys/netinet6/rh0/Makefile
index d1d4804304c..633cdac6e5a 100644
--- a/regress/sys/netinet6/rh0/Makefile
+++ b/regress/sys/netinet6/rh0/Makefile
@@ -1,22 +1,14 @@
-# $OpenBSD: Makefile,v 1.11 2017/07/07 23:15:27 bluhm Exp $
+# $OpenBSD: Makefile,v 1.12 2019/05/10 02:22:34 bluhm Exp $
# The following ports must be installed:
#
# python-2.7 interpreted object-oriented programming language
-# py-libdnet python interface to libdnet
# scapy powerful interactive packet manipulation in python
-.if ! (make(clean) || make(cleandir) || make(obj))
-# 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
-.endif
-
-.if ! empty(PYTHON_IMPORT)
+.if ! exists(/usr/local/bin/python2.7) || ! exists(/usr/local/bin/scapy)
.BEGIN:
@true
regress:
- @echo '${PYTHON_IMPORT}'
@echo Install python and the scapy module for additional tests.
@echo SKIPPED
.endif
@@ -82,18 +74,23 @@ addr.py: Makefile
# 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 ./
+PYTHON = python2.7 -u ./
.else
-PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/
+PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/
.endif
stamp-stack:
+ @echo '\n======== $@ ========'
rm -f stamp-stack stamp-pf
-ssh ${REMOTE_SSH} ${SUDO} pfctl -d
ssh ${REMOTE_SSH} ${SUDO} pfctl -a regress -Fr
date >$@
+# After running the tests, turn on pf on remote machine.
+# This is the expected default configuration.
+REGRESS_CLEANUP += stamp-pf
stamp-pf:
+ @echo '\n======== $@ ========'
rm -f stamp-stack stamp-pf
echo 'pass proto tcp from port ssh no state\n'\
'pass proto tcp to port ssh no state'|\
@@ -104,17 +101,12 @@ stamp-pf:
RH0_SCRIPTS !!= cd ${.CURDIR} && ls -1 rh0*.py
.for s in ${RH0_SCRIPTS}
-run-regress-${s}: addr.py stamp-stack
+REGRESS_TARGETS = run-${s}
+run-${s}: addr.py stamp-stack
@echo '\n======== $@ ========'
${SUDO} ${PYTHON}${s}
.endfor
-REGRESS_TARGETS = ${RH0_SCRIPTS:S/^/run-regress-/}
-
-# After running the tests, turn on pf on remote machine.
-# This is the expected default configuration.
-REGRESS_TARGETS += stamp-pf
-
CLEANFILES += addr.py *.pyc *.log stamp-*
.PHONY: check-setup check-setup-local check-setup-remote
diff --git a/regress/sys/netinet6/rip6cksum/Makefile b/regress/sys/netinet6/rip6cksum/Makefile
index 260c3abc7e3..97f97bea075 100644
--- a/regress/sys/netinet6/rip6cksum/Makefile
+++ b/regress/sys/netinet6/rip6cksum/Makefile
@@ -1,12 +1,11 @@
-# $OpenBSD: Makefile,v 1.1 2019/05/09 15:54:31 bluhm Exp $
+# $OpenBSD: Makefile,v 1.2 2019/05/10 02:22:34 bluhm Exp $
# The following ports must be installed:
#
# python-2.7 interpreted object-oriented programming language
-# py-libdnet python interface to libdnet
# scapy powerful interactive packet manipulation in python
-.if ! exists(/usr/local/bin/python2) || ! exists(/usr/local/bin/scapy)
+.if ! exists(/usr/local/bin/python2.7) || ! exists(/usr/local/bin/scapy)
regress:
@echo Install python and the scapy module for additional tests.
@echo SKIPPED
@@ -15,6 +14,14 @@ regress:
PROG = rip6cksum
WARNINGS = yes
+# 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 -u ./
+.else
+PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/
+.endif
+
REGRESS_TARGETS += run-error-negative
run-error-negative:
@echo "\n======== $@ ========"
@@ -32,105 +39,105 @@ run-no-cksum:
# send and receive packet without checksum
@echo "\n======== $@ ========"
${SUDO} ./rip6cksum -r 32 -s 8 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -r 8 -s 32
+ ${PYTHON}sendrecv.py -r 8 -s 32
REGRESS_TARGETS += run-bad-cksum
run-bad-cksum:
# enable checksum, send packet without checksum, expect icmp
@echo "\n======== $@ ========"
${SUDO} ./rip6cksum -c 0 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 32 -s 32
+ ${PYTHON}sendrecv.py -i -r 32 -s 32
REGRESS_TARGETS += run-disable-cksum
run-disable-cksum:
# send and receive packet with explicitly disabled checksum
@echo "\n======== $@ ========"
${SUDO} ./rip6cksum -c -1 -r 32 -s 8 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -r 8 -s 32
+ ${PYTHON}sendrecv.py -r 8 -s 32
REGRESS_TARGETS += run-ckoff-0
run-ckoff-0:
@echo "\n======== $@ ========"
# use checksum at offset 0
${SUDO} ./rip6cksum -c 0 -r 32 -s 8 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 0 -r 8 -s 32
+ ${PYTHON}sendrecv.py -c 0 -r 8 -s 32
REGRESS_TARGETS += run-ckoff-0-empty
run-ckoff-0-empty:
@echo "\n======== $@ ========"
# use checksum at offset 0, but packet is empty, expect icmp
${SUDO} ./rip6cksum -c 0 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 0 -s 0
+ ${PYTHON}sendrecv.py -i -r 0 -s 0
REGRESS_TARGETS += run-ckoff-0-short
run-ckoff-0-short:
@echo "\n======== $@ ========"
# use checksum at offset 0, but packet is only 1 byte long, expect icmp
${SUDO} ./rip6cksum -c 0 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 1 -s 1
+ ${PYTHON}sendrecv.py -i -r 1 -s 1
REGRESS_TARGETS += run-ckoff-0-exact
run-ckoff-0-exact:
@echo "\n======== $@ ========"
# use checksum at offset 0, packet is exactly 2 bytes long
${SUDO} ./rip6cksum -c 0 -r 2 -s 2 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 0 -s 2
+ ${PYTHON}sendrecv.py -c 0 -s 2
REGRESS_TARGETS += run-ckoff-0-long
run-ckoff-0-long:
@echo "\n======== $@ ========"
# use checksum at offset 0, packet is 3 bytes long
${SUDO} ./rip6cksum -c 0 -r 3 -s 3 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 0 -s 3
+ ${PYTHON}sendrecv.py -c 0 -s 3
REGRESS_TARGETS += run-ckoff-2
run-ckoff-2:
@echo "\n======== $@ ========"
# use checksum at offset 2
${SUDO} ./rip6cksum -c 2 -r 32 -s 8 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 2 -r 8 -s 32
+ ${PYTHON}sendrecv.py -c 2 -r 8 -s 32
REGRESS_TARGETS += run-ckoff-2-empty
run-ckoff-2-empty:
@echo "\n======== $@ ========"
# use checksum at offset 2, but packet is empty, expect icmp
${SUDO} ./rip6cksum -c 2 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 0 -s 0
+ ${PYTHON}sendrecv.py -i -r 0 -s 0
REGRESS_TARGETS += run-ckoff-2-short-1
run-ckoff-2-short-1:
@echo "\n======== $@ ========"
# use checksum at offset 2, but packet is only 1 byte long, expect icmp
${SUDO} ./rip6cksum -c 2 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 1 -s 1
+ ${PYTHON}sendrecv.py -i -r 1 -s 1
REGRESS_TARGETS += run-ckoff-2-short-2
run-ckoff-2-short-2:
@echo "\n======== $@ ========"
# use checksum at offset 2, but packet is only 2 byte long, expect icmp
${SUDO} ./rip6cksum -c 2 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 2 -s 2
+ ${PYTHON}sendrecv.py -i -r 2 -s 2
REGRESS_TARGETS += run-ckoff-2-short-3
run-ckoff-2-short-3:
@echo "\n======== $@ ========"
# use checksum at offset 2, but packet is only 3 byte long, expect icmp
${SUDO} ./rip6cksum -c 2 -- \
- python2 -u ${.CURDIR}/sendrecv.py -i -r 3 -s 3
+ ${PYTHON}sendrecv.py -i -r 3 -s 3
REGRESS_TARGETS += run-ckoff-2-exact
run-ckoff-2-exact:
@echo "\n======== $@ ========"
# use checksum at offset 2, packet is exactly 4 bytes long
${SUDO} ./rip6cksum -c 2 -r 4 -s 4 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 2 -s 4
+ ${PYTHON}sendrecv.py -c 2 -s 4
REGRESS_TARGETS += run-ckoff-2-long
run-ckoff-2-long:
@echo "\n======== $@ ========"
# use checksum at offset 2, packet is 5 bytes long
${SUDO} ./rip6cksum -c 2 -r 5 -s 5 -w -- \
- python2 -u ${.CURDIR}/sendrecv.py -c 2 -s 5
+ ${PYTHON}sendrecv.py -c 2 -s 5
${REGRESS_TARGETS}: ${PROG}