installboot is not trivial, especially when it comes to the matrix of platforms, softraid softraid support and boot loader filesystem support.
It is especially annoying to run into issues in the installer where debugging capabilities are limited -- I've had that with softraid on sparc64 where the issue turns out to be reproducible with vnd(4) in multi-user, i.e. a much quicker and safer setup to squash installboot bugs. OK to add the first round of checks? It'll need some MD bits wrt. vnd disk setup to work on more platforms, but I'd like to do that in-tree. I could then hook it up per-arch as I run and improve the tests on more platforms/machines. Feedback? Index: regress/usr.sbin/installboot/Makefile =================================================================== RCS file: regress/usr.sbin/installboot/Makefile diff -N regress/usr.sbin/installboot/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ regress/usr.sbin/installboot/Makefile 20 Aug 2022 09:00:13 -0000 @@ -0,0 +1,83 @@ +# $OpenBSD: $ + +INSTALLBOOT ?= /usr/sbin/installboot +DRY_RUN = ${INSTALLBOOT} -n + +# dry-r fails with N > 2 on sparc64, N = 4 works on amd64 +N ?= 1 2 3 4 +IMGFILES = ${N:=disk%.img} +DEVFILES = ${N:=vnd%.txt} +SRFILE = sr.txt +# CONCAT takes any positive number of chunks +SRLEVEL ?= c +# allow testing with real bootstrap, e.g. for size constraints or formats +STAGEFILE ?= stage.empty + +REGRESS_SETUP_ONCE = create-new-softraid + +create-new-disks: +.for n in ${N} + dd if=/dev/zero of=disk${n}.img bs=1m count=0 seek=32 status=none + ${SUDO} vnconfig -- disk${n}.img 1>vnd${n}.txt +.endfor + +format-new-disks: create-new-disks +.for devfile in ${DEVFILES} + @# XXX MD (sparc64 does not need fdisk) + ${SUDO} fdisk -iy -- "$$(<${devfile})" 1>/dev/null + printf 'a\n\n\n\nRAID\nw\nq\n' | \ + ${SUDO} disklabel -E -- "$$(<${devfile})" 1>/dev/null +.endfor + +create-new-softraid: format-new-disks + ${SUDO} bioctl -c${SRLEVEL} \ + -l"$$(sed s/$$/a/ vnd?.txt | paste -sd, -)" -- softraid0 | \ + awk '{ print $$NF }' 1>${SRFILE} + + +REGRESS_TARGETS = dry-p \ + dry-default \ + dry-r + +dry-p: + ${SUDO} ${DRY_RUN} -p -- "$$(<${SRFILE})" + +dry-default: + ${SUDO} ${DRY_RUN} -- "$$(<${SRFILE})" + +dry-r: + ${SUDO} ${DRY_RUN} -r/ -- "$$(<${SRFILE})" + + +REGRESS_EXPECTED_FAILURES = dry-p-r \ + dry-p-stage \ + dry-nodisk-stage \ + dry-toomany +REGRESS_TARGETS += ${REGRESS_EXPECTED_FAILURES} + +dry-p-r: + ${DRY_RUN} -p -r/ -- "$$(<${SRFILE})" + +dry-p-stage: + touch -- ${STAGEFILE} + ${DRY_RUN} -p -- "$$(<${SRFILE})" ${STAGEFILE} + +dry-nodisk-stage: + touch -- ${STAGEFILE} + ${SUDO} ${DRY_RUN} -- ${STAGEFILE} + +dry-toomany: + touch -- ${STAGEFILE} + ${DRY_RUN} -- disk stage1 stage2 too many + + +CLEANFILES = ${IMGFILES} ${DEVFILES} ${SRFILE} ${STAGEFILE} +REGRESS_CLEANUP = cleanup + +cleanup: + ${SUDO} bioctl -d -- "$$(<${SRFILE})" +.for devfile in ${DEVFILES} + ${SUDO} vnconfig -u -- "$$(<${devfile})" +.endfor + +.include <bsd.regress.mk>