diff options
author | Anton Lindqvist <anton@cvs.openbsd.org> | 2023-10-12 16:59:25 +0000 |
---|---|---|
committer | Anton Lindqvist <anton@cvs.openbsd.org> | 2023-10-12 16:59:25 +0000 |
commit | 33ded035787b644231d24f048a5a4b0d3951bc31 (patch) | |
tree | 44c12a9acf4ca71cdc8b70e0738acb73a5833b73 /regress/sbin | |
parent | 46a1836d737090da58df2ae1bbb223981c40b898 (diff) |
Let vnconfig select an unused device as opposed of unconditionally
assume vnd0 is available.
Diffstat (limited to 'regress/sbin')
-rw-r--r-- | regress/sbin/disklabel/Makefile | 18 | ||||
-rw-r--r-- | regress/sbin/newfs/checknewfs | 14 |
2 files changed, 16 insertions, 16 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" |