Commit graph

53 commits

Author SHA1 Message Date
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
Martin Pitt
7105ed8a04 integration-test: Move to using umockdev
Setting $SYSFS_PATH does not work any more with recent libudev versions, our
homwbrew sysfs sandbox building limits us to coldplug tests only. umockdev
works with both old and new libudevs and can also emulate uevents for future
hotplugging tests.

Skip the test if umockdev is not available, so that check and distcheck don't
bail out.
2013-02-20 14:38:25 +01:00
Martin Pitt
66f8f80023 Add test case for previous commit
Add test case for a battery which reports the current energy, but only the full
charge (no energy_full). This reproduces
https://bugs.freedesktop.org/show_bug.cgi?id=60104
2013-01-31 10:24:35 +01:00
Martin Pitt
55569ac40f integration-test: fail on CRITICALs
Crash the daemon on any CRITICAL message, and also set WARNING and CRITICAL
messages to be fatal on the client side. On the server side we might have some
legitimate warnings, such as failing to load the config file from
/usr/local/etc (if you build a tree without passing correct --sysconfdir
options, etc.).

This exposes the current CRITICAL the daemon raises at startup. As with that
the daemon never starts up, fix the "wait for the daemon" loop to time out
after 10 seconds.
2012-06-14 13:07:30 +02:00
Martin Pitt
6bb3623d46 src/linux/integration-test: Fail gracefully if GI is not available 2011-12-05 10:44:35 +01:00
Martin Pitt
492a8c2283 Revert "src/linux/integration-test: Do not crash on absent _outcomeForDoCleanups"
This reverts commit 14761c09d2.

The real reason for the failure is that Makefile.am calls the script with
"python" which is Python 2, but we need Python 3.
2011-12-05 10:30:14 +01:00
Martin Pitt
14761c09d2 src/linux/integration-test: Do not crash on absent _outcomeForDoCleanups
unittest.TestCase unfortunately does not have any public API to check whether
a test case succeeded, so we use the private self._outcomeForDoCleanups. This
does not seem to exist every time, so avoid a crash if it doesn't.
2011-12-05 10:24:37 +01:00
Martin Pitt
d92aec6520 src/linux/integration-test: Port to Python 3 2011-11-11 15:19:04 +01:00
Martin Pitt
75d8c449cd src/linux/integration-test: Fully port to GI
Move from static glib to GI GLib module, to avoid mixing static and dynamic
bindings.

This fixes the tests to work with pygobject 3.
2011-09-05 14:38:31 +02:00