nixos/auto-cpufreq: init vm test (#350507)

authored by Christian Kögler and committed by GitHub 32f76941 872efd3d

+39
+1
nixos/tests/all-tests.nix
··· 144 144 audiobookshelf = handleTest ./audiobookshelf.nix {}; 145 145 auth-mysql = handleTest ./auth-mysql.nix {}; 146 146 authelia = handleTest ./authelia.nix {}; 147 + auto-cpufreq = handleTest ./auto-cpufreq.nix {}; 147 148 avahi = handleTest ./avahi.nix {}; 148 149 avahi-with-resolved = handleTest ./avahi.nix { networkd = true; }; 149 150 ayatana-indicators = runTest ./ayatana-indicators.nix;
+33
nixos/tests/auto-cpufreq.nix
··· 1 + import ./make-test-python.nix ( 2 + { pkgs, ... }: 3 + 4 + { 5 + name = "auto-cpufreq-server"; 6 + 7 + nodes = { 8 + machine = 9 + { pkgs, ... }: 10 + { 11 + # service will still start but since vm inside qemu cpufreq adjustments 12 + # cannot be made. This will resource in the following error but the service 13 + # remains up: 14 + # ERROR: 15 + # Couldn't find any of the necessary scaling governors. 16 + services.auto-cpufreq = { 17 + enable = true; 18 + settings = { 19 + charger = { 20 + turbo = "auto"; 21 + }; 22 + }; 23 + }; 24 + }; 25 + }; 26 + 27 + testScript = '' 28 + machine.start() 29 + machine.wait_for_unit("auto-cpufreq.service") 30 + machine.succeed("auto-cpufreq --force reset") 31 + ''; 32 + } 33 + )
+5
pkgs/by-name/au/auto-cpufreq/package.nix
··· 7 7 wrapGAppsHook3, 8 8 gtk3, 9 9 getent, 10 + nixosTests, 10 11 }: 11 12 python3Packages.buildPythonPackage rec { 12 13 pname = "auto-cpufreq"; ··· 91 92 mkdir -p $out/share/polkit-1/actions 92 93 cp scripts/org.auto-cpufreq.pkexec.policy $out/share/polkit-1/actions 93 94 ''; 95 + 96 + passthru.tests = { 97 + inherit (nixosTests) auto-cpufreq; 98 + }; 94 99 95 100 meta = { 96 101 mainProgram = "auto-cpufreq";