summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-10-06 10:52:25 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-10-06 10:52:25 +0000
commit3f68be9023c782a09f7e1ca7b3996b8f9a0703dd (patch)
tree10f723461e798e6b4cffbd1fdcafeddf0ff0044d /regress/usr.sbin
parente9439c684413a43e0604a31a9b71d57757319799 (diff)
Simplify regress tests by using the new setup and cleanup feature.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/httpd/tests/Makefile7
-rw-r--r--regress/usr.sbin/ospfd/Makefile19
-rw-r--r--regress/usr.sbin/relayd/Makefile13
-rw-r--r--regress/usr.sbin/switchd/Makefile15
-rw-r--r--regress/usr.sbin/syslogd/Makefile29
5 files changed, 42 insertions, 41 deletions
diff --git a/regress/usr.sbin/httpd/tests/Makefile b/regress/usr.sbin/httpd/tests/Makefile
index 976ab88b3c6..e237a3226ca 100644
--- a/regress/usr.sbin/httpd/tests/Makefile
+++ b/regress/usr.sbin/httpd/tests/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.10 2018/05/19 13:57:43 jsing Exp $
+# $OpenBSD: Makefile,v 1.11 2018/10/06 10:52:24 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets
@@ -23,8 +23,6 @@ regress:
# 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 httpd.conf ktrace.out stamp-*
CLEANFILES += *.pem *.req *.crt *.key *.srl md5-*
@@ -48,7 +46,8 @@ PERLPATH = ${.CURDIR}/
# test parameters. Generally they consist of client, httpd, server.
.for a in ${ARGS}
-run-regress-$a: $a ${HTDOCS_MD5}
+REGRESS_TARGETS += run-$a
+run-$a: $a ${HTDOCS_MD5}
@echo '\n======== $@ ========'
time SUDO=${SUDO} KTRACE=${KTRACE} HTTPD=${HTTPD} perl ${PERLINC} ${PERLPATH}httpd.pl ${.OBJDIR} ${PERLPATH}$a
.endfor
diff --git a/regress/usr.sbin/ospfd/Makefile b/regress/usr.sbin/ospfd/Makefile
index b829bbdc296..5d42a48cc08 100644
--- a/regress/usr.sbin/ospfd/Makefile
+++ b/regress/usr.sbin/ospfd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.7 2017/02/09 22:43:35 bluhm Exp $
+# $OpenBSD: Makefile,v 1.8 2018/10/06 10:52:24 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-AnyEvent provide framework for multiple event loops
@@ -30,8 +30,6 @@ 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
@@ -39,13 +37,17 @@ CFLAGS = -Wall
.MAIN: all
-.if make (regress) || make (all)
-.BEGIN:
- @echo
+REGRESS_SETUP_ONCE += setup
+setup:
+ @echo '\n======== $@ ========'
[ -c /dev/tap${TAPNUM} ]
[ -z "${SUDO}" ] || ${SUDO} -C 4 true
${SUDO} ifconfig tap${TAPNUM} ${TAPIP} netmask 255.255.255.0
-.endif
+
+REGRESS_CLEANUP += cleanup
+cleanup:
+ @echo '\n======== $@ ========'
+ -${SUDO} ifconfig tap${TAPNUM} destroy
# Set variables so that make runs with and without obj directory.
# Only do that if necessary to keep visible output short.
@@ -62,7 +64,8 @@ PERLPATH = ${.CURDIR}/
# test parameters.
.for a in ${ARGS}
-run-regress-$a: $a opentap PassFd.so
+REGRESS_TARGETS += run-$a
+run-$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
diff --git a/regress/usr.sbin/relayd/Makefile b/regress/usr.sbin/relayd/Makefile
index 7f9106d9f92..c07743a8b1e 100644
--- a/regress/usr.sbin/relayd/Makefile
+++ b/regress/usr.sbin/relayd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 2016/09/23 20:04:21 bluhm Exp $
+# $OpenBSD: Makefile,v 1.15 2018/10/06 10:52:24 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets
@@ -20,14 +20,14 @@ regress:
@echo SKIPPED
.endif
-.if make (regress) || make (all)
-.BEGIN:
+REGRESS_SETUP_ONCE += setup
+setup:
+ @echo '\n======== $@ ========'
.if empty (REMOTE_SSH)
${SUDO} true
.else
ssh -t ${REMOTE_SSH} ${SUDO} true
.endif
-.endif
# Fill out these variables if you want to test relayd with
# the relayd process running on a remote machine. You have to specify
@@ -42,8 +42,6 @@ REMOTE_SSH ?=
# 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 relayd.conf ktrace.out stamp-*
CLEANFILES += *.pem *.req *.crt *.key *.srl
@@ -62,7 +60,8 @@ PERLPATH = ${.CURDIR}/
# test parameters. Generally they consist of client, relayd, server.
.for a in ${ARGS}
-run-regress-$a: $a
+REGRESS_TARGETS += run-$a
+run-$a: $a
@echo '\n======== $@ ========'
.if empty (REMOTE_SSH)
time SUDO=${SUDO} KTRACE=${KTRACE} RELAYD=${RELAYD} perl ${PERLINC} ${PERLPATH}relayd.pl copy ${PERLPATH}$a
diff --git a/regress/usr.sbin/switchd/Makefile b/regress/usr.sbin/switchd/Makefile
index 76c47af0fdd..9bb85440b47 100644
--- a/regress/usr.sbin/switchd/Makefile
+++ b/regress/usr.sbin/switchd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 2017/06/25 21:59:59 bluhm Exp $
+# $OpenBSD: Makefile,v 1.6 2018/10/06 10:52:24 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-Net-Pcap Perl interface for libpcap
@@ -23,8 +23,6 @@ regress:
# 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
@@ -47,16 +45,17 @@ PERLPATH = ${.CURDIR}/
# test parameters. Generally they consist of switch, switchd.
.for a in ${ARGS}
-run-regress-$a: $a
+REGRESS_TARGETS += run-$a
+run-$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
+ @echo '\n======== setup-$@ ========'
+.for p in ${SRC_PATH} ${SYS_PATH}
+ ! test -s $p/$@ || grep -v '^#include' $p/$@ >$@
+.endfor
.SUFFIXES: .h .ph
.h.ph:
diff --git a/regress/usr.sbin/syslogd/Makefile b/regress/usr.sbin/syslogd/Makefile
index 7b4874a9c17..91a2beac6ef 100644
--- a/regress/usr.sbin/syslogd/Makefile
+++ b/regress/usr.sbin/syslogd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.23 2018/04/11 19:00:54 bluhm Exp $
+# $OpenBSD: Makefile,v 1.24 2018/10/06 10:52:24 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets
@@ -36,7 +36,7 @@ TARGETS ?= ${ARGS}
.else
TARGETS ?= ${ARGS:Nargs-rsyslog*}
.endif
-REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/}
+REGRESS_TARGETS = ${TARGETS:S/^/run-/}
LDFLAGS += -lutil
CLEANFILES += *.log *.log.? *.conf ktrace.out stamp-*
CLEANFILES += *.out *.sock *.ktrace *.fstat ttylog *.ph */*.ph
@@ -44,15 +44,16 @@ CLEANFILES += *.pem *.req *.key *.crt *.srl empty toobig diskimage
.MAIN: all
-.if make (regress) || make (all)
-.BEGIN:
- @echo
+REGRESS_SETUP_ONCE += setup
+setup:
+ @echo '\n======== $@ ========'
[ -z "${SUDO}" ] || ${SUDO} true
${SUDO} /etc/rc.d/syslogd stop
-.END:
- @echo
- ${SUDO} /etc/rc.d/syslogd restart
-.endif
+
+REGRESS_CLEANUP += cleanup
+cleanup:
+ @echo '\n======== $@ ========'
+ -${SUDO} /etc/rc.d/syslogd restart
# Set variables so that make runs with and without obj directory.
# Only do that if necessary to keep visible output short.
@@ -69,7 +70,7 @@ PERLPATH = ${.CURDIR}/
# test parameters. Generally they consist of client, syslogd, server.
.for a in ${ARGS}
-run-regress-$a: $a
+run-$a: $a
@echo '\n======== $@ ========'
time SUDO=${SUDO} KTRACE=${KTRACE} SYSLOGD=${SYSLOGD} perl ${PERLINC} ${PERLPATH}syslogd.pl ${PERLPATH}$a
.endfor
@@ -124,7 +125,6 @@ unconfig:
-umount -f /dev/vnd0c 2>/dev/null || true
-rmdir /mnt/regress-syslogd 2>/dev/null || true
-vnconfig -u vnd0 2>/dev/null || true
- -rm -f stamp-filesystem
stamp-filesystem:
@echo '\n======== $@ ========'
@@ -132,11 +132,12 @@ stamp-filesystem:
${SUDO} chmod 1777 /mnt/regress-syslogd
date >$@
-REGRESS_TARGETS += cleanup-filesystem
+REGRESS_CLEANUP += cleanup-filesystem
cleanup-filesystem:
@echo '\n======== $@ ========'
- ${SUDO} umount /mnt/regress-syslogd
- ${SUDO} ${.MAKE} -C ${.CURDIR} unconfig
+ rm -f stamp-filesystem
+ -${SUDO} umount /mnt/regress-syslogd
+ -${SUDO} ${.MAKE} -C ${.CURDIR} unconfig
${REGRESS_TARGETS:M*filesystem*}: stamp-filesystem
${REGRESS_TARGETS:M*tls*}: client.crt server.crt 127.0.0.1.crt