summary refs log tree commit diff
path: root/nixos/tests/systemd.nix
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2020-07-08 21:43:12 -0400
committerMatt Layher <mdlayher@gmail.com>2020-07-08 21:43:12 -0400
commitf9ea9c7299b9e5a181a7a99990d14ae069609eb1 (patch)
tree4436f646252275321103f823b2652093aca3c718 /nixos/tests/systemd.nix
parentcb330dafd585849af115509b84eac482d2556375 (diff)
downloadnixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.gz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.bz2
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.lz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.xz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.zst
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.zip
nixos/systemd: add options for hardware watchdog management
Diffstat (limited to 'nixos/tests/systemd.nix')
-rw-r--r--nixos/tests/systemd.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix
index ca2e36a443e..ce950be4846 100644
--- a/nixos/tests/systemd.nix
+++ b/nixos/tests/systemd.nix
@@ -50,6 +50,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
         fi
       '';
     };
+
+    systemd.watchdog = {
+      device = "/dev/watchdog";
+      runtimeTime = "30s";
+      rebootTime = "10min";
+      kexecTime = "5min";
+    };
   };
 
   testScript = ''
@@ -117,5 +124,20 @@ import ./make-test-python.nix ({ pkgs, ... }: {
         retcode, output = machine.execute("systemctl status testservice1.service")
         assert retcode in [0, 3]  # https://bugs.freedesktop.org/show_bug.cgi?id=77507
         assert "CPU:" in output
+
+    # Test systemd is configured to manage a watchdog
+    with subtest("systemd manages hardware watchdog"):
+        machine.wait_for_unit("multi-user.target")
+
+        # It seems that the device's path doesn't appear in 'systemctl show' so
+        # check it separately.
+        assert "WatchdogDevice=/dev/watchdog" in machine.succeed(
+            "cat /etc/systemd/system.conf"
+        )
+
+        output = machine.succeed("systemctl show | grep Watchdog")
+        assert "RuntimeWatchdogUSec=30s" in output
+        assert "RebootWatchdogUSec=10m" in output
+        assert "KExecWatchdogUSec=5m" in output
   '';
 })