Commit graph

320 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
143e35da0c docs: Handle warnings for unknown definitions 2024-02-13 20:36:09 +00:00
Marco Trevisan (Treviño)
f37b74b65a build: Support building with old polkit
Some distros as LTS ones may still have old versions of polkit
gobject.

Since we only depend on the new polkit because of auto-pointers,
let's add a tiny compatibility layer to make possible to get
p-p-d also working on older stable distros as OEMs may like.
2024-02-13 21:18:25 +01:00
Mario Limonciello
9f25cec345 Install custom debug message handler
Remove a lot of the unnecessary stuff about the process, and instead
pad out the domain to make it more accessible.

If running on an interactive terminal add color coding for warnings
and errors. If this behavior is not desirable for an interactive terminal,
NO_COLOR=0 can be set in the environment.
2024-02-13 20:10:30 +00:00
Mario Limonciello
e11eb6c28e Set the log domain for all source files 2024-02-13 20:10:30 +00:00
Mario Limonciello
291f8debe9 Add pre-commit rule for running python black 2024-02-13 20:04:46 +00:00
Mario Limonciello
55f2040e08 Add a unit test target for pylint on integration tests 2024-02-13 20:04:46 +00:00
Mario Limonciello
4896b3f1ec Reformat all integration tests using black and pylint 2024-02-13 20:04:46 +00:00
Mario Limonciello
f742b017b1 Reformat unittest_inspector.py using pylint and black 2024-02-13 20:04:46 +00:00
Mario Limonciello
8e49826403 Rename integration tests python file 2024-02-13 20:04:46 +00:00
Mario Limonciello
3247b511e2 Fix running test suite without root
Running Tests.test_fake_driver breaks stdin on a real terminal unless
the test suite is run as root.  It doesn't make sense for the fake
driver to capture stdin unless we are sure that we're interactive.

Lookup whether stdout is a tty and only run the keyboard setup in
probe for the fake driver if we're sure we're interactive.
2024-02-07 23:17:18 -06:00
Mario Limonciello
b26d928ddd Enable test suite by default
Rather than making tests opt in, make them opt out.  Distros should
be running tests in their infrastructure as well during build time.
2024-02-05 17:33:14 +00:00
Mario Limonciello
9a4229339b Add pre-commit support to CI
This will help to make sure that style things that are enforced by
pre-commit are set appropriately.
2024-02-03 09:06:19 -06:00
Mario Limonciello
59d5116f9d trivial: fix end of file on C files
Ensure that all files end in a new line
2024-02-03 09:05:45 -06:00
Mario Limonciello
6eb2981352 trivial: correct a spelling error in a comment 2024-02-03 09:05:45 -06:00
Marco Trevisan (Treviño)
85f3bb066c power-profiles-daemon: Do not leak blocked drivers list 2024-02-03 15:35:45 +01:00
Marco Trevisan (Treviño)
a784413762 power-profiles-daemon: Random indentation fixes 2024-02-03 15:35:23 +01:00
Marco Trevisan (Treviño)
ee1cfb36fc power-profiles-daemon: Steal strings when possible 2024-02-03 15:34:26 +01:00
Marco Trevisan (Treviño)
6923594b9f cleanup: Be consistent on spacing before function calls 2024-02-03 15:34:25 +01:00
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
Marco Trevisan (Treviño)
b88875c550 ppd-driver: Use NULL values if values are unset 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)
e94256aaf6 check-news: please shellcheck 2024-02-02 17:39:52 +01:00
Marco Trevisan (Treviño)
41831f5877 ci: Show coverage data and feed gitlab with it 2024-02-02 16:13:19 +01: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)
640a9f2609 ci, build: Use stricter meson builds, using -Werror and fatal meson warnings 2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
5663a041d9 ci: Use multiline args for meson setup for easier maintainability 2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
51be4b76f4 ci: Expose testlog junit report 2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
3079cc1000 ci: Do install/uninstall test after having built for testing
In this way we ensure tests requirements are met
2024-02-02 16:10:03 +01:00
Marco Trevisan (Treviño)
72d62e1ae4 ci: Print error logs on failures
Artifacts are fine but this is more convenient to inspect on immediate
failures.
2024-02-02 16:10:02 +01:00
Marco Trevisan (Treviño)
bf29037cc5 ci: Use meson setup as old command is deprecated 2024-02-02 16:09:52 +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
Marco Trevisan (Treviño)
7c2619a13d build: Add python dependencies checks on required gi modules too
We do check if gi module is available but not if any requirement gi
module also is, so do this instead of early failing at test point.
2024-02-02 13:34:03 +01:00
Bastien Nocera
19275d52fa main: Fix Python traceback when Ctrl+C'ing a launched app 2024-01-26 12:20:17 +01:00
Bastien Nocera
c19bede0d7 main: Return return code from launched executable
Using powerprofilesctl to launch an app would always result in what was
detected as success, because the code wasn't propagating the retval from
the launched application.
2024-01-26 12:19:55 +01:00
Mario Limonciello
53fb59a2b9 add newline to end of check-news shell script 2024-01-15 06:49:59 +00:00
Mario Limonciello
f1f927c280 Update README.md to match markdown.lint style 2024-01-15 06:46:49 +00: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
e1b53d1f64 Update G_DEFINE_TYPE whitespace
This is a macro not a function.
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
e1813f29a9 docs: Remove references to files that don't exist 2024-01-15 06:17:42 +00:00
Mario Limonciello
8c1c4d77e8 update gitignore 2024-01-15 06:17:42 +00:00
Kate Hsuan
8ddf592c9a ci-fixes: add python3-packaging 2024-01-15 13:59:42 +08:00
Mario Limonciello
1669b29661 Update whitespace in integration tests to be consistent 2024-01-06 10:07:48 -06:00
Bastien Nocera
be37aea01b intel-pstate: Add more debug to driver probe
Make it easier to see which features are used on the system by
summarising the features the driver will use.

** (power-profiles-daemon:126721): DEBUG: Found Intel p-state settings
** (power-profiles-daemon:126721): DEBUG: 	Energy Performance Preference: yes
** (power-profiles-daemon:126721): DEBUG: 	Energy Performance Bias: yes
** (power-profiles-daemon:126721): DEBUG: 	Has Turbo: yes

Closes: #120
2023-11-21 14:24:09 +01:00
Bastien Nocera
3cb0e750c7 ci: More CI fixes
Support both dnf and dnf5 as we don't know which rawhide Fedora image
will ultimately be used.
2023-11-21 14:20:08 +01:00