From 8f94053a21261c894d408c35821b4efa27255c2f Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 25 Apr 2023 13:07:08 +0200 Subject: [PATCH] nixosTests.early-mount-options: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/early-mount-options.nix | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 nixos/tests/early-mount-options.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 506cba25ba50..25b12e51ba1f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -195,6 +195,7 @@ in { dovecot = handleTest ./dovecot.nix {}; drbd = handleTest ./drbd.nix {}; earlyoom = handleTestOn ["x86_64-linux"] ./earlyoom.nix {}; + early-mount-options = handleTest ./early-mount-options.nix {}; ec2-config = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-config or {}; ec2-nixops = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-nixops or {}; ecryptfs = handleTest ./ecryptfs.nix {}; diff --git a/nixos/tests/early-mount-options.nix b/nixos/tests/early-mount-options.nix new file mode 100644 index 000000000000..8be318ae13bc --- /dev/null +++ b/nixos/tests/early-mount-options.nix @@ -0,0 +1,19 @@ +# Test for https://github.com/NixOS/nixpkgs/pull/193469 +import ./make-test-python.nix { + name = "early-mount-options"; + + nodes.machine = { + virtualisation.fileSystems."/var" = { + options = [ "bind" "nosuid" "nodev" "noexec" ]; + device = "/var"; + }; + }; + + testScript = '' + machine.wait_for_unit("multi-user.target") + + var_mount_info = machine.succeed("findmnt /var -n -o OPTIONS") + options = var_mount_info.strip().split(",") + assert "nosuid" in options and "nodev" in options and "noexec" in options + ''; +}