Commit graph

19 commits

Author SHA1 Message Date
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
Martin Pitt
a1fe30811d Linux integration tests: check energy vs. charge
So far the test cases only covered drivers which reported energy (µWh). Add
checks that the Energy* properties are correct, and add a test case for drivers
which report charge (µAh).
2011-05-14 14:39:16 +02:00
Martin Pitt
7c617ba6f1 Run Linux integration tests in "make check"
If possible, run the tests under dbus-launch to ensure that there is a private
D-BUS session bus. This allows the tests to work in e. g. a clean package build
environment, and also avoids messing with the real user session bus.
2011-04-26 11:50:36 +02:00
Martin Pitt
e1f4aa38de Add integration test suite for Linux
Add src/linux/integration-test: This is a Python unittest based test suite
which provides methods for building a sandbox sysfs tree, runs upowerd
in it, and checks for correct properties.

As it is really hard to provide fake uevents, this currently only works for
properties which do not depend on dynamic system changes, i. e. you can
currently only check the status after coldplugging.

However, this already provides enough possibilities for functionality and
regression testing, and exposes some bugs with determining the "OnBattery"
property under certain conditions like the ones described in
<https://bugs.freedesktop.org/show_bug.cgi?id=24371>.

If any of the tests fails, the daemon log will be printed to stderr for easier
debugging.

With the previous commit that adds "upowerd --test", we can also run
the integration tests as non-root. If they are called as root, start upowerd
normally on the system bus, otherwise on the session bus with --test.
2011-04-26 11:50:36 +02:00