mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-24 00:00:19 +03:00
Use nixos-test scaffolding to spawn VMs and run any scripts in `checks/*.sh` as tests inside of the VM. This should lessen the risk of any obvious breakage in the CI but needs more and better tests to cover more commands. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
35 lines
574 B
Bash
Executable File
35 lines
574 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
|
|
blkdev="/dev/vdb"
|
|
mnt="/tmp/mnt"
|
|
pw=$(genpass)
|
|
uuid=$(uuidgen)
|
|
|
|
# link user and session keyrings so that the key can be found by the kernel
|
|
keyctl link @u @s
|
|
|
|
sfdisk "$blkdev" <<EOF
|
|
label: gpt
|
|
type=linux, size=1G
|
|
type=linux, size=1G
|
|
type=linux
|
|
EOF
|
|
|
|
udevadm settle
|
|
|
|
echo "$pw" | bcachefs format \
|
|
--verbose \
|
|
--encrypted \
|
|
--replicas=2 \
|
|
--uuid "$uuid" \
|
|
--fs_label test-fs \
|
|
"$blkdev"?
|
|
|
|
udevadm settle
|
|
|
|
mkdir -p "$mnt"
|
|
echo "$pw" | bcachefs mount -v "UUID=$uuid" "$mnt"
|
|
|
|
keyctl search @u user "bcachefs:$uuid"
|