Skip to content

Commit

Permalink
nixos/hardened test: add failing test-case for deferred mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
joachifm committed Sep 22, 2017
1 parent 15a4f9d commit bccaf63
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nixos/tests/hardened.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ import ./make-test.nix ({ pkgs, ...} : {
{ users.users.alice = { isNormalUser = true; extraGroups = [ "proc" ]; };
users.users.sybil = { isNormalUser = true; group = "wheel"; };
imports = [ ../modules/profiles/hardened.nix ];
virtualisation.emptyDiskImages = [ 4096 ];
boot.initrd.postDeviceCommands = ''
${pkgs.dosfstools}/bin/mkfs.vfat -n EFISYS /dev/vdb
'';
fileSystems = lib.mkVMOverride {
"/efi" = {
device = "/dev/disk/by-label/EFISYS";
fsType = "vfat";
options = [ "noauto" ];
};
};
};

testScript =
Expand Down Expand Up @@ -42,5 +53,13 @@ import ./make-test.nix ({ pkgs, ...} : {
subtest "kcore", sub {
$machine->fail("cat /proc/kcore");
};
# Test deferred mount
subtest "mount", sub {
$machine->fail("mountpoint -q /efi"); # was deferred
$machine->execute("mkdir -p /efi");
$machine->succeed("mount /dev/disk/by-label/EFISYS /efi");
$machine->succeed("mountpoint -q /efi"); # now mounted
};
'';
})

0 comments on commit bccaf63

Please sign in to comment.