diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 8b674bfb73423..c9cab8bb41af1 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -141,6 +141,7 @@ in { audiobookshelf = handleTest ./audiobookshelf.nix {}; auth-mysql = handleTest ./auth-mysql.nix {}; authelia = handleTest ./authelia.nix {}; + auto-cpufreq = handleTest ./auto-cpufreq.nix {}; avahi = handleTest ./avahi.nix {}; avahi-with-resolved = handleTest ./avahi.nix { networkd = true; }; ayatana-indicators = runTest ./ayatana-indicators.nix; diff --git a/nixos/tests/auto-cpufreq.nix b/nixos/tests/auto-cpufreq.nix new file mode 100644 index 0000000000000..79129cf1ffaf2 --- /dev/null +++ b/nixos/tests/auto-cpufreq.nix @@ -0,0 +1,33 @@ +import ./make-test-python.nix ( + { pkgs, ... }: + + { + name = "auto-cpufreq-server"; + + nodes = { + machine = + { pkgs, ... }: + { + # service will still start but since vm inside qemu cpufreq adjustments + # cannot be made. This will resource in the following error but the service + # remains up: + # ERROR: + # Couldn't find any of the necessary scaling governors. + services.auto-cpufreq = { + enable = true; + settings = { + charger = { + turbo = "auto"; + }; + }; + }; + }; + }; + + testScript = '' + machine.start() + machine.wait_for_unit("auto-cpufreq.service") + machine.succeed("auto-cpufreq --force reset") + ''; + } +) diff --git a/pkgs/by-name/au/auto-cpufreq/package.nix b/pkgs/by-name/au/auto-cpufreq/package.nix index 15db7faa4089b..512d2fc3c788b 100644 --- a/pkgs/by-name/au/auto-cpufreq/package.nix +++ b/pkgs/by-name/au/auto-cpufreq/package.nix @@ -7,6 +7,7 @@ wrapGAppsHook3, gtk3, getent, + nixosTests, }: python3Packages.buildPythonPackage rec { pname = "auto-cpufreq"; @@ -93,6 +94,10 @@ python3Packages.buildPythonPackage rec { cp scripts/org.auto-cpufreq.pkexec.policy $out/share/polkit-1/actions ''; + passthru.tests = { + inherit (nixosTests) auto-cpufreq; + }; + meta = { mainProgram = "auto-cpufreq"; homepage = "https://github.com/AdnanHodzic/auto-cpufreq";