blob: 62137820878bda2a27d4271b2e1dcb3f8d9ea165 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import ./make-test-python.nix ({ pkgs, ... }:
let
crasher = pkgs.writeCBin "crasher" "int main;";
commonConfig = {
systemd.services.crasher.serviceConfig = {
ExecStart = "${crasher}/bin/crasher";
StateDirectory = "crasher";
WorkingDirectory = "%S/crasher";
Restart = "no";
};
};
in
{
name = "systemd-coredump";
meta = with pkgs.lib.maintainers; {
maintainers = [ squalus ];
};
nodes.machine1 = { pkgs, lib, ... }: commonConfig;
nodes.machine2 = { pkgs, lib, ... }: lib.recursiveUpdate commonConfig {
systemd.coredump.enable = false;
systemd.package = pkgs.systemd.override {
withCoredump = false;
};
};
testScript = ''
with subtest("systemd-coredump enabled"):
machine1.wait_for_unit("multi-user.target")
machine1.wait_for_unit("systemd-coredump.socket")
machine1.systemctl("start crasher");
machine1.wait_until_succeeds("coredumpctl list | grep crasher", timeout=10)
machine1.fail("stat /var/lib/crasher/core")
with subtest("systemd-coredump disabled"):
machine2.systemctl("start crasher");
machine2.wait_until_succeeds("stat /var/lib/crasher/core", timeout=10)
'';
})
|