mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-24 00:00:19 +03:00
fixup! test(nix): add basic functionality testing infra
This commit is contained in:
parent
99b02a82fe
commit
9d000957eb
@ -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
40
checks/nested.sh
Executable 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"
|
Loading…
Reference in New Issue
Block a user