From df1b97a2ba428ce25801f4b9af9d0375823c5e25 Mon Sep 17 00:00:00 2001 From: kn Date: Sun, 20 Aug 2023 23:19:00 +0000 Subject: [PATCH] First tests for bioctl(8), start with scripted creation + passphrase change These are meant for CLI bits like passphrase hashing, error handling and interactive vs. scripted behaviour. regress/sys/dev/softraid/ and stuff like regress/usr.sbin/installboot/ already test specific softraid(4) disciplines and disk handling. --- regress/sbin/bioctl/Makefile | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 regress/sbin/bioctl/Makefile diff --git a/regress/sbin/bioctl/Makefile b/regress/sbin/bioctl/Makefile new file mode 100644 index 00000000000..2994418db1a --- /dev/null +++ b/regress/sbin/bioctl/Makefile @@ -0,0 +1,41 @@ +# $OpenBSD: Makefile,v 1.1 2023/08/20 23:19:00 kn Exp $ + +BIOCTL ?= /sbin/bioctl + +CHUNKFILE = disk.img +CHUNKDEVFILE = chunk.txt +VOLDEVFILE = vol.txt + +OLDPW = oldsecret +NEWPW = securenew + + +REGRESS_SETUP_ONCE = create-chunk + +create-chunk: + dd if=/dev/zero of=${CHUNKFILE} bs=512k count=0 seek=1 status=none + ${SUDO} vnconfig -- ${CHUNKFILE} 1>${CHUNKDEVFILE} + echo 'RAID *' | ${SUDO} disklabel -wAT- -- "$$(<${CHUNKDEVFILE})" + + +REGRESS_TARGETS = scripted-create-volume \ + scripted-change-passphrase + +scripted-create-volume: + printf '%s\n' '${OLDPW}' | \ + ${SUDO} ${BIOCTL} -s -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \ + grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE} + +scripted-change-passphrase: + printf '%s\n%s\n' '${OLDPW}' '${NEWPW}' | \ + ${SUDO} ${BIOCTL} -s -P -- "$$(<${VOLDEVFILE})" + + +CLEANFILES = *.txt *.img +REGRESS_CLEANUP = cleanup + +cleanup: + ${SUDO} ${BIOCTL} -d -- "$$(<${VOLDEVFILE})" 2>/dev/null + ${SUDO} vnconfig -u -- "$$(<${CHUNKDEVFILE})" 2>/dev/null + +.include -- 2.20.1