Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
45 lines
1.2 KiB
Nix
45 lines
1.2 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 = { nodes, ...}:
|
|
let
|
|
rootDevice = nodes.machine.virtualisation.rootDevice;
|
|
in
|
|
''
|
|
machine.wait_for_unit("default.target")
|
|
|
|
with subtest("root fs is fsckd"):
|
|
machine.succeed("journalctl -b | grep '${if systemdStage1
|
|
then "fsck.*${builtins.baseNameOf rootDevice}.*clean"
|
|
else "fsck.ext4.*${rootDevice}"}'")
|
|
|
|
with subtest("mnt fs is fsckd"):
|
|
machine.succeed("journalctl -b | grep 'fsck.*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"
|
|
)
|
|
'';
|
|
}
|