Commit graph

91 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
52abccf6b3 tests: Use skipTest to skip tests on missing components 2024-02-02 19:15:33 +01:00
Marco Trevisan (Treviño)
be5b4232a4 tests/integration-tests: Handle skipped tests from python side 2024-02-02 19:15:33 +01:00
Mario Limonciello
05cea66718 Fix compatibility with older Dbus API
Ensure that the 'Driver' key is populated.
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/136
2024-02-02 10:51:31 -06:00
Marco Trevisan (Treviño)
6899076633 build/tests: Do not redefine python3 and use meson found everywhere 2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
2af5179fc3 build: Use configured python program to run inspector 2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
3633439e71 integration-test: Close the polkitd stdout before killing polkitd
Without this we end up leaking the fd as python warns, so let's do it.
2024-02-02 13:45:58 +01:00
Mario Limonciello
0cdf32c3db Don't change governor for amd-pstate at probe
Make the change specifically when changing modes and only set powersave
for balance and powersaver profiles.
2024-01-15 06:38:25 +00:00
Mario Limonciello
5fd9d0e6dd Disable loading amd-pstate when the PM profile is a server or undefined
This mirrors the behavior used by Kernel 6.5 and later where amd-pstate
is configured to default into 'performance' by the kernel.  It's not
as useful in server to be changing it.

Link: 32f80b9adf
2024-01-15 06:28:23 +00:00
Mario Limonciello
bec7dfdf34 Add support for driver blocklist by environment variable
Drivers can be blocked from loading via `POWER_PROFILE_DAEMON_DRIVER_BLOCK`
which is a comma separated value listing the drivers to block.

This is an escape hatch in case CPU or platform driver are failing and a user
would like to block them.
2024-01-15 06:17:42 +00:00
Mario Limonciello
61f7650e35 Allow both CPU and platform drivers to be simultaneously active
This is done by designating all drivers as CPU drivers or platform drivers.
One of each driver can be active at any given time.

When setting an active profile CPU driver is set first as this is less likely to have
failures. If failures occur setting the platform driver then the CPU driver is undone.

If both profiles are degraded then the string for the reason from both drivers will be
comma separated to be compatible with existing API and users.

This is leveraged from https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/123

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/107
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/125
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/124
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/122
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/129
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/131
2024-01-15 06:17:42 +00:00
Mario Limonciello
462b91de55 tests: Split immutable control into a test helper 2024-01-15 06:17:42 +00:00
Mario Limonciello
1669b29661 Update whitespace in integration tests to be consistent 2024-01-06 10:07:48 -06:00
Prajna Sariputra
ea0e2be53c tests: Add tests for the AMD P-state driver 2023-04-26 14:23:18 +02:00
Bastien Nocera
1116e54128 platform-profile: "cool" should be balanced
The "cool" profile isn't a low-power mode, but a mode where the fans are
always running to reduce the temperature, presumably to allow it to run
faster.

At the same time, we need to handle the lack of low-power profile on HP
machines as they only had a cool mode and no low-power mode.

Closes: #89
2023-02-08 16:06:48 +01:00
Bastien Nocera
cbdac3da5b tests: Add tests for checking for profile existence 2022-09-08 11:44:19 +02:00
Bastien Nocera
58d556e85b tests: Add test for energy_perf_bias support 2022-06-28 15:50:27 +02:00
Bastien Nocera
4aa9922e2a tests: Fix typo 2022-06-28 14:17:47 +02:00
Bastien Nocera
53d9f55edd tests: Fix error running tests with Python 3.11
In 664448d81f
the "errors" attribute was removed from the _Outcome object. Adapt the
code to print the daemon log after a failed run().
2022-06-24 13:21:03 +02:00
Bastien Nocera
d72a30cff6 tests: Indent a hunk of code correctly 2022-06-24 10:24:36 +02:00
Bastien Nocera
afed35451d tests: Add test case for Intel P-State in passive mode 2022-05-02 14:47:22 +02:00
Bastien Nocera
23103bca59 intel-pstate: Don't change scaling_governor if P-State isn't active
On systems without HWP support, or when the Intel P-State driver runs in
"passive" mode, the CPU is effectively controlled by cpufreq governors.

Only modify the cpufreq scaling_governor if the Intel P-State driver is in
active mode.

See https://www.kernel.org/doc/html/v5.17/admin-guide/pm/intel_pstate.html#operation-modes

Closes: #91
2022-05-02 14:42:37 +02:00
Bastien Nocera
5260fae7cf tests: Test with a non-default scaling_governor
Check that the daemon is resetting the value on startup, and add
scaling_governor sysfs files for all the intel-pstate tests.
2022-04-28 15:25:52 +02:00
Bastien Nocera
588fe2cc08 tests: Add tests for error reporting when profile can't be set 2022-04-28 14:42:35 +02:00
Bastien Nocera
4bf9871b6f ci: Skip tests when dependencies are missing 2022-04-28 13:54:14 +02:00
Bastien Nocera
f6cfb32568 build: Fix run_command() call
WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300
2022-04-27 16:04:05 +02:00
Bastien Nocera
1be33091a4 tests: Add tests for both trickle-charge changes 2022-02-12 23:13:06 +01:00
Bastien Nocera
ca79f80635 intel-pstate: Don't show degraded perf with CPUs with no turbo
Don't show a degraded performance, caused by "no_turbo" being set,
when the CPU doesn't support TurboBoost at all.

Closes: #75
2022-01-31 10:50:47 +01:00
Bastien Nocera
c63503be97 tests: Add test to detect CPUs without Turbo support
Reproduces the hardware mentioned in
https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/75
2022-01-31 10:50:47 +01:00
Bastien Nocera
ae8e90892b tests: Write tests for traceback avoidance on D-Bus errors 2021-11-08 16:27:56 +01:00
Bastien Nocera
393cb81aa8 tests: Add test for HoldProfile when not authorised 2021-10-28 11:19:11 +02:00
Bastien Nocera
141d2ee64f tests: Rename test_not_allowed()
It only tests for the ActiveProfile authorisation.
2021-10-28 11:19:11 +02:00
Bastien Nocera
2a25f7d4cd tests: Test when switch-profile permission isn't granted 2021-09-28 17:19:40 +02:00
Bastien Nocera
bb92c628b4 tests: Start mock polkitd in the tests
And allow all us to perform all the actions.
2021-09-28 12:57:44 +02:00
Bastien Nocera
50d1f5e03a tests: Split the integration test into individual tests
unittest_inspector.py lists the tests in the integration-test.py script,
which are then added as individual tests.
2021-09-07 23:00:12 +02:00
Bastien Nocera
e9f5b04258 tests: Rename integration test script
Add the python suffix.
2021-09-07 23:00:12 +02:00
Bastien Nocera
4ee64adc81 tests: Move test config file to a private directory
If we are to run all the tests in parallel, we need to make sure that
each instance of the daemon gets its own configuration file, otherwise
all of them will be trying to change each other's config behind their
backs.
2021-09-07 23:00:12 +02:00
Bastien Nocera
c48108763b tests: Remove extra spaces 2021-08-23 13:19:44 +02:00
Bastien Nocera
20a2d7f7b8 tests: Add tests for quiet profile support 2021-07-24 23:03:25 +02:00
Bastien Nocera
58cc0ef02b main: Implement profile persistence
Save the current user-selected profile in
/var/lib/power-profiles-daemon/state.ini

Closes: #23
2021-07-19 20:21:29 +02:00
Bastien Nocera
2a87e4be3c tests: Add another platform_profile helper 2021-07-19 20:21:29 +02:00
Bastien Nocera
12a6d18d99 main: Remove restoring profile from kernel
Remove restoring the problem from the on-disk kernel file, as was done
for the platform_profile, as we want to implement actual persistence
across reboots.

We need to be the ones saving that data, as the kernel doesn't know
whether the profile changes are temporary, or permanent, and whether the
user was the one initiating that change.
2021-07-19 20:21:29 +02:00
James
23157c2aa4 tests: Fix running test under Python 3.6
See https://docs.python.org/3/library/subprocess.html#subprocess.run :
Changed in version 3.7: [...] Added the capture_output parameter.

Closes: #33
2021-07-16 17:35:58 +02:00
Bastien Nocera
8944e16894 tests: Add test for launch command in cli tool 2021-07-16 12:39:27 +02:00
David Redondo
0d293373ed tests: Add test for Hold/ReleaseProfile
Tests holding and relasing of profiles and priority of holds of
different profiles.
2021-07-16 12:39:27 +02:00
Bastien Nocera
99740ead2d main: Obsolete "Inhibited" property and add Degraded
The PerformanceInhibited property was there to convey that the
performance profile was unavailable, and that the daemon should switch
to a lower profile to avoid using the performance profile.

But it was difficult to communicate whether the daemon should switch
back to the performance profile when the inhibition disappeared, or
whether it should keep the same profile (the latter was what was
implemented).

There was also the problem that depending on the backend, the
performance profile might be able to provide a behaviour that wouldn't
match either of the unhampered performance profile, or the balanced
profile, but somewhere in between.

The PerformanceInhibited property is kept for compatibility reasons with
the existing consumer, GNOME 40. It will be removed in the future and
should not be relied on.

Closes: #24
2021-07-05 11:03:48 +02:00
Bastien Nocera
915320e3cf intel-pstate: Disable on-battery behaviour
Because of the way gnome-shell's animation framework is built, setting
energy_performance_preference to balance_power has a visible impact
on the smoothness of animations, as the CPU will clock down too quickly
between frames, leading to the appearance of a performance regression.

Disable the on-battery behaviour until gnome-shell is fixed to avoid
being accused of slowing systems down.

See https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/28#note_862766
2021-04-01 10:14:18 +02:00
Bastien Nocera
2fbf57b9bd tests: Simplify reading platform_profile value
Which allows us to ignore trailing spaces in the sysfs attribute, as
power-profiles-daemon writes those mock files without a linefeed, but
the real kernel (or some of our setup functions) would always append
a linefeed.
2021-03-19 13:18:43 +01:00
Bastien Nocera
d650d2e6b9 tests: Add helper which strips trailing newlines from sysfs attributes
This will come in handy.
2021-03-19 13:18:43 +01:00
Bastien Nocera
c7fb31632b main: Use a single driver for all the profiles
Of all the drivers that we've implemented, not a single one needed to
have different drivers to handle its different profiles, so simplify
things by having all the profiles be handled by a unique driver.

We still have separate drivers for separate types of hardware.
2021-03-19 11:06:37 +01:00
Martin Pitt
225d6e51d5 tests: Close leaked "unclosed file"
Fixes warning:
/usr/lib64/python3.9/unittest/case.py:550: ResourceWarning: unclosed file <_io.BufferedReader name=10>
  method()

See https://github.com/martinpitt/python-dbusmock/issues/67#issuecomment-800979091
2021-03-17 14:10:18 +01:00