mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
42 lines
1.0 KiB
Nix
42 lines
1.0 KiB
Nix
{ system ? builtins.currentSystem
|
|
, config ? {}
|
|
, pkgs ? import ../.. { inherit system config; }
|
|
, systemdStage1 ? false
|
|
}:
|
|
|
|
import ./make-test-python.nix {
|
|
name = "fsck";
|
|
|
|
nodes.machine = { lib, ... }: {
|
|
virtualisation.emptyDiskImages = [ 1 ];
|
|
|
|
virtualisation.fileSystems = {
|
|
"/mnt" = {
|
|
device = "/dev/vdb";
|
|
fsType = "ext4";
|
|
autoFormat = true;
|
|
};
|
|
};
|
|
|
|
boot.initrd.systemd.enable = systemdStage1;
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("default.target")
|
|
|
|
with subtest("root fs is fsckd"):
|
|
machine.succeed("journalctl -b | grep '${if systemdStage1
|
|
then "fsck.*vda.*clean"
|
|
else "fsck.ext4.*/dev/vda"}'")
|
|
|
|
with subtest("mnt fs is fsckd"):
|
|
machine.succeed("journalctl -b | grep 'fsck.*/dev/vdb.*clean'")
|
|
machine.succeed(
|
|
"grep 'Requires=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount"
|
|
)
|
|
machine.succeed(
|
|
"grep 'After=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount"
|
|
)
|
|
'';
|
|
}
|