Commit graph

61 commits

Author SHA1 Message Date
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
Bastien Nocera
89a3baad69 linux: Add test without the "mouse" legacy node
Which currently fails. Which is what will happen with an older UPower on
a newer kernel with that removed.
2017-01-24 17:45:58 +01:00
Bastien Nocera
e8e20ac64a linux: Parent Bluetooth mouse test devices properly 2017-01-24 17:45:58 +01:00
Bastien Nocera
c015e6b21e linux: Fix deprecation warning in integration-test 2015-09-23 16:14:40 +02:00
Cosimo Cecchi
da7517137e integration-test: fix typo in interface name
The display device will use the org.freedesktop.UPower.Device interface,
not org.freedesktop.UPower.
2015-07-29 13:37:11 +01:00
Bastien Nocera
1e4f711df4 Revert "linux: Work-around broken battery on the Onda v975w"
This reverts commit 31b2b8ec78.

A better work-around has been found kernel-side:
https://bugzilla.kernel.org/show_bug.cgi?id=83941

We'll need to add some code to ignore the incorrect "time left" values
though.
2015-07-16 11:26:17 +02:00
Marc Deslauriers
6c706ff033 linux: Properly detect bluetooth mice and keyboards that are HID devices
https://bugs.freedesktop.org/show_bug.cgi?id=90222
2015-05-20 14:56:27 +02:00
Bastien Nocera
31b2b8ec78 linux: Work-around broken battery on the Onda v975w
Until https://bugzilla.kernel.org/show_bug.cgi?id=83941 is fixed,
this allow to have a bit more information than "0% battery" displayed in
the UI.

https://bugs.freedesktop.org/show_bug.cgi?id=90214
2015-04-28 13:19:48 +02:00
Martin Pitt
90082ec5d4 Linux integration tests: Split big tests into several smaller ones
This is better design to catching regressions and problems in a more
pin-pointed fashion. This also avoids having to restart the umockdev testbed
due to changing the environment variables with stop/start_daemon().
2014-09-02 18:43:33 +02:00
Martin Pitt
01ab81233f Linux integration tests: Fix error handling for Python 3.4
Python 3.4 changed the TestCase._outcome semantics, adjust accordingly.
2014-09-02 17:19:08 +02:00
Martin Pitt
e5bd3e80f3 Linux integration tests: Fix crash if there is no session D-BUS
This can happen in CI environments without a desktop session.
2014-09-02 15:57:09 +02:00
Bastien Nocera
cfbd05deb3 linux: Remove is_docked from the integration test 2014-05-07 09:47:45 +02:00
Martin Pitt
22da1a0bc5 linux: Clamp percentage for overfull batteries
Some batteries report energy > energy_full and a percentage ("capacity"
attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well
as to avoid setting an out-of-range property which would then become 0%.

https://launchpad.net/bugs/1240673
2013-10-22 10:02:51 +02:00
Bastien Nocera
0741e5b591 linux: Finish "fixing" the UPS test case
Update the expected warning levels to match, and add a big
fat FIXME for the test case itself. That's not how UPSes work,
or how UPower is expected to work.
2013-10-18 18:43:50 +02:00
Bastien Nocera
aa8fafca9e linux: Fix tests for "OnLowBattery"
Replace them all with WarningLevel tests.

Note we current crash when adding a UPS, in test_ups_ac.
2013-10-18 17:49:07 +02:00
Bastien Nocera
b3ee72144e linux: Add TODO item for the GetCriticalAction binding 2013-10-18 17:46:41 +02:00
Bastien Nocera
720680d685 linux: get_properties_sync() doesn't exist anymore 2013-10-18 17:37:10 +02:00
Bastien Nocera
fa1fb8404f linux: Add helper to get DisplayDevice property
In the integration tests.
2013-10-18 17:36:00 +02:00
Bastien Nocera
af930df8b1 linux: Add new definitions
Proxy paths, and enumeration from the current API.
2013-10-18 16:58:48 +02:00
Bastien Nocera
bd3a57fe04 daemon: Replace "on-low-battery" property
With "warning-level" property.
2013-10-14 10:42:56 +02:00
Bastien Nocera
1ee642e705 daemon: Remove obsolete features 2013-10-14 10:42:55 +02:00
Martin Pitt
9975526265 Linux integration tests: Fix PEP8 errors 2013-10-08 17:19:27 +02:00
Martin Pitt
2aa24aeed2 Linux integration tests: Fix pyflakes errors
Drop a lot of unused variables
2013-10-08 17:13:06 +02:00
Martin Pitt
e89d047680 Linux integration tests: First test case for library
Start testing the client-side library through gobject-introspection.

This covers https://bugs.freedesktop.org/show_bug.cgi?id=70283
2013-10-08 17:06:14 +02:00
Martin Pitt
5c132c683d linux: Track power_supply devices by name only instead of full sysfs path
The full native sysfs path of wireless HID battery devices contains a lot of
jitter like USB tree layout or sequence numbers which change after every resume
from auto-suspend. Plus, there are kernel bugs which don't give proper remove
events for those: http://bugzilla.kernel.org/show_bug.cgi?id=62041

As device names within the same subsystem must be unique anyway, and we only
use the device name for constructing the D-BUS object path, only consider the
device name for the device list native → upower object lookup table, i. e. in
up_native_get_native_path().

This fixes the "A handler is already registered for <battery>" assertion crash
if a bluetooth device comes back from auto-suspend. This fixes the
test_bluetooth_mouse_reconnect() test case, drop the expected failure.

https://launchpad.net/bugs/1112907
2013-09-27 09:46:02 +02:00
Martin Pitt
6f9ccd35b3 Linux integration tests: Test reconnect of bluetooth mouse
When these power down, we don't get remove uevents for the original
power_supply devices from the kernel, but instead we get new devices with a
different sequence number, but the same name:

  UDEV  [6408.025124] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:12/0005:0D62:0558.0001/power_supply/hid-00:0f:f6:6d:8e:c0-battery (power_supply)
  UDEV  [23785.90673] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:12/0005:0D62:0558.0002/power_supply/hid-00:0f:f6:6d:8e:c0-battery (power_supply)

This circumvents the existing "treating add as change" check (as the native
path is different) but breaks later on when building and registering the
(supposedly) new object:

  ERROR **: Failed to register GObject with DBusConnection: org.freedesktop.DBus.Error.ObjectPathInUse A handler is already registered for /org/freedesktop/UPower/devices/mouse_hid_000ff66d8ec0_battery

This reproduces https://launchpad.net/bugs/1112907
2013-09-20 11:59:37 -05:00
Martin Pitt
960d4413f9 Linux integration tests: Run tests under umockdev-wrapper
Don't just cover the test upowerd by umockdev-wrapper, but the test suite
itself as well, so that we can send uevents.

Do this by re-execing the test suite under umockdev-wrapper if it's not already
running under it.
2013-09-20 11:58:18 -05:00
Martin Pitt
09d41eb759 Linux integration tests: Add bluetooth mouse and keyboard
These should be detected with their proper type (5/6, not 2) and not count as
powering the system, i. e. their PowerSupply property should be False.

This reproduces https://launchpad.net/bugs/1153488
2013-09-06 14:25:31 +02:00
Martin Pitt
5867d5432b Linux integration tests: Verify device types
Check "Type" property for AC (1), battery (2), and UPS (3).
2013-09-03 10:17:20 +02:00
Martin Pitt
440ee20f01 Linux integration tests: Verify that UPSes and batteries are power supplies
So far we only have done that for ACs.
2013-09-03 09:35:04 +02:00
Shih-Yuan Lee (FourDollars)
ba363c8bbe linux: Allow valid UTF-8 encoded string
Signed-Off-By: Martin Pitt <martin.pitt@ubuntu.com>
2013-09-03 09:24:06 +02:00
Martin Pitt
d070b4b83b Linux integration tests: add test for vendor/product/serial strings
This exercises the non-ASCII character filtering and the three cases "valid
ASCII", "valid UTF-8", and "invalid/unprintable ASCII".
2013-09-03 09:21:12 +02:00
Martin Pitt
9b142071d3 Linux integration tests: add test for temperature
Add test case for exporting the temperature, as added in commit 03f67aa.

https://bugs.freedesktop.org/show_bug.cgi?id=68338
2013-08-23 08:52:45 +02:00
Martin Pitt
03f67aabfe trivial: In test case of previous commit, check OnLowBattery property 2013-08-23 08:45:57 +02:00
Martin Pitt
07b95b8e27 linux: Fix batteries which report capacity, but not energy/charge
Many Android devices only export charge_full and capacity, but not charge_now
or energy_now. In that case, directly read the percentage (from the capacity
attribute) and calculate current energy from that.

Thanks to Seth Forshee for the original patch!

https://bugs.freedesktop.org/show_bug.cgi?id=68337
2013-08-23 08:31:20 +02:00
Martin Pitt
da066045e4 integration-test: Always run on a fake system bus
Drop the two modes depending on whether or not the test gets run as root or
not. Set up a fake system bus and always use that. This also eliminates the
need for upowerd's --test option.

Drop usage of dbus-launch, as this leaves dbus-daemon running after the tests.
Use GioTestDBus instead, which cleans up properly.
2013-02-20 14:59:56 +01:00