summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-08-20 23:19:01 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-08-20 23:19:01 +0000
commit8e251e51df7c0c147639b6a41bfd3bb2bf440577 (patch)
tree4c14c0837ab01579cdaf4c72d0a7fcc5ab6ffbd0 /regress
parent6f7852848e20dee0d550d6a2b2f42bb2d6290cae (diff)
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.
Diffstat (limited to 'regress')
-rw-r--r--regress/sbin/bioctl/Makefile41
1 files changed, 41 insertions, 0 deletions
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 <bsd.regress.mk>