Commit graph

96 commits

Author SHA1 Message Date
Dylan Van Assche
3acbedca26 tests: Test inhibitor lock for critical action
Inhibitor lock should be taken between the critical
action notification and the execution of the critical action.

Requires python-dbusmock > 0.23.1, test is skipped on lower versions.

python-dbusmock in the CI is installed from git and bumped version
to 0.23.2 until a new release is available.
2021-08-17 14:31:25 +02:00
Bastien Nocera
26c90728c3 linux: Add test for touchpads being tagged as mice
udev adds both tags to touchpads, so replicate that behaviour.
2021-08-10 10:47:37 +00:00
Pablo Correa Gómez
d8482bc767 tests: Add test for non-default low level 2021-06-30 10:56:25 +02:00
Philipp Zabel
b64902eed2 tests: Add a test case for batteries with zero power draw
Make sure that the issue reported in #7 and #44 is fixed.
The mocked battery has a zero power_now attribute and a non-zero legacy
current_now attribute on purpose, to detect if upowerd tries to read
current_now if the power_now value is small.
2021-06-17 18:15:01 +02:00
Bastien Nocera
96ea5b3521 linux: Make unknown Bluetooth devices appear as generic
Make Bluetooth devices for which we can't guess the "kind" or form
factor be "generic Bluetooth" devices, rather than "unknown" devices.

That should make it clearer in UIs that the devices are Bluetooth rather
than connected to the computer somehow.

Closes: #137
2021-06-17 13:47:33 +02:00
Bastien Nocera
2ab63bd81b linux: Fix typo in test comment 2021-06-17 12:00:08 +02:00
Bastien Nocera
15fb868cf1 linux: Ignore "capacity" sysfs on Macs
capacity is supposed to be the running battery percentage, not a
representation of its current state of the factory capacity (which
isn't something that's ever shown in Linux or macOS).

Use the new "ignore-system-percentage" property to work-around that
problem.

Closes: #141, #103
2021-06-17 11:13:58 +02:00
Marijn Suijten
8e5b1d6b46 tests: Add test cases for Bluetooth device classes 2021-02-02 18:23:19 +01:00
Marijn Suijten
15329e840c tests: Move BlueZ battery setup into helper function 2021-02-02 18:22:42 +01:00
Marijn Suijten
62d7c08289 tests: Convert unpacked tuple constants to range() 2021-02-02 18:22:42 +01:00
Bastien Nocera
dde6f714ea linux: Set update-time for BlueZ devices
When the battery percentage for a BlueZ device changes, change the
update-time so that the charge history is somewhat useful.
2021-01-18 22:11:32 +01:00
Bastien Nocera
67eefa17dd lib: Add "Touchpad" device type 2020-12-16 13:09:04 +01:00
Bastien Nocera
6ff9ee702e linux: Fix umockdev link in test 2020-06-18 16:13:18 +02:00
Bastien Nocera
d2917c0c71 tests: Add a keyboard/mouse combo device test 2020-05-05 16:11:45 +02:00
Bastien Nocera
72b85b8c13 lib: Add "Pen" device type
So we can track the battery information for powered tablet pens, rather
than labelling them as tablets.
2019-10-24 12:50:26 +02:00
Bastien Nocera
a1a437d7b1 linux: Add test for Appearance property being missing
Similar test to the test_bluetooth_le_mouse() one, but without an
appearance property.
2019-10-23 13:32:08 +02:00
Bastien Nocera
27541a6130 linux: Remove unused code in test suite
There's no need to create a udev device, the metadata comes from bluez.
2019-10-23 13:32:08 +02:00
Bastien Nocera
fccc47114a linux: Use symbolic names for device types in test suite 2019-05-09 11:17:02 +02:00
Bastien Nocera
f16a8feea0 linux: Add gaming input type to the test suite
The enum member was missing.
2019-05-09 11:17:02 +02:00
Bastien Nocera
8ead05234c linux: Add test for Logitech unknown device races
Check that external devices which show up as "battery" types have their
capacity_level correctly read, and that the device's type will be
correctly read after an input node is attached.
2019-05-07 11:44:22 +00:00
João Paulo Rechi Vita
c4e561f54d integration-test: Test mapping pending-charge to fully-charged 2018-12-18 17:19:01 -08:00
João Paulo Rechi Vita
f3f4c6e0b4 integration-test: Test DisplayDevice pending-charge
Test relaying the pending-charge state to the DisplayDevice. This commit
adds three tests: only one battery pending-charge, one battery
pending-charge and another one discharging, and one battery
pending-charge and another one charging.
2018-11-14 12:57:15 -08:00
João Paulo Rechi Vita
eb02827015 integration-test: Define PENDING_CHARGE and PENDING_DISCHARGE states
Add definitions for UP_DEVICE_STATE_PENDING_CHARGE and
UP_DEVICE_STATE_PENDING_DISCHARGE.
2018-11-14 12:57:15 -08:00
Bastien Nocera
1c9892d763 linux: Add test for MacBook uevent behaviour
See https://gitlab.freedesktop.org/upower/upower/issues/56
2018-06-19 13:01:52 +00:00
Bastien Nocera
096121740f linux: Add a test for Logitech HID++ charging states
The current power_supply support in the kernel will advertise an unknown
capacity when a device is being charged. This tests this state as well
as the expected behaviour when the device is fully charged.

https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-19 03:40:40 +02:00
Bastien Nocera
7771a57b81 linux: Add test for Bluetooth LE battery support
https://bugs.freedesktop.org/show_bug.cgi?id=92370
2017-11-02 15:37:39 +01:00
Miroslav Sustek
212599f0ee daemon: Fix critical action after resume from hibernate
The take_action_timeout_cb() function returns G_SOURCE_REMOVE which
makes GLib destroy the timeout. However the action_timeout_id
stayed != 0 so when warning level turned to "action" again the daemon
assumed that the timeout is already set and did nothing.
(It only logged: "Not taking action, timeout id already set")

https://bugs.freedesktop.org/show_bug.cgi?id=87791
2017-09-21 17:10:19 +02:00
Bastien Nocera
fb9f19c3b5 linux: Add test for crash when battery has funky name
https://bugs.freedesktop.org/show_bug.cgi?id=93095
2017-09-08 17:59:42 +02:00
Bastien Nocera
2ef05c4220 linux: Grab model name from device if unavailable from battery
The "model_name" and "serial_number" information that upower exports for
batteries that supply a laptop or UPS are supposed to be that of the
battery. But that's very unlikely to happen for devices, such as
wireless mice, keyboards or joysticks.

Look for a sibling input device if a device battery does not contain
model information so as to avoid generic names in UIs.

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-09-04 14:05:15 +02:00
Bastien Nocera
320cc87811 linux: Detect joysticks as gaming input devices
https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:21 +02:00
Bastien Nocera
1dc2b96eec linux: Add test for wireless joypad connected via USB
Mostly for the type of device rather than the connections.

https://bugs.freedesktop.org/show_bug.cgi?id=102493
2017-08-31 16:21:14 +02:00
Bastien Nocera
499d05b837 all: Add BatteryLevel property
Export approximate battery levels that devices can use, exported by
the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values.

This avoids bizarrely accurate values showing up in UIs when we only
have ok/warning levels of accuracy in some cases.

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 16:33:38 +02:00
Bastien Nocera
4f9230900b lib: Add more members to UpDeviceLevel struct
Those levels will not be used to cover warning levels, but approximate
battery levels that devices can use, exported by the kernel as
POWER_SUPPLY_CAPACITY_LEVEL_* values.

See linux/power_supply.h

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 14:18:10 +02:00
Bastien Nocera
6b14798281 linux: Add support for "capacity_level" attribute
Some devices, such as a number of wireless Logitech unifying devices
don't have a precise battery level reporting, and use the Linux
POWER_SUPPLY_CAPACITY_LEVEL_* values.

This minimal fix matches the levels against approximate percentage
values. This is good enough to make the Logitech T650 report battery
again when using the kernel HID++ battery support.

https://bugs.freedesktop.org/show_bug.cgi?id=100359
2017-04-06 14:18:10 +02:00
Christian Kellner
c237298297 integration-test: Fix path for unparented device
Paths supplied to testbed.add_device() are relative to /sys/devices
already and therefore must not start with /sys/devices.

This does not change the result of the test.

https://bugs.freedesktop.org/show_bug.cgi?id=100539
2017-04-06 14:16:15 +02:00
Christian Kellner
90aec997ce integration-test: enable running from JHBuild
https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-25 18:08:50 +01:00
Christian Kellner
b292ee2035 integration-test: Check NoPollbatteries is followed
The NoPollbatteries option should disable battery polling. Create
a config file with 'NoPollBatteries=true' and ensure we don't get
polling setup for the virtual battery.

https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-25 18:08:35 +01:00
Christian Kellner
a4d7d84b34 integration-test: Add test for refresh after sleep
This also tests suspending and resuming polling as a
by-product.

https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-25 18:07:57 +01:00
Bastien Nocera
c885c4c886 integration-test: Add test for unparented input devices
The test would fail without the fix from commit 86e5237, and succeed
with it.
2017-03-24 17:16:32 +01:00
Bastien Nocera
a2eecff867 integration-test: Use symbolic names for device types
Instead of using comments to explain the magic values.
2017-03-24 17:03:36 +01:00
Christian Kellner
d69121971f integration-test: add get_critical_action() test
https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-24 15:46:40 +01:00
Christian Kellner
305a24a115 integration-test: use dbusmock to mock logind
Derive from dbusmock.DBusTestCase and add {start,stop}_logind
to enable tests that need logind.

https://bugs.freedesktop.org/show_bug.cgi?id=99763
2017-03-24 15:46:40 +01:00
Bastien Nocera
4be1efe819 integration-test: HID++ mouse is a mouse 2017-03-24 15:19:12 +01:00
Bastien Nocera
12d34b8a8b Revert "linux: Disable crashing test"
This reverts commit 8aff086b48.

The crash is fixed in umockdev 0.8.13
2017-01-26 11:35:34 +01:00
Bastien Nocera
d5c05515a8 linux: Add a serial number to mouse battery test
Which will fail, as the device code doesn't even try to get a serial
number.
2017-01-24 18:08:24 +01:00
Bastien Nocera
efe589a8ce linux: Add a test for HID++ devices 2017-01-24 17:48:47 +01:00
Bastien Nocera
8aff086b48 linux: Disable crashing test
Filed as an issue against umockdev:
https://github.com/martinpitt/umockdev/issues/53
2017-01-24 17:45:58 +01:00
Bastien Nocera
f711bc3865 linux: Always stop daemon when started in tests 2017-01-24 17:45:58 +01:00
Bastien Nocera
c5d1660b5c linux: Allow running upowerd under valgrind in tests 2017-01-24 17:45:58 +01:00
Bastien Nocera
caf53bd982 linux: Parent the keyboard device correctly in tests 2017-01-24 17:45:58 +01:00