at 25.11-pre 1.3 kB view raw
1{ 2 system ? builtins.currentSystem, 3 config ? { }, 4 pkgs ? import ../.. { inherit system config; }, 5 systemdStage1 ? false, 6}: 7 8import ./make-test-python.nix { 9 name = "fsck"; 10 11 nodes.machine = 12 { lib, ... }: 13 { 14 virtualisation.emptyDiskImages = [ 1 ]; 15 16 virtualisation.fileSystems = { 17 "/mnt" = { 18 device = "/dev/vdb"; 19 fsType = "ext4"; 20 autoFormat = true; 21 }; 22 }; 23 24 boot.initrd.systemd.enable = systemdStage1; 25 }; 26 27 testScript = 28 { nodes, ... }: 29 let 30 rootDevice = nodes.machine.virtualisation.rootDevice; 31 in 32 '' 33 machine.wait_for_unit("default.target") 34 35 with subtest("root fs is fsckd"): 36 machine.succeed("journalctl -b | grep '${ 37 if systemdStage1 then 38 "fsck.*${builtins.baseNameOf rootDevice}.*clean" 39 else 40 "fsck.ext4.*${rootDevice}" 41 }'") 42 43 with subtest("mnt fs is fsckd"): 44 machine.succeed("journalctl -b | grep 'fsck.*vdb.*clean'") 45 machine.succeed( 46 "grep 'Requires=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount" 47 ) 48 machine.succeed( 49 "grep 'After=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount" 50 ) 51 ''; 52}