Commit graph

440 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
cf4321c85b integration-tests: Use start_dbus_template everywhere
As it handles auto-cleanup better
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
b69374f17d power-profiles-daemon: Unwatch bus name and unset the proxy on stop
We start watching the bus and the proxy during start phase, so we need
to do it again during stop phase.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
932d3888b3 power-profiles-daemon: Add a single restart drivers function
It's easy enough, but let's use the same code everywhere
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
42866c5ce3 power-profiles-daemon: Code cleanup 2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
177e1c36d1 power-profiles-daemon: Do not potentially overwrite errors
We may get multiple errors while iterating, in such case we need to
clear them or we'd end up leaking or in critical errors
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
bb47c52d1d power-profiles-daemon: Simplify battery tracking changes 2024-04-03 19:23:05 +02:00
Marco Trevisan (Treviño)
d068b2404b ppd-driver-platform-profile: Add debug messages in case of error 2024-04-03 19:08:54 +02:00
Marco Trevisan (Treviño)
a30305b64b ppd-driver-platform-profile: Indentation fix 2024-04-03 19:08:33 +02:00
Mario Limonciello
1173596467 trivial: avoid a race condition with platform profile updates
Multiple change events will come in during the course of writing
an updated platform profile.  If the daemon responds to both
`G_FILE_MONITOR_EVENT_CHANGED` and
`G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT` it could potentially race
with the update and read an empty file.

Instead wait until specifically `G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT`
to update the file.
2024-04-03 19:06:01 +02:00
Mario Limonciello
b26caea438 trivial: don't allow G_FILE_MONITOR_EVENT_DELETED events
The kernel doesn't ever destroy the acpi platform profile driver
or intel-pstate drivers at runtime.
2024-04-02 14:27:59 -05:00
Mario Limonciello
2ec541edc0 trivial: tests: write out dytc_lapmode atomically 2024-04-02 14:15:53 -05:00
Mario Limonciello
5ada7c7289 Switch out assertions to g_critical() or g_return_val()
CI already run with `env["G_DEBUG"] = "fatal-criticals"` and these
errors would cause the daemon to abort.  In the event something
escapes don't show a crash on a regular user's system.
2024-04-02 13:22:02 -05:00
Marco Trevisan (Treviño)
e10516c348 integration-tests: Use automatic cleanups for stopping daemon and services
We were stopping the daemon manually while this is already something done
by the teardown function.

So let's leave this being automatically handled.
2024-04-02 20:06:14 +02:00
Marco Trevisan (Treviño)
c6e37fbd79 completions: Use kwargs to apply completion args 2024-04-02 00:31:39 +02:00
Marco Trevisan (Treviño)
ceeb9a6629 powerprofilesctl: Do not expose completions generation by default
If someone has python3-shtab installed we expose the completions
generation parameter in help, and that's not nice.

So let's avoid doing this unless during builds.
2024-04-02 00:17:32 +02:00
Marco Trevisan (Treviño)
19a53a5c26 powerprofilesctl: Handle pylint unused-argument 2024-04-02 00:17:32 +02:00
Marco Trevisan (Treviño)
92c49830c2 ci: Use the source python paths for cobertura reports
This allows to get the coverage report in merge requests affecting the
source file of powerprofilesctl
2024-04-02 00:17:32 +02:00
Mario Limonciello
2c5d8f2c2d trivial: don't destroy test bed until last step of tearDown 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
42f45ee6e1 powerprofilesctl: Proxy more signals to called process 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
0c80ae1108 powerprofilesctl: Use posix-compliant exit codes on signals
Do not return the python exit code when the launched process exit
because of a signal, but instead expose it as it is.
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
15c74efc7e powerprofilesctl: Exit with launched process exit code
This is a regression of commit 18a9c6668, due to the fact that the
argparse func return value is simply ignored.

So let's just exit directly with the provided return value in such case.
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
9bc5643950 src/powerprofilesctl: Fail if a launch unknown argument is before than command 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
acd17bd066 powerprofilesctl: Throw an unrecognized arguments error on on launch-commands 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
8574070267 tests/integration-tests: Ensure that the launch arguments are respected 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
c8d431b663 power-profiles-daemon: Cleanup the profile target activation logic
Just return early on errors
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
fc9f82321e power-profiles-daemon: Do not try to recover if no CPU driver is set 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
a17ab78512 ppd-driver-platform-profile: Do not try access to a GError** instance
Use a local error to handle this case and propagate it if needed
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
2bd9d2b554 ci: Install debug dependencies on test jobs 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
6cbff999d3 ci: Simplify identification and usage of dnf binary 2024-04-01 21:58:47 +00:00
Mario Limonciello
65c774fa13 trivial: Don't suggest G_MESSAGES_DEBUG=all to debug
This gets glib debugging enabled, but instead --verbose should be
used to get power-profiles-daemon debugging.
2024-04-01 13:24:57 -05:00
Mario Limonciello
5bfefba61d Raise message about failed to run from another daemon running to warning
This is better than silently failing to run and you having no idea why.
2024-04-01 16:28:36 +00:00
Mario Limonciello
7e747e70a9 Raise the message about starting daemon to info 2024-04-01 16:28:36 +00:00
Mario Limonciello
b4627e3e81 Always redirect log handler
The log handler takes care of the verbosity level.  Use the custom
handler even without running daemon in verbose mode or journald.
2024-04-01 16:28:36 +00:00
Marco Trevisan (Treviño)
ca14f5875d ci: Only install gcovr in the jobs requiring it 2024-04-01 18:04:32 +02:00
Marco Trevisan (Treviño)
216256dbb5 ci: Install python3-coverage and use it for saving coverage data 2024-04-01 18:04:32 +02:00
Marco Trevisan (Treviño)
8da511916f tests: Add support for collecting python coverage data
We have a python script for the control tool so let's use that to
monitor the powerprofilesctl coverage
2024-04-01 18:04:32 +02:00
Marco Trevisan (Treviño)
b4d5a045d0 tests/integration-tests: Add a function to get powerprofilesctl path 2024-04-01 15:57:05 +02:00
Mario Limonciello
87fea13806 Pass all unknown arguments to the launch command
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/144
2024-03-26 15:56:16 -05:00
Rahul Sundaram
cb77e0ad34 Update Systemd security settings 2024-03-26 20:32:10 +00:00
Mario Limonciello
bdc60171e5 amd-pstate: Transition between balanced_power and balanced_performance
When the system is on AC and profile is balanced put the EPP value
of balanced_performance.
When the system is on battery and profile is balanced put the EPP value
of balanced_power.
2024-03-02 16:23:47 +00:00
Mario Limonciello
ab0cef6ee2 amdgpu: Use the upower core support from the daemon
No need to track in the action anymore.
2024-03-02 16:23:47 +00:00
Mario Limonciello
71161808db Add support for upower into the daemon
The daemon can notify CPU driver, Platform driver and all actions
of system power state changes.
2024-03-02 16:23:47 +00:00
Mario Limonciello
b5cf270a20 trivial: drop some boilerplate setup code in the unit tests
Use dbusmock's start_system_bus() to start and tear down the system
bus.
2024-02-28 20:34:30 -06:00
Mario Limonciello
493818a7e2 Show both daemon and client versions
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/139
2024-02-26 21:27:28 -06:00
Mario Limonciello
e568306d9c trivial: stop setting top_builddir in test env 2024-02-26 21:27:07 -06:00
Mario Limonciello
000dd5d699 trivial: move completions to their own directory 2024-02-26 21:26:26 -06:00
Marco Trevisan (Treviño)
0c301fe93f ci: Deploy html docs in pages 2024-02-15 21:43:43 +01:00
Marco Trevisan (Treviño)
0a60afd973 ci: Fix indentation 2024-02-15 21:40:07 +01:00
Marco Trevisan (Treviño)
9531da36d5 docs: Update authors and copyright information 2024-02-15 21:40:07 +01:00
Marco Trevisan (Treviño)
457b6ae314 ci: Only install test dependencies on test jobs 2024-02-15 21:40:07 +01:00