Mario Limonciello
2e00350f92
trivial: Don't assume that turbo_pct is present
...
According to kernel documentation this file is only exposed if
the value will be the same for all CPUs.
"This attribute is present only if the value exposed by it is the same for all of the CPUs in the system."
Link: https://www.kernel.org/doc/html/v6.9-rc1/admin-guide/pm/intel_pstate.html
2024-04-06 15:05:11 -05:00
Marco Trevisan (Treviño)
a86b9cda94
ppd-utils: Use simpler write without extra copies
...
Simplify our writing function by just using pure C open/write calls
since we don't really need to be able to create files.
In fact this made possible to spot a test issue where a file was not
present and in fact in some scenarios we had random valgrind errors in
CI.
Plus, since we just need to write the contents as it is, we can avoid
extra buffers.
2024-04-03 23:28:26 +00:00
Mario Limonciello
9dc15cef70
Add --driver-block and --action-block arguments
...
These will set the environment variables accordingly to block drivers
or actions from loading.
2024-04-03 19:55:41 +00:00
Mario Limonciello
acd40e54ca
Distinguish differently between -v and -vv
...
Set the default log level to MESSAGE.
If launched with -v, upgrade to INFO.
If launched with -vv, upgrade to DEBUG.
2024-04-03 19:55:41 +00:00
Marco Trevisan (Treviño)
2fb8f83d4b
integration-tests: Use clearer logic to run initial condition check
2024-04-03 21:52:44 +02:00
Marco Trevisan (Treviño)
fb1039f9da
integration-tests: Add more debugging bits if we can't connect to server
2024-04-03 21:49:18 +02:00
Mario Limonciello
4b172671cc
Add unit tests for upower starting after ppd
2024-04-03 13:55:02 -05:00
Mario Limonciello
3b4249d8e9
intel-pstate: Use different EPP/EPB values for battery and AC.
...
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/145
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/71
2024-04-03 13:34:00 -05:00
Marco Trevisan (Treviño)
96eef4b8eb
tests: Write daemon stderr to system stderr
2024-04-03 20:15:17 +02:00
Marco Trevisan (Treviño)
fd8f6a0f3c
integration-tests: Add test for resuming state after suspend on intel
2024-04-03 20:15:17 +02:00
Marco Trevisan (Treviño)
928c4611d8
power-profiles-daemon: Only update battery value when it actually did
...
We might have notified the drivers even for no actual changes, so
let's refactor the code so that we only notify them when we really have
a battery state change.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
ae3a30da98
integration-tests: Use a lambda for assert_eventually messages
...
In this way we can show the actual value after we've finished the check
instead of the one that was read initially.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
df534c3911
integration-tests: Add ability to check if a condition persists
...
assert_eventually() can check if a condition eventually is true, but
this could change after a while. So add another function that allows
to check if a condition persists for a given time.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
d3199b3203
integration-tests: Simulate OnBattery changes while the daemon is running
2024-04-03 20:10:34 +02:00
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
Mario Limonciello
2ec541edc0
trivial: tests: write out dytc_lapmode atomically
2024-04-02 14:15:53 -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
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)
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
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
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
Marco Trevisan (Treviño)
b3df9190e7
tests: Fix failing messages to use f'strings as was intended to
...
But then as per reformatting, they got lost...
2024-02-15 18:05:32 +01:00
Marco Trevisan (Treviño)
1ca46967b2
tests: Ensure daemon is ready before launching the test client
2024-02-15 01:30:26 +01:00
Marco Trevisan (Treviño)
47a155407f
tests: wait more for valgrind-running daemon
...
In CI we may need to wait for it more than 10 seconds, so second this.
2024-02-15 01:26:29 +01:00
Marco Trevisan (Treviño)
1c48162ea1
tests: Assert launched client exits with no error
2024-02-15 00:02:09 +01:00
Marco Trevisan (Treviño)
e1c83e8b27
tests: Ensure the daemon exits with no error
...
We did terminate the daemon and waited for it, but we did not ensure
that it was terminated with no error.
This is particularly a problem when we are running the sanitizers or
valgrind, because we didn't catch any error.
Thus... We were living with some leaks that we never caught :)
2024-02-14 23:32:38 +01:00
Marco Trevisan (Treviño)
b27fa341ec
tests: Stop the daemon using termination
...
This implies a SIGTERM, and so will trigger the daemon clean teardown,
making it exit correctly.
In this way the coverage data is correctly generated, making finally our
coverage reports to be real!
Fixes : #137
2024-02-14 22:07:30 +00:00
Marco Trevisan (Treviño)
37bf20bb55
tests: Show full logs if PPD_TEST_VERBOSE env is set and use it in meson
...
It can be useful to inspect the daemon logs in any case, so let's show
the logs details when running in meson.
Then it's up to use the `--verbose` parameter to decide whether to see
them or to inspect them from the generated logs.
2024-02-14 21:33:05 +00:00
Mario Limonciello
940c262b74
amdgpu: reduce panel_power_saving values
...
The loss of color fidelity in battery mode is too dramatic, especially
with dark content (such as GNOME in dark mode or a dark background terminal).
2024-02-14 13:41:22 -06:00
Marco Trevisan (Treviño)
2a36abda82
tests: Add utility function to eventually check active profile
2024-02-14 19:43:43 +01:00
Marco Trevisan (Treviño)
d174b46498
tests: Simplify files writing
...
Avoid repeating the same pattern everywhere, just do it once with an
utility function.
2024-02-14 19:36:29 +01:00
Marco Trevisan (Treviño)
a1d8585aec
tests: Wait for file contents to match expected ones
...
Daemon may take some moments to do IO operations, and the tests
may be too fast in reading this.
As per previous cleanups this become a problem when testing in
slower scenarios (as valgrind), so take the opportunity to
cleanup the tests so that we always wait for file contents to
match the expected one.
2024-02-14 19:36:29 +01:00
Marco Trevisan (Treviño)
14edcbfd89
tests: Simplify assert_eventually() using GLib.Timeout
...
Also use milliseconds instead of deciseconds.
2024-02-14 18:37:24 +01:00
Marco Trevisan (Treviño)
6cf48b4a42
tests: Use python unittest assertions instead of native ones
2024-02-14 17:47:36 +01:00
Marco Trevisan (Treviño)
a518f333e0
tests: Avoid creating a new proxy for each dbus call
...
Just use the previously allocated, and do not cache anything on it
2024-02-14 17:47:36 +01:00
Marco Trevisan (Treviño)
867af41ab8
tests: Also ensure that the powerprofilesctl commands match with daemon
2024-02-14 17:38:39 +01:00
Mario Limonciello
13c4202fc7
tests: drop unused read_file() method
2024-02-14 10:37:17 -06:00
Mario Limonciello
e1c0a48b2c
tests: Add integration tests to scrape the output of powerprofilesctl
2024-02-14 10:37:15 -06:00
Mario Limonciello
18a9c66681
Use python argparse and decorators instead of reinventing both
2024-02-14 10:37:14 -06:00
Mario Limonciello
ba2cf0d6f8
Add a Version property and read it with powerprofilesctl
2024-02-14 00:03:28 -06:00
Marco Trevisan (Treviño)
40f3361473
power-profiles-daemon: Emit ProfileReleased when an holder is released
...
We used to send the signal only when cleaning up the holders, but we
should notify them also when an holder has been released for whatever
reason.
2024-02-14 05:17:49 +00:00