fixup! test(nix): add basic functionality testing infra

This commit is contained in:
Thomas Mühlbacher 2024-06-24 20:12:11 +02:00
parent 99b02a82fe
commit 9d000957eb
2 changed files with 41 additions and 0 deletions

View File

@ -29,6 +29,7 @@ let
# Add any packages you need inside test scripts here # Add any packages you need inside test scripts here
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
f3
genpass genpass
keyutils keyutils
]; ];

40
checks/nested.sh Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euxo pipefail
blkdev="/dev/vdb"
mnt1=$(mktemp -d)
mnt2=$(mktemp -d)
pw=$(genpass)
uuid=$(uuidgen)
# link user and session keyrings so that the key can be found by the kernel
keyctl link @u @s
echo "$pw" | bcachefs format \
--verbose \
--encrypted \
--uuid "$uuid" \
--fs_label test-fs \
"$blkdev"
udevadm settle
echo "$pw" | bcachefs mount -v "UUID=$uuid" "$mnt1"
fallocate --length 2G "$mnt1/fs.img"
bcachefs format \
--verbose \
"$mnt1/fs.img"
loopdev=$(losetup --find --show "$mnt1/fs.img")
udevadm settle
mount "$loopdev" "$mnt2"
f3write "$mnt1"
f3write "$mnt2"
f3read "$mnt1"
f3read "$mnt2"