assume vnd0 is available.
-# $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>
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
$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}
REGRESS_CLEANUP += cleanup
cleanup:
- -${SUDO} vnconfig -u vnd0
+ -${SUDO} vnconfig -u $$(<vnd)
rm -f diskimage
.include <bsd.regress.mk>
#!/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
}
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
}
ret=0
+vnd=
-vnconfig -u vnd0 > /dev/null 2>&1
if [ $# == 0 ]; then
clean=1
dotest 3800 rdroot "-m 0 -o space -i 4096"
-# $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
-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}
-# $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.
! 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
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' \
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
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
-# $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
-# $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
-# $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
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
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