summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2023-10-12 16:59:25 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2023-10-12 16:59:25 +0000
commit33ded035787b644231d24f048a5a4b0d3951bc31 (patch)
tree44c12a9acf4ca71cdc8b70e0738acb73a5833b73
parent46a1836d737090da58df2ae1bbb223981c40b898 (diff)
Let vnconfig select an unused device as opposed of unconditionally
assume vnd0 is available.
-rw-r--r--regress/sbin/disklabel/Makefile18
-rw-r--r--regress/sbin/newfs/checknewfs14
-rw-r--r--regress/sys/dev/vnd/Makefile12
-rw-r--r--regress/sys/kern/mount/Makefile44
-rw-r--r--regress/sys/kern/realpath-unmount/Makefile14
-rw-r--r--regress/sys/kern/unveil-unmount/Makefile14
-rw-r--r--regress/usr.sbin/syslogd/Makefile14
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 <deraadt@openbsd.org>
# Copyright (c) 2018 Kenneth R Westerback <krw@openbsd.org>
@@ -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} $$(<vnd) >>$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 $$(<vnd) >$s.dl
+ ${SUDO} ${DISKLABEL} -Aw -f $s.fstab $$(<vnd) >>$s.dl
+ ${SUDO} ${DISKLABEL} $$(<vnd) >>$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 $$(<vnd) || true
$s-update: $s.out
cp $s.out ${.CURDIR}/$s.${OK}
@@ -108,7 +108,7 @@ update: $s-update
REGRESS_CLEANUP += cleanup
cleanup:
- -${SUDO} vnconfig -u vnd0
+ -${SUDO} vnconfig -u $$(<vnd)
rm -f diskimage
.include <bsd.regress.mk>
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 $$(<vnd) 2>/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" $$(<vnd)
+ newfs -t msdos $$(<vnd)i
REGRESS_ROOT_TARGETS= ${REGRESS_TARGETS}
diff --git a/regress/sys/kern/mount/Makefile b/regress/sys/kern/mount/Makefile
index eb51810b916..77cd1b49485 100644
--- a/regress/sys/kern/mount/Makefile
+++ b/regress/sys/kern/mount/Makefile
@@ -1,41 +1,41 @@
-# $OpenBSD: Makefile,v 1.9 2023/08/14 12:03:12 miod Exp $
+# $OpenBSD: Makefile,v 1.10 2023/10/12 16:59:24 anton Exp $
# This regress test uses a vnd device to run mount and unmount.
# All tests have to be run as root.
-CLEANFILES= diskimage *.log
+CLEANFILES= diskimage vnd *.log
.PHONY: disk mount unconfig clean
disk: unconfig
dd if=/dev/null of=diskimage bs=1m seek=1100
- vnconfig vnd0 diskimage
- disklabel -wA -T ${.CURDIR}/disktemplate vnd0
- disklabel vnd0
- disklabel vnd0 | grep -q '16 partitions:'
- [ `disklabel vnd0 | grep -c '\<4.2BSD\>'` -eq 15 ]
+ vnconfig diskimage >vnd
+ disklabel -wA -T ${.CURDIR}/disktemplate $$(<vnd)
+ disklabel $$(<vnd)
+ disklabel $$(<vnd) | grep -q '16 partitions:'
+ [ `disklabel $$(<vnd) | grep -c '\<4.2BSD\>'` -eq 15 ]
mount: disk
- newfs vnd0a
+ newfs $$(<vnd)a
mkdir -p /mnt/regress-mount
- mount /dev/vnd0a /mnt/regress-mount
+ mount /dev/$$(<vnd)a /mnt/regress-mount
mount-nested: mount
.for p in b d e f g h i j k l m n o p
- newfs -O 1 vnd0${p}
+ newfs -O 1 $$(<vnd)${p}
.endfor
mkdir /mnt/regress-mount/b
- mount /dev/vnd0b /mnt/regress-mount/b
+ mount /dev/$$(<vnd)b /mnt/regress-mount/b
f=/mnt/regress-mount; for p in d e f g h i j k l m n o p;\
- do f=$$f/$$p; mkdir $$f; mount /dev/vnd0$$p $$f; done
+ do f=$$f/$$p; mkdir $$f; mount /dev/$$(<vnd)$$p $$f; done
mount
- [ `mount | grep -c '/dev/vnd0. on /mnt/regress-mount\>'` -eq 15 ]
+ [ `mount | grep -c "/dev/$$(<vnd). on /mnt/regress-mount\>"` -eq 15 ]
REGRESS_CLEANUP = unconfig
unconfig:
- -umount -f /dev/vnd0a 2>/dev/null || true
+ -umount -f /dev/$$(<vnd)a 2>/dev/null || true
-rmdir /mnt/regress-mount 2>/dev/null || true
- -vnconfig -u vnd0 2>/dev/null || true
+ -vnconfig -u $$(<vnd) 2>/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/$$(<vnd). on /mnt/regress-mount\>"` -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$$(<vnd)a 2>&1 | tee fsck-clean.log
+ fsck -f -y /dev/r$$(<vnd)a 2>&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$$(<vnd)a 2>&1 | tee fsck-clean.log
+ fsck -f -y /dev/r$$(<vnd)a 2>&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$$(<vnd)a 2>&1 | tee fsck-clean.log
+ fsck -f -y /dev/r$$(<vnd)a 2>&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 $$(<vnd)c
mount: diskimage
${SUDO} mkdir -p /mnt/regress-realpath
- ${SUDO} mount /dev/vnd0c /mnt/regress-realpath
+ ${SUDO} mount /dev/$$(<vnd)c /mnt/regress-realpath
unconfig:
- -${SUDO} umount -f /dev/vnd0c 2>/dev/null || true
+ -${SUDO} umount -f /dev/$$(<vnd)c 2>/dev/null || true
-${SUDO} rmdir /mnt/regress-realpath 2>/dev/null || true
- -${SUDO} vnconfig -u vnd0 2>/dev/null || true
+ -${SUDO} vnconfig -u $$(<vnd) 2>/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 $$(<vnd)c
mount: diskimage
${SUDO} mkdir -p /mnt/regress-unveil
- ${SUDO} mount /dev/vnd0c /mnt/regress-unveil
+ ${SUDO} mount /dev/$$(<vnd)c /mnt/regress-unveil
unconfig:
- -${SUDO} umount -f /dev/vnd0c 2>/dev/null || true
+ -${SUDO} umount -f /dev/$$(<vnd)c 2>/dev/null || true
-${SUDO} rmdir /mnt/regress-unveil 2>/dev/null || true
- -${SUDO} vnconfig -u vnd0 2>/dev/null || true
+ -${SUDO} vnconfig -u $$(<vnd) 2>/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 $$(<vnd)c
mount: disk
mkdir -p /mnt/regress-syslogd
- mount /dev/vnd0c /mnt/regress-syslogd
+ mount /dev/$$(<vnd)c /mnt/regress-syslogd
unconfig:
- -umount -f /dev/vnd0c 2>/dev/null || true
+ -umount -f /dev/$$(<vnd)c 2>/dev/null || true
-rmdir /mnt/regress-syslogd 2>/dev/null || true
- -vnconfig -u vnd0 2>/dev/null || true
+ -vnconfig -u $$(<vnd) 2>/dev/null || true
stamp-filesystem:
${SUDO} ${.MAKE} -C ${.CURDIR} mount