From a762f82be556fb59b956ef2098d7b826c203f684 Mon Sep 17 00:00:00 2001 From: anton Date: Thu, 12 Oct 2023 16:59:23 +0000 Subject: [PATCH] Let vnconfig select an unused device as opposed of unconditionally assume vnd0 is available. --- regress/sbin/disklabel/Makefile | 18 ++++----- regress/sbin/newfs/checknewfs | 14 +++---- regress/sys/dev/vnd/Makefile | 12 +++--- regress/sys/kern/mount/Makefile | 44 +++++++++++----------- regress/sys/kern/realpath-unmount/Makefile | 14 +++---- regress/sys/kern/unveil-unmount/Makefile | 14 +++---- regress/usr.sbin/syslogd/Makefile | 14 +++---- 7 files changed, 66 insertions(+), 64 deletions(-) diff --git a/regress/sbin/disklabel/Makefile b/regress/sbin/disklabel/Makefile index ffdf9249ddf..5a56d7f0769 100644 --- a/regress/sbin/disklabel/Makefile +++ b/regress/sbin/disklabel/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2023/05/30 15:10:39 krw Exp $ +# $OpenBSD: Makefile,v 1.8 2023/10/12 16:59:23 anton Exp $ # # Copyright (c) 2010 Theo de Raadt # Copyright (c) 2018 Kenneth R Westerback @@ -54,7 +54,7 @@ OK= ok DISKLABEL ?= ${.OBJDIR}/disklabel -CLEANFILES += *.tmp *.out *.dl *.fstab diskimage disklabel.c manual.c +CLEANFILES += *.tmp *.out *.dl *.fstab diskimage disklabel.c manual.c vnd .PATH: ${.CURDIR}/../../../sbin/disklabel PROG = disklabel @@ -82,21 +82,21 @@ run-disklabel-$s: $s.out $s.out: ${DISKLABEL} rm -f $s.tmp $s.out - ${SUDO} vnconfig -u vnd0 || true rm -f diskimage echo "=== Start ${s}MB disk ===" >$s.tmp dd if=/dev/zero of=diskimage bs=1m count=1 seek=$s status=none - ${SUDO} vnconfig vnd0 diskimage - ${SUDO} fdisk ${FDISKOPT} vnd0 >>$s.tmp + ${SUDO} vnconfig diskimage >vnd + ${SUDO} fdisk ${FDISKOPT} $$(>$s.tmp echo >>$s.tmp - ${SUDO} ${DISKLABEL} -A -p g vnd0 >$s.dl - ${SUDO} ${DISKLABEL} -Aw -f $s.fstab vnd0 >>$s.dl - ${SUDO} ${DISKLABEL} vnd0 >>$s.dl + ${SUDO} ${DISKLABEL} -A -p g $$($s.dl + ${SUDO} ${DISKLABEL} -Aw -f $s.fstab $$(>$s.dl + ${SUDO} ${DISKLABEL} $$(>$s.dl grep '^ [a-p]: ' $s.dl | egrep -v "unused" | sort >>$s.tmp echo >>$s.tmp cat $s.fstab >>$s.tmp echo "=== End ${s}MB disk ===" >>$s.tmp mv $s.tmp $s.out + ${SUDO} vnconfig -u $$( diff --git a/regress/sbin/newfs/checknewfs b/regress/sbin/newfs/checknewfs index cfc7b72a0e6..891a7568da0 100644 --- a/regress/sbin/newfs/checknewfs +++ b/regress/sbin/newfs/checknewfs @@ -1,10 +1,10 @@ #!/bin/ksh -# $OpenBSD: checknewfs,v 1.9 2021/07/26 20:38:18 bluhm Exp $ +# $OpenBSD: checknewfs,v 1.10 2023/10/12 16:59:23 anton Exp $ # Written by Otto Moerbeek, 2007, Public domain cleanup() { - vnconfig -u vnd0 + [ -z "$vnd" ] || { vnconfig -u "$vnd" || :; } rm -f $image } @@ -18,14 +18,14 @@ dotest() { fi image=$(mktemp -t imageXXXXXXXXXX); dd if=/dev/random of=$image bs=512 count=$1 2>/dev/null && - vnconfig vnd0 $image && - disklabel -w vnd0 $2 && - newfs -O 1 $3 /dev/rvnd0a + vnd=$(vnconfig $image) || exit 1 + disklabel -w $vnd $2 && + newfs -O 1 $3 /dev/r${vnd}a if [ $? != 0 ]; then ret=$(($ret + 1)) echo TEST $1 $2 \"$3\" failed else - (fsck -nf /dev/vnd0a | fgrep SALVAGE) + (fsck -nf /dev/${vnd}a | fgrep SALVAGE) if [ $? == 0 ]; then ret=$(($ret + 1)) echo TEST $1 $2 \"$3\" failed @@ -40,8 +40,8 @@ dotest() { } ret=0 +vnd= -vnconfig -u vnd0 > /dev/null 2>&1 if [ $# == 0 ]; then clean=1 dotest 3800 rdroot "-m 0 -o space -i 4096" diff --git a/regress/sys/dev/vnd/Makefile b/regress/sys/dev/vnd/Makefile index 99e2880670b..0c93c4c78d3 100644 --- a/regress/sys/dev/vnd/Makefile +++ b/regress/sys/dev/vnd/Makefile @@ -1,9 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 2022/07/26 13:20:16 krw Exp $ +# $OpenBSD: Makefile,v 1.3 2023/10/12 16:59:23 anton Exp $ REGRESS_SETUP= setup REGRESS_CLEANUP= cleanup REGRESS_TARGETS= +CLEANFILES= vnd + setup: mkdir -p /mnt/regress-vnd @@ -11,16 +13,16 @@ cleanup: unconfig -rmdir /mnt/regress-vnd 2>/dev/null || true unconfig: - -vnconfig -u vnd0 2>/dev/null || true + -vnconfig -u $$(/dev/null || true -umount -f /mnt/regress-vnd 2>/dev/null || true REGRESS_TARGETS+= run-regress-async-mount run-regress-async-mount: unconfig mount_mfs -s1M -oasync swap /mnt/regress-vnd dd if=/dev/zero of=/mnt/regress-vnd/disk.img count=1024 - vnconfig vnd0 /mnt/regress-vnd/disk.img - fdisk -iy -b "960@64:0c" vnd0 - newfs -t msdos vnd0i + vnconfig /mnt/regress-vnd/disk.img >vnd + fdisk -iy -b "960@64:0c" $$('` -eq 15 ] + vnconfig diskimage >vnd + disklabel -wA -T ${.CURDIR}/disktemplate $$('` -eq 15 ] mount: disk - newfs vnd0a + newfs $$('` -eq 15 ] + [ `mount | grep -c "/dev/$$("` -eq 15 ] REGRESS_CLEANUP = unconfig unconfig: - -umount -f /dev/vnd0a 2>/dev/null || true + -umount -f /dev/$$(/dev/null || true -rmdir /mnt/regress-mount 2>/dev/null || true - -vnconfig -u vnd0 2>/dev/null || true + -vnconfig -u $$(/dev/null || true # The unmount-nested test uses a disk template to create 15 partitions # on a vnd device. All are initialized with a ffs file system. @@ -50,7 +50,7 @@ run-unmount-nested: mount-nested ! umount /mnt/regress-mount umount -f /mnt/regress-mount mount - [ `mount | grep -c '/dev/vnd0. on /mnt/regress-mount\>'` -eq 0 ] + [ `mount | grep -c "/dev/$$("` -eq 0 ] # Create a 1 GB vnd partition and fill the ffs file system it with # cp -r. After 15 seconds clean it with rm -rf. While this is @@ -66,8 +66,8 @@ run-unmount-busy: mount rm -rf /mnt/regress-mount/usr & sleep .1 umount -f /mnt/regress-mount - fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log - fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + fsck -y /dev/r$$(&1 | tee fsck-clean.log + fsck -f -y /dev/r$$(&1 | tee fsck-force.log egrep -q 'File system is clean' \ fsck-clean.log ! egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ @@ -99,8 +99,8 @@ run-readonly-busy: mount pgrep -xf 'rm -rf /mnt/regress-mount/usr' || \ break; sleep 1; done umount /mnt/regress-mount - fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log - fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + fsck -y /dev/r$$(&1 | tee fsck-clean.log + fsck -f -y /dev/r$$(&1 | tee fsck-force.log ! egrep -q 'File system is clean' fsck-clean.log || \ ! egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ fsck-force.log @@ -119,8 +119,8 @@ run-readonly-dangling: mount pkill -xf 'sleep 73' sleep .1 umount /mnt/regress-mount - fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log - fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + fsck -y /dev/r$$(&1 | tee fsck-clean.log + fsck -f -y /dev/r$$(&1 | tee fsck-force.log ! egrep -q 'File system is clean' fsck-clean.log egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ fsck-clean.log fsck-force.log diff --git a/regress/sys/kern/realpath-unmount/Makefile b/regress/sys/kern/realpath-unmount/Makefile index 8159dc0f398..fa88d282023 100644 --- a/regress/sys/kern/realpath-unmount/Makefile +++ b/regress/sys/kern/realpath-unmount/Makefile @@ -1,27 +1,27 @@ -# $OpenBSD: Makefile,v 1.3 2020/12/17 00:51:12 bluhm Exp $ +# $OpenBSD: Makefile,v 1.4 2023/10/12 16:59:24 anton Exp $ # Call realpath(3) in combination with chroot(2), chdir(2). # Use umount(8) to check that the mountpoint leaks no vnode. # There were vnode reference counting bugs in the kernel. PROGS= realpath-chroot realpath-chdir -CLEANFILES= diskimage +CLEANFILES= diskimage vnd .PHONY: mount unconfig clean diskimage: unconfig ${SUDO} dd if=/dev/zero of=diskimage bs=512 count=4k - ${SUDO} vnconfig vnd0 diskimage - ${SUDO} newfs vnd0c + ${SUDO} vnconfig diskimage >vnd + ${SUDO} newfs $$(/dev/null || true + -${SUDO} umount -f /dev/$$(/dev/null || true -${SUDO} rmdir /mnt/regress-realpath 2>/dev/null || true - -${SUDO} vnconfig -u vnd0 2>/dev/null || true + -${SUDO} vnconfig -u $$(/dev/null || true -${SUDO} rm -f stamp-setup REGRESS_SETUP = ${PROGS} mount diff --git a/regress/sys/kern/unveil-unmount/Makefile b/regress/sys/kern/unveil-unmount/Makefile index 810874203f6..e98b6b26064 100644 --- a/regress/sys/kern/unveil-unmount/Makefile +++ b/regress/sys/kern/unveil-unmount/Makefile @@ -1,27 +1,27 @@ -# $OpenBSD: Makefile,v 1.6 2020/12/17 14:22:42 bluhm Exp $ +# $OpenBSD: Makefile,v 1.7 2023/10/12 16:59:24 anton Exp $ # Call unveil(2) in combination with unlink(2), chroot(2), chdir(2). # Use umount(8) to check that the mountpoint leaks no vnode. # There were vnode reference counting bugs in the kernel. PROGS= unveil-unlink unveil-chroot unveil-perm unveil-chdir -CLEANFILES= diskimage +CLEANFILES= diskimage vnd .PHONY: mount unconfig clean diskimage: unconfig ${SUDO} dd if=/dev/zero of=diskimage bs=512 count=4k - ${SUDO} vnconfig vnd0 diskimage - ${SUDO} newfs vnd0c + ${SUDO} vnconfig diskimage >vnd + ${SUDO} newfs $$(/dev/null || true + -${SUDO} umount -f /dev/$$(/dev/null || true -${SUDO} rmdir /mnt/regress-unveil 2>/dev/null || true - -${SUDO} vnconfig -u vnd0 2>/dev/null || true + -${SUDO} vnconfig -u $$(/dev/null || true -${SUDO} rm -f stamp-setup REGRESS_SETUP = ${PROGS} mount diff --git a/regress/usr.sbin/syslogd/Makefile b/regress/usr.sbin/syslogd/Makefile index 5c47174a075..62e5601c5cd 100644 --- a/regress/usr.sbin/syslogd/Makefile +++ b/regress/usr.sbin/syslogd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.35 2023/01/17 06:33:49 anton Exp $ +# $OpenBSD: Makefile,v 1.36 2023/10/12 16:59:24 anton Exp $ # The following ports must be installed for the regression tests: # p5-Socket6 Perl defines relating to AF_INET6 sockets @@ -36,7 +36,7 @@ REGRESS_SKIP_TARGETS = ${REGRESS_TARGETS:Mrun-args-rsyslog*} LDFLAGS += -lutil CLEANFILES += *.log *.log.? *.conf ktrace.out stamp-* *.pid CLEANFILES += *.out *.sock *.ktrace *.fstat ttylog *.ph */*.ph -CLEANFILES += *.pem *.req *.key *.crt *.srl empty toobig diskimage +CLEANFILES += *.pem *.req *.key *.crt *.srl empty toobig diskimage vnd run-args-rsyslog-client-tls.pl run-args-rsyslog-tls.pl: # rsyslogd TLS client side is totally unreliable. Startup of @@ -112,17 +112,17 @@ sys/syscall.ph: /usr/include/sys/syscall.h disk: unconfig dd if=/dev/zero of=diskimage bs=512 count=4k - vnconfig vnd0 diskimage - newfs -b 4096 -f 2048 -m 0 vnd0c + vnconfig diskimage >vnd + newfs -b 4096 -f 2048 -m 0 $$(/dev/null || true + -umount -f /dev/$$(/dev/null || true -rmdir /mnt/regress-syslogd 2>/dev/null || true - -vnconfig -u vnd0 2>/dev/null || true + -vnconfig -u $$(/dev/null || true stamp-filesystem: ${SUDO} ${.MAKE} -C ${.CURDIR} mount -- 2.20.1