git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/hardened test: add failing test-case for deferred mounts
commitbccaf630679a5251549fd11abb08eb35e6bcec8e authorJoachim Fasting <joachifm@fastmail.fm> dateFri 22 Sep 2017, 23:20 (9 years ago) parent15a4f9d
1 file changed+19
nixos/tests/hardened.nix+19
nixos/tests/hardened.nix+19
@@ -10,6 +10,17 @@ import ./make-test.nix ({ pkgs, ...} : {
1010 { users.users.alice = { isNormalUser = true; extraGroups = [ "proc" ]; };
1111 users.users.sybil = { isNormalUser = true; group = "wheel"; };
1212 imports = [ ../modules/profiles/hardened.nix ];
13+ virtualisation.emptyDiskImages = [ 4096 ];
14+ boot.initrd.postDeviceCommands = ''
15+ ${pkgs.dosfstools}/bin/mkfs.vfat -n EFISYS /dev/vdb
16+ '';
17+ fileSystems = lib.mkVMOverride {
18+ "/efi" = {
19+ device = "/dev/disk/by-label/EFISYS";
20+ fsType = "vfat";
21+ options = [ "noauto" ];
22+ };
23+ };
1324 };
1425
1526 testScript =
@@ -42,5 +53,13 @@ import ./make-test.nix ({ pkgs, ...} : {
4253 subtest "kcore", sub {
4354 $machine->fail("cat /proc/kcore");
4455 };
56+
57+ # Test deferred mount
58+ subtest "mount", sub {
59+ $machine->fail("mountpoint -q /efi"); # was deferred
60+ $machine->execute("mkdir -p /efi");
61+ $machine->succeed("mount /dev/disk/by-label/EFISYS /efi");
62+ $machine->succeed("mountpoint -q /efi"); # now mounted
63+ };
4564 '';
4665})