nixos/tests: add squashfs test

This commit is contained in:
nikstur 2023-07-04 17:09:00 +02:00 committed by Bjørn Forsman
parent 3b6bc9b536
commit 0f9bf615a4

View File

@ -128,4 +128,43 @@ with pkgs.lib;
assert "erofs" in file_contents
'';
};
squashfs =
let
fsImage = "/tmp/non-default-filesystem.img";
in
makeTest {
name = "non-default-filesystems-squashfs";
meta.maintainers = with maintainers; [ nikstur ];
nodes.machine = {
virtualisation.qemu.drives = [{
name = "non-default-filesystem";
file = fsImage;
deviceExtraOpts.serial = "non-default";
}];
virtualisation.fileSystems."/non-default" = {
device = "/dev/disk/by-id/virtio-non-default";
fsType = "squashfs";
neededForBoot = true;
};
};
testScript = ''
import subprocess
with open("filesystem", "w") as f:
f.write("squashfs")
subprocess.run([
"${pkgs.squashfsTools}/bin/mksquashfs",
"filesystem",
"${fsImage}",
])
assert "squashfs" in machine.succeed("cat /non-default/filesystem")
'';
};
}