START	sbin/bioctl	2025-03-20T19:06:09Z

==== create-chunk ====
dd if=/dev/zero of=disk.img bs=512k count=0 seek=1 status=none
vnconfig -- disk.img 1>chunk.txt
echo 'RAID *' |  disklabel -wAT- -- "$(<chunk.txt)"

==== create-passfile ====
install -o root -m u=rw,go= /dev/null passphrase.txt
printf '%s\n' 'oldsecret' |  tee passphrase.txt 1>/dev/null

==== scripted-create-volume ====
printf '%s\n' 'oldsecret' |   /sbin/bioctl -s -cC -l"$(<chunk.txt)a" -- softraid0 |  grep -o 'sd[0-9]*$' -- 1>vol.txt

==== scripted-recreate-volume ====
/sbin/bioctl -d -- "$(<vol.txt)" 2>/dev/null
printf '%s\n' 'oldsecret' |   /sbin/bioctl -s -Cforce -r17 -cC -l"$(<chunk.txt)a" -- softraid0 |  grep -o 'sd[0-9]*$' -- 1>vol.txt

==== reopen-volume-with-passfile ====
/sbin/bioctl -d -- "$(<vol.txt)" 2>/dev/null
/sbin/bioctl -ppassphrase.txt -cC -l"$(<chunk.txt)a" -- softraid0 |  grep -o 'sd[0-9]*$' -- 1>vol.txt

==== scripted-change-passphrase ====
printf '%s\n%s\n' 'oldsecret' 'securenew' |   /sbin/bioctl -s -P -v -- "$(<vol.txt)" |  tee -- rounds.txt
Deriving key using bcrypt PBKDF with 17 rounds...
Deriving key using bcrypt PBKDF with 205 rounds...

==== verify-increased-rounds ====
awk -safe -vOLD=17 -- ' NR == 1 { old = $7 };  NR == 2 { new = $7 };  END     { exit !(OLD == old && old <= new) }' rounds.txt

==== reuse-active-chunk ====
/sbin/bioctl -cC -l"$(<chunk.txt)a" -- softraid0
softraid0: chunk vnd0a already in use
*** Error 1 in . (Makefile:70 'reuse-active-chunk')
EXPECTED_FAIL

==== use-public-passfile ====
chmod a=rwx passphrase.txt
/sbin/bioctl -ppassphrase.txt -P -- "$(<vol.txt)"
bioctl: passphrase file has the wrong permissions
*** Error 1 in . (Makefile:74 'use-public-passfile')
EXPECTED_FAIL

==== use-foreign-passfile ====
chown build passphrase.txt
/sbin/bioctl -ppassphrase.txt -P -- "$(<vol.txt)"
bioctl: passphrase file must be owned by root
*** Error 1 in . (Makefile:78 'use-foreign-passfile')
EXPECTED_FAIL

==== set-empty-passphrase ====
printf '\n' |  /sbin/bioctl -s -P -- "$(<vol.txt)"
bioctl: invalid passphrase length
*** Error 1 in . (Makefile:81 'set-empty-passphrase')
EXPECTED_FAIL

==== cleanup ====
/sbin/bioctl -d -- "$(<vol.txt)" 2>/dev/null
vnconfig  -u -- "$(<chunk.txt)" 2>/dev/null

XFAIL	sbin/bioctl	*** Error 1 in . (Makefile:70 'reuse-active-chunk'), *** Error 1 in . (Makefile:74 'use-public-passfile'), *** Error 1 in . (Makefile:78 'use-foreign-passfile'), *** Error 1 in . (Makefile:81 'set-empty-passphrase')