Merge pull request #156071 from Madouura/dev/bcachefs-installer
nixos/tests/installer: add bcachefs tests
This commit is contained in:
commit
4ae23f5c7d
@ -701,6 +701,85 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
bcachefsSimple = makeInstallerTest "bcachefs-simple" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
};
|
||||
|
||||
createPartitions = ''
|
||||
machine.succeed(
|
||||
"flock /dev/vda parted --script /dev/vda -- mklabel msdos"
|
||||
+ " mkpart primary ext2 1M 100MB" # /boot
|
||||
+ " mkpart primary linux-swap 100M 1024M" # swap
|
||||
+ " mkpart primary 1024M -1s", # /
|
||||
"udevadm settle",
|
||||
"mkswap /dev/vda2 -L swap",
|
||||
"swapon -L swap",
|
||||
"mkfs.bcachefs -L root /dev/vda3",
|
||||
"mount -t bcachefs /dev/vda3 /mnt",
|
||||
"mkfs.ext3 -L boot /dev/vda1",
|
||||
"mkdir -p /mnt/boot",
|
||||
"mount /dev/vda1 /mnt/boot",
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
bcachefsEncrypted = makeInstallerTest "bcachefs-encrypted" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
environment.systemPackages = with pkgs; [ keyutils ];
|
||||
};
|
||||
|
||||
# We don't want to use the normal way of unlocking bcachefs defined in tasks/filesystems/bcachefs.nix.
|
||||
# So, override initrd.postDeviceCommands completely and simply unlock with the predefined password.
|
||||
extraConfig = ''
|
||||
boot.initrd.postDeviceCommands = lib.mkForce "echo password | bcachefs unlock /dev/vda3";
|
||||
'';
|
||||
|
||||
createPartitions = ''
|
||||
machine.succeed(
|
||||
"flock /dev/vda parted --script /dev/vda -- mklabel msdos"
|
||||
+ " mkpart primary ext2 1M 100MB" # /boot
|
||||
+ " mkpart primary linux-swap 100M 1024M" # swap
|
||||
+ " mkpart primary 1024M -1s", # /
|
||||
"udevadm settle",
|
||||
"mkswap /dev/vda2 -L swap",
|
||||
"swapon -L swap",
|
||||
"keyctl link @u @s",
|
||||
"echo password | mkfs.bcachefs -L root --encrypted /dev/vda3",
|
||||
"echo password | bcachefs unlock /dev/vda3",
|
||||
"mount -t bcachefs /dev/vda3 /mnt",
|
||||
"mkfs.ext3 -L boot /dev/vda1",
|
||||
"mkdir -p /mnt/boot",
|
||||
"mount /dev/vda1 /mnt/boot",
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
bcachefsMulti = makeInstallerTest "bcachefs-multi" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
};
|
||||
|
||||
createPartitions = ''
|
||||
machine.succeed(
|
||||
"flock /dev/vda parted --script /dev/vda -- mklabel msdos"
|
||||
+ " mkpart primary ext2 1M 100MB" # /boot
|
||||
+ " mkpart primary linux-swap 100M 1024M" # swap
|
||||
+ " mkpart primary 1024M 4096M" # /
|
||||
+ " mkpart primary 4096M -1s", # /
|
||||
"udevadm settle",
|
||||
"mkswap /dev/vda2 -L swap",
|
||||
"swapon -L swap",
|
||||
"mkfs.bcachefs -L root --metadata_replicas 2 --foreground_target ssd --promote_target ssd --background_target hdd --label ssd /dev/vda3 --label hdd /dev/vda4",
|
||||
"mount -t bcachefs /dev/vda3:/dev/vda4 /mnt",
|
||||
"mkfs.ext3 -L boot /dev/vda1",
|
||||
"mkdir -p /mnt/boot",
|
||||
"mount /dev/vda1 /mnt/boot",
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
# Test a basic install using GRUB 1.
|
||||
grub1 = makeInstallerTest "grub1" rec {
|
||||
createPartitions = ''
|
||||
|
@ -58,6 +58,7 @@ stdenv.mkDerivation {
|
||||
|
||||
passthru.tests = {
|
||||
smoke-test = nixosTests.bcachefs;
|
||||
inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
Loading…
Reference in New Issue
Block a user