From b355be2d91cc63d723793791657561e23f7703d8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen <20089782+gkleen@users.noreply.github.com> Date: Sun, 15 Jan 2023 14:06:58 +0100 Subject: [PATCH] chrony: add nixos test for ptp_kvm --- nixos/tests/all-tests.nix | 1 + nixos/tests/chrony-ptp.nix | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 nixos/tests/chrony-ptp.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index b4bd8ef3e0f2..fe51123f1d0f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -126,6 +126,7 @@ in { cfssl = handleTestOn ["aarch64-linux" "x86_64-linux"] ./cfssl.nix {}; charliecloud = handleTest ./charliecloud.nix {}; chromium = (handleTestOn ["aarch64-linux" "x86_64-linux"] ./chromium.nix {}).stable or {}; + chrony-ptp = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony-ptp.nix {}; cinnamon = handleTest ./cinnamon.nix {}; cjdns = handleTest ./cjdns.nix {}; clickhouse = handleTest ./clickhouse.nix {}; diff --git a/nixos/tests/chrony-ptp.nix b/nixos/tests/chrony-ptp.nix new file mode 100644 index 000000000000..c5904645fc4e --- /dev/null +++ b/nixos/tests/chrony-ptp.nix @@ -0,0 +1,24 @@ +import ./make-test-python.nix ({ lib, ... }: +{ + name = "chrony-ptp"; + + nodes = { + qemuGuest = { lib, ... }: { + boot.kernelModules = [ "ptp_kvm" ]; + + services.chrony = { + enable = true; + extraConfig = '' + refclock PHC /dev/ptp_kvm poll 2 dpoll -2 offset 0 stratum 3 + ''; + }; + }; + }; + + testScript = '' + start_all() + + qemuGuest.wait_for_unit('multi-user.target') + qemuGuest.succeed('systemctl is-active chronyd.service') + ''; +})