Commit graph

96 commits

Author SHA1 Message Date
Kate Hsuan
a2bf0200f2 linux: integration-test: Two mice were paired with a unifying receiver
The model name of the two mice should be displayed when paired with one
unifying receiver.
2025-05-13 11:08:48 +08:00
Sicelo A. Mhlongo
0f1506b61a linux: integration-test: Test exporting sysfs attributes
Add test for DBus exporting of the following sysfs attributes:
1. capacity_level
2. voltage_min_design
3. voltage_max_design

Related: #301

Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
2025-04-16 15:08:48 +08:00
Kate Hsuan
89c6d2726e linux: integration_test: Wait 5 seconds for bluez to set up the device information 2025-04-11 15:33:31 +08:00
initramfs
a86d2d059c
linux: integration-test: Update test case for "state_all_discharging" support
Updates the "test_battery_ac" test case with the changes introduced by
the addition of the "state_all_discharging" field.

Namely, we now assert that the "OnBattery" property is False while
still checking that the correct "WarningLevel" property is set.
2025-04-09 00:58:28 +00:00
Kate Hsuan
71e473902f linux: integration-test: Handle connecting the low-power charger
Add a scenario for connecting a low-power charger.
1. The AC is online.
2. The battery is discharging.
3. The percentage drops to 2.5%.
4. The warning level will become UP_DEVICE_LEVEL_CRITICAL.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2025-02-24 06:13:47 +00:00
Kate Hsuan
4f1ef04475 linux: integration-test: a test case for Dualshock4 with a headphone jack 2025-02-08 07:58:03 +00:00
Kate Hsuan
478c51e4ea linux: integration-test: test case for the removable battery 2025-01-24 17:39:54 +08:00
fossdd
3731b03553 Fix test race in test_bluetooth_hidpp_mouse
We ship the proposed patch already since Oct 2024 in Alpine Linux and is
working for us correctly and fixes the test.

Closes https://gitlab.freedesktop.org/upower/upower/-/issues/228

Co-Authored-By: Bastien Nocera <hadess@hadess.net>
2025-01-13 06:28:36 +00:00
Kate Hsuan
17e5903670 Reformat python code style with black 2025-01-08 14:01:34 +08:00
Kate Hsuan
2678cb00d4 Fix trailing white space and end of file 2025-01-08 14:01:34 +08:00
Kate Hsuan
a038b237fb linux: integration-test: wait 10 seconds for stopping the daemon
Some slow systems take more than 5 seconds to stop the daemon.  The
waiting time was extended to 10 seconds to ensure the daemon
shutdowns properly.

Resolves: #290

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-12-06 06:30:03 +00:00
Stuart Hayhurst
9ee76826bd Fix race condition in test_sibling_priority_no_overwrite 2024-09-25 16:56:11 +01:00
Jelle van der Waa
3390fa48ae linux: integration-test: correct unsupported test comment 2024-09-17 20:13:50 +02:00
Jelle van der Waa
23cf8c19f7 linux: integration-test: drop f-string without placeholder 2024-09-17 18:41:14 +02:00
Rogerio Alves
88031e563f Support fractional battery percent.
Make upower supports fractional battery percent
(e.g., 0.5% instead of 1%).

Signed-off-by: Rogerio Alves Cardoso <rogerio.cardoso@collabora.com>
2024-09-12 15:55:00 +08:00
Kate Hsuan
b71996a526 linux: integration-test: Add polkit test
Test action is allowed and not allowed when calling EnableChargeThreshold
dbus API.
2024-08-29 06:31:37 +00:00
Jelle van der Waa
5b656780ff linux: integration-test: Test for battery charging threshold
Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-20 17:04:12 +08:00
Kate Hsuan
669a1c2a27 linux: test: test for Ignore as CriticalPowerAction 2024-06-11 09:38:08 +00:00
Kate Hsuan
544eba5543 test: the test for CriticalPowerAction=Suspend
The test cases for AllowRiskyCriticalPowerAction=true and false when
CriticalPowerAction=Suspend.
2024-04-25 16:07:11 +08:00
Jelle van der Waa
17c14cc63f Revert "all: Remove Lid handling"
This reverts commit 07565ef6a1.

In the current systemd stable release 255 org.freedesktop.login1 does
not emit a LidisClosed event, this has added in systemd `main` and will
be availble in the next release.

As GNOME control panel still uses UPower's `LidIsclosed` property and
many other DE's such as Xfce/LXQt/Deepin as well revert this until the
systemd changes are available in all Distributions.

https://github.com/systemd/systemd/pull/30706

Resolve: https://gitlab.freedesktop.org/upower/upower/-/issues/260
2024-01-26 14:57:27 +00:00
Martin Pitt
bd1e4698f4 linux: Adjust test_bluetooth_le_device for dbusmock 0.30.1
dbusmock 0.30.1 changed the BlueZ template to set the default "Class"
property to `MOCK_PHONE_CLASS` right away instead of in PairDevice() [1].

test_bluetooth_le_device() relied on the previous implicit default of a
"0" Class value. Set this explicitly to expect a "generic" device. This
makes the test work with old and current dbusmock versions.

https://bugs.debian.org/1059467

[1] https://github.com/martinpitt/python-dbusmock/pull/192
2023-12-28 21:13:15 +01:00
Ratchanan Srirattanamet
dfde9e2274 linux: stop assuming power supply of unknown type as battery
Some vendor kernel (most notably Android devices) expose various types
of BMS (battery management system) as power supplies. This is something
UPower has never designed to deal with, and thus UPower should not
represent or consider it to be a battery.

Fortunately, most of the time the actual "battery" power supply has the
correct type, so we can safely ignore those devices which have unknown
type. Also, the code that assumes power supply of unknown type seems
pretty dated and probably doesn't make sense anymore. So, let's remove
this assumption altogether.
2023-11-09 15:51:14 +07:00
Jelle van der Waa
4baf9b8903 linux: drop f-literals without format string 2023-11-03 15:26:26 +01:00
Jelle van der Waa
d3a1d17d59 linux: prefer is not None over !=
Compare on object identity not equality.
2023-11-03 15:18:09 +01:00
Bastien Nocera
07565ef6a1 all: Remove Lid handling
It is now handled solely in logind to take power management decisions,
and in the compositor for making decisions related to available
displays.

See:
https://www.freedesktop.org/software/systemd/man/org.freedesktop.login1.html
2023-07-06 11:09:42 +02:00
Bastien Nocera
e4e498e198 linux: Fix integration test to work under jhbuild
Fixes: 648abe9c27 ("tests: Test a client running while daemon restarts")
2023-07-06 10:07:08 +02:00
Bastien Nocera
f8fe036331 linux: Work-around potential race in test_headset_hotplug 2023-07-05 17:39:19 +02:00
Bastien Nocera
53ccc01be9 linux: Add test for device signals with wireless_status 2023-07-05 17:39:19 +02:00
Bastien Nocera
4d3d8759db linux: Add wait_for_mainloop() test helper 2023-07-05 17:39:19 +02:00
Michael Biebl
dec9468136 linux: Fix integration test to work with system installed upower binary
Fixes: 648abe9c27 ("tests: Test a client running while daemon restarts")
Closes: #241
2023-07-05 15:30:47 +00:00
Bastien Nocera
95de7181dd linux: Add test for is-present changes at runtime 2023-07-04 15:20:20 +02:00
Bastien Nocera
648abe9c27 tests: Test a client running while daemon restarts 2023-07-04 10:25:44 +02:00
Bastien Nocera
80bc0d7c79 linux: Add test for "wireless_status" sysfs attribute 2023-07-03 17:15:07 +02:00
Bastien Nocera
babe81a871 linux: Add headset hotplug test 2023-07-03 16:07:46 +02:00
Bastien Nocera
b83b0ff568 linux: Add test for duplicate USB/Unifying devices 2023-04-18 12:31:12 +02:00
stuarthayhurst
8356dd01d6 tests: Add test for siblings overwiting good type guesses 2023-04-17 15:02:44 +02:00
Bastien Nocera
5dbd51c47a linux: Add test about headset devices detection 2023-04-15 15:17:13 +02:00
Bastien Nocera
fa58832bd1 tests: Fix charging test in test_battery_state_guessing
Wait longer for the state guessing to actually kick in, 25 seconds was
too slow and we were getting the old state instead.
2023-04-15 14:10:23 +02:00
Bastien Nocera
40828daa8b tests: Remove assertion in test_battery_state_guessing
The history clearing doesn't work, see:
https://gitlab.freedesktop.org/upower/upower/-/issues/230
2023-04-15 13:17:59 +02:00
Bastien Nocera
5db1bce65f tests: Fix discharge rates in test_battery_state_guessing
up_device_battery_estimate_power() expects a charge/discharge rate of
0.5W to be significant, but the existing code yielded a rate of
-0.000240W.

Fix the units so that the amount of change in energy_now is at least
1W/s converted to µWh.
2023-04-15 12:16:19 +02:00
Bastien Nocera
b3c439ab4a linux: Fix getting properties in assertDevs()
Now that device loop is fixed, we also need to fix the D-Bus object
path for the devices themselves to match what UPower generates so
we can get its properties.

As we iterate over the expected array, the elements are the basenames
of those object paths. Reconstruct the full object paths by prepending
/org/freedesktop/UPower/devices/
2023-04-14 13:50:49 +02:00
Bastien Nocera
32e2cd5eb9 linux: Fix broken assertDevs() device loop
The test uses a generator to get the list of basenames for the devices:
names = (n.split('/')[-1] for n in devs)

Unfortunately, using that "names" varible will consume the generator,
and our array will be lost.

When passing a device dictionary, this code:
print(sorted(names))
print(sorted(names))
will yield:
['battery_hidpp_battery_0']
[]

Save the sorted array, and use that to test for properties equality.
2023-04-14 13:50:19 +02:00
Bastien Nocera
810c1214a5 linux: Test fix for warning when a duplicate device appears
Make the Bluetooth device appear first.
2023-02-28 14:14:59 +01:00
Bastien Nocera
32b0e098a1 linux: Test adding Bluetooth devices after daemon start
As is usually the case in reality, as bluez must be started for
Bluetooth devices to be able to connect.
2023-02-28 14:14:59 +01:00
Bastien Nocera
b6143527ef linux: Fix dbusmock addition of fake battery
We need to send the InterfacesAdded signal in case upower is already
started, so it can properly keep track of the interesting bluez devices.
2023-02-28 13:42:36 +01:00
Bastien Nocera
b7e406d9f9 linux: Add test for Logitech HID++/Bluetooth deduplication
This tests for the device-removed g_warning(), following the Alias
property on bluez devices, and the "Unhandled key" warnings.
2023-02-27 14:39:36 +01:00
Bastien Nocera
3bf5a095ac linux: Fix device paths in tests
add_device() doesn't need the full sysfs path if there's a parent,
otherwise this section of the path will be duplicated.
2023-02-27 14:12:39 +01:00
Bastien Nocera
b2cbf01090 linux: Test for "present" sysfs attribute handling 2023-02-21 15:19:46 +01:00
Maciej S. Szmigiero
dcb4600b33 enumerator-udev: also check for an idevice on "usb" subsystem
Commit 1550d50f ("linux: Remove "usb" subsystem match") broke detection of
some idevices, since it left just the "usbmisc" subsystem match while some
idevice / kernel combinations (at least an iPhone 11 on a 6.0 kernel) don't
present any such udev usbmisc devices.
However, they do present "usb" subsystem ones, so add this match back.

Leave idevice detection also for the "usbmisc" match since that's what the
original (known working) code before aforementioned commit did - it is
possible that it is required for some kernel / idevice combinations.
2022-10-29 15:32:04 +02:00
Bastien Nocera
b1edcc7cbb linux: Test whether BT mice get de-duplicated 2022-09-05 17:47:08 +02:00