summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2024-02-08 17:09:52 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2024-02-08 17:09:52 +0000
commitdbb10968103410c9eb6e831bda205b062025cedd (patch)
tree011ef86f5c8442bec1ad971b30c985b4ba1d8cea /regress/usr.bin
parent9795011f383c0f97745a68fe6515323f3c85069a (diff)
No that we load MIB files at snmpd start-up chances that the sleep build
into the regress test don't suffice anymore for slow regress machines. (Ab)use the agentx socket (which gets created after all the MIB files have been parsed) to detect if snmpd is available. For now we poll at 0.1s intervals for a total of 100 tries. found by and earlier diff tested by and OK anton@
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/snmp/Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/regress/usr.bin/snmp/Makefile b/regress/usr.bin/snmp/Makefile
index a4c0f6776d2..983efc2ddf5 100644
--- a/regress/usr.bin/snmp/Makefile
+++ b/regress/usr.bin/snmp/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2023/11/06 09:46:04 martijn Exp $
+# $OpenBSD: Makefile,v 1.7 2024/02/08 17:09:51 martijn Exp $
SNMP?= /usr/bin/snmp
SNMPD?= /usr/sbin/snmpd -f ${.OBJDIR}/snmpd.conf
@@ -31,6 +31,7 @@ snmpd.conf: Makefile
printf 'listen on $$listen6_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
printf 'listen on tcp $$listen6_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
printf 'listen on $$listen_addr notify snmpv1 snmpv2c snmpv3\n\n' >> snmpd.conf
+ printf 'agentx path "/tmp/agentx"\n\n' >> snmpd.conf
printf 'read-only community public\n' >> snmpd.conf
printf 'read-write community private\n' >> snmpd.conf
printf 'trap community public\n\n' >> snmpd.conf
@@ -79,7 +80,19 @@ trap_output: Makefile
chmod a+rw trap_output
start: stop snmpd.conf traphandle.sh trap_output
+ rm -f /tmp/agentx 2>/dev/null
${SUDO} ${SNMPD}
+ @(i=0; \
+ while [ ! -S /tmp/agentx ]; do \
+ i=$$((i + 1)); \
+ [ $$i -eq 100 ] && ( \
+ printf "%s\n" '${SUDO} pkill -xf "${SNMPD}"'; \
+ printf "Failed to start snmpd\n" >&2; \
+ ${SUDO} pkill -xf "${SNMPD}"; \
+ exit 1; \
+ ); \
+ sleep 0.1; \
+ done;)
stop:
-${SUDO} pkill -xf "${SNMPD}"