mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 04:31:52 +00:00
Merge pull request #29462 from joachifm/trivial-misc-tests
nixos/tests: move kernel-params & sysctl test to misc
This commit is contained in:
commit
8ceb209830
|
@ -94,9 +94,6 @@ in rec {
|
|||
(all nixos.tests.keymap.neo)
|
||||
(all nixos.tests.keymap.qwertz)
|
||||
nixos.tests.plasma5.x86_64-linux # avoid big build on i686
|
||||
(all nixos.tests.kernel-latest)
|
||||
(all nixos.tests.kernel-lts)
|
||||
(all nixos.tests.kernel-params)
|
||||
#(all nixos.tests.lightdm)
|
||||
(all nixos.tests.login)
|
||||
(all nixos.tests.misc)
|
||||
|
@ -119,7 +116,6 @@ in rec {
|
|||
(all nixos.tests.sddm.default)
|
||||
(all nixos.tests.simple)
|
||||
(all nixos.tests.slim)
|
||||
nixos.tests.sysctl.x86_64-linux # i686 fails
|
||||
(all nixos.tests.udisks2)
|
||||
(all nixos.tests.xfce)
|
||||
|
||||
|
|
|
@ -267,7 +267,6 @@ in rec {
|
|||
tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {};
|
||||
tests.kernel-latest = callTest tests/kernel-latest.nix {};
|
||||
tests.kernel-lts = callTest tests/kernel-lts.nix {};
|
||||
tests.kernel-params = callTest tests/kernel-params.nix {};
|
||||
tests.keystone = callTest tests/keystone.nix {};
|
||||
tests.kubernetes = hydraJob (import tests/kubernetes.nix { system = "x86_64-linux"; });
|
||||
tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; };
|
||||
|
@ -313,7 +312,6 @@ in rec {
|
|||
tests.slim = callTest tests/slim.nix {};
|
||||
tests.smokeping = callTest tests/smokeping.nix {};
|
||||
tests.snapper = callTest tests/snapper.nix {};
|
||||
tests.sysctl = callTest tests/sysctl.nix {};
|
||||
tests.taskserver = callTest tests/taskserver.nix {};
|
||||
tests.tomcat = callTest tests/tomcat.nix {};
|
||||
tests.udisks2 = callTest tests/udisks2.nix {};
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
name = "kernel-params";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ nequissimus ];
|
||||
};
|
||||
|
||||
machine = { config, lib, pkgs, ... }:
|
||||
{
|
||||
boot.kernelPackages = pkgs.linuxPackages;
|
||||
boot.kernelParams = [
|
||||
"nohibernate"
|
||||
"page_poison=1"
|
||||
"vsyscall=none"
|
||||
];
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
$machine->fail("cat /proc/cmdline | grep page_poison=0");
|
||||
$machine->succeed("cat /proc/cmdline | grep nohibernate");
|
||||
$machine->succeed("cat /proc/cmdline | grep page_poison=1");
|
||||
$machine->succeed("cat /proc/cmdline | grep vsyscall=none");
|
||||
'';
|
||||
})
|
|
@ -25,6 +25,8 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||
};
|
||||
users.users.sybil = { isNormalUser = true; group = "wheel"; };
|
||||
security.sudo = { enable = true; wheelNeedsPassword = false; };
|
||||
boot.kernel.sysctl."vm.swappiness" = 1;
|
||||
boot.kernelParams = [ "vsyscall=emulate" ];
|
||||
};
|
||||
|
||||
testScript =
|
||||
|
@ -117,5 +119,18 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||
subtest "sudo", sub {
|
||||
$machine->succeed("su - sybil -c 'sudo true'");
|
||||
};
|
||||
|
||||
# Test sysctl
|
||||
subtest "sysctl", sub {
|
||||
$machine->waitForUnit("systemd-sysctl.service");
|
||||
$machine->succeed('[ `sysctl -ne vm.swappiness` = 1 ]');
|
||||
$machine->execute('sysctl vm.swappiness=60');
|
||||
$machine->succeed('[ `sysctl -ne vm.swappiness` = 60 ]');
|
||||
};
|
||||
|
||||
# Test boot parameters
|
||||
subtest "bootparam", sub {
|
||||
$machine->succeed('grep -Fq vsyscall=emulate /proc/cmdline');
|
||||
};
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
name = "sysctl";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ nequissimus ];
|
||||
};
|
||||
|
||||
machine = { config, lib, pkgs, ... }:
|
||||
{
|
||||
boot.kernelPackages = pkgs.linuxPackages;
|
||||
boot.kernel.sysctl = {
|
||||
"kernel.dmesg_restrict" = true; # Restrict dmesg access
|
||||
"net.core.bpf_jit_enable" = false; # Turn off bpf JIT
|
||||
"user.max_user_namespaces" = 0; # Disable user namespaces
|
||||
"vm.swappiness" = 2; # Low swap usage
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
$machine->succeed("sysctl kernel.dmesg_restrict | grep 'kernel.dmesg_restrict = 1'");
|
||||
$machine->succeed("sysctl net.core.bpf_jit_enable | grep 'net.core.bpf_jit_enable = 0'");
|
||||
$machine->succeed("sysctl user.max_user_namespaces | grep 'user.max_user_namespaces = 0'");
|
||||
$machine->succeed("sysctl vm.swappiness | grep 'vm.swappiness = 2'");
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue