Commit graph

37 commits

Author SHA1 Message Date
Benjamin Berg
a78ee60390 test: Properly wait for idle handler after uevents
The state aggregation test requires an idle handler to run, which can be
a bit unreliable as it may or may not run twice.

Force running it twice and add code to wait for it to complete. Do so
properly by waiting for the correct log messages rather than sleeping so
that everything is ordered nicely while not slowing down the test a lot.

Closes: #193
2022-06-09 12:38:34 +02:00
Benjamin Berg
c6a851d798 test: Add test for mice that have keys
These should not be detected as keyboards.
2022-06-08 12:55:59 +02:00
Benjamin Berg
1587b37707 test: Test all possible inputs for daemon state aggregation
This adds a test that checks all possible inputs for the battery state
aggregation. Not all states are actually tested in this case, as some
states may be handled through state inference and others might not be
well defined.
2022-06-07 16:07:03 +02:00
Benjamin Berg
792fc7bb1b supply: Consistently use 90% threshold to consider a battery full 2022-06-03 10:36:02 +02:00
Benjamin Berg
c330351937 test: Disable systemd v251 sysfs verification
The umockdev code to disable it by setting the variable does not
propagate through python. Set the variable here until there is a more
permament solution available.
2022-05-25 16:57:21 +02:00
Benjamin Berg
66eb9b9d7a test: Stop processes using cleanup function
Using tearDown is brittle, as an assertion will stop it from running
through completely. So move cleanup into a helper that is called via
addCleanup for logind and bluez.
2022-05-20 14:41:52 +02:00
Benjamin Berg
41bceac6ef test: Only assert daemon log is closed if daemon is started 2022-05-20 14:37:23 +02:00
Benjamin Berg
6d947c0532 test: Do not redirect helper stdout
There is no need to do so, so drop the redirection.
2022-05-20 14:37:02 +02:00
Benjamin Berg
f1c00e50c2 test: Allow daemon to take 5 seconds for shutdown
It seems like shutdown can take more than 2 seconds on some slow
systems. So increase to 5 seconds which hopefully is long enough.

Closes: #188
2022-05-20 14:35:23 +02:00
Benjamin Berg
c64b020f99 test: Turn off buffering when executing directly
It can be a bit unepxected if results are not printed immediately, so
turn off buffering. We could possibly also reopen sys.stdout, but this
is good enough in many cases.
2022-05-20 14:35:11 +02:00
Benjamin Berg
267f5ea8d3 linux: Fix exception check when on test daemon shutdown
subprocess.Popen.wait throws subprocess.TimeoutExpired not TimeoutError.

Related: #188
2022-05-19 11:45:55 +02:00
Benjamin Berg
ab08a4188f linux: Add test verifying sibling tracking cleanup works
This tests that the code to track siblings is working correctly and that
it will clean up the entries stored in the cache when a device
disappears.
2022-05-17 10:40:58 +02:00
Benjamin Berg
6db0627aaa linux: Add wacom tests 2022-05-16 16:42:30 +02:00
Benjamin Berg
76a99a7638 linux: Add helper to assert devices and properties
Just to make it a bit nicer to do assertions on devices and properties.
2022-05-16 16:40:00 +02:00
Benjamin Berg
275db91afd linux: Do not create intermediate proxy to fetch properties
There is no need for an intermediate proxy object, adding it just
results in extra overhead that is not needed.
2022-05-16 16:40:00 +02:00
Benjamin Berg
2151d7c0e4 linux: Test that line-power events don't cause battery polling
This verifies that we do not start polling the battery if we got a
spurious event related to a line-power supply.
2022-05-16 09:14:07 +00:00
Benjamin Berg
90c84ea95c linux: Ensure clean shutdown after tests
Instead of just killing upower, try to send SIGTERM for a clean
shut-down. Kill the process if it doesn't quit within two seconds, and
check that the service exits cleanly.
2022-05-12 14:42:35 +02:00
Benjamin Berg
76b4c31ee9 linux: Add non-hid parent to hidpp tests
While not needed currently, there is a discussion to ignore the "hid"
subsystem parents when searching for siblings. Add in appropriate
parents to the tests so that such a change will not result in a failure.
2022-05-12 11:16:42 +02:00
Benjamin Berg
565b3531d6 linux: Test changes after BT HID power_supply subtree move
This causes an add that we ignore, after that we should still see
updates from the device (and the add itself should trigger an update).

Verify that this works by setting the capacity to 20.
2022-05-11 10:16:50 +02:00
Benjamin Berg
3c520fb590 linux: Use OutputChecker to inspect daemon log
This also means the daemon log is stored even when succeeding, making it
a bit easier to inspect tests overall.
2022-05-10 11:06:18 +02:00
Benjamin Berg
b9bf475459 linux: Enable fatal-warnings for most tests 2022-05-10 11:06:18 +02:00
Benjamin Berg
7f846bcee6 linux: Provide temporary history directory in tests
This avoids a warning when history files need to be saved.
2022-05-10 11:06:18 +02:00
Benjamin Berg
f2da5678f3 linux: Create an empty configuration file for every test
This avoids a warning during startup, allowing enabling fatal-warnings
in more cases.
2022-05-10 11:06:18 +02:00
Benjamin Berg
5fd3c9988c linux: Always start logind during test
This avoids a warning on daemon startup and is a step towards turning on
fatal-warnings most of the time.
2022-05-10 11:06:18 +02:00
Benjamin Berg
37f8fa2699 linux: Test fast-polling stops after 5 seconds
In some cases we fast-poll for 5 seconds after a uevent. Check that this
type of fast-polling stops when appropriate.
2022-05-10 11:06:18 +02:00
Benjamin Berg
3243ff2a56 supply: Use new polling infrastructure
This means we do the fast-repoll and normal polling with the same method
(no timeout registrations within the supply code anymore).
2022-05-10 11:06:18 +02:00
Benjamin Berg
1550d50f20 linux: Remove "usb" subsystem match
The hiddev driver has been in the "usbmisc" subsystem since kernel 3.7.0
or so. As such, we can simply drop the "usb" subsystem from our matches
at this point.
2022-04-01 11:47:41 +02:00
Benjamin Berg
d113f62727 history: Delay saving history even on low power
Otherwise we flush out the data much more often than needed. With this
change, we'll also wait up to 5 seconds even on lower power. Loosing 5s
of data shouldn't be too bad, and it may prevent additional disk writes.

But, more importantly, we need to deferre writing the data to a later
main loop iteration. If we did not do this, then we have an
write-amplification scenario where the history is written at least 4
times instead of once.

Closes: #150
2022-01-27 14:48:51 +01:00
Benjamin Berg
94af9d6f3d linux: Make test compatible with older dbusmock versions
The changes from 37b6d4b039 ("linux: Fix Bluetooth tests for
python-dbusmock changes") require a not-yet-released dbusmock version.
Simply catch the error and fall back to adding the properties in order
to be compatible with both old and new dbusmock versions of the bluez
service.
2022-01-27 13:11:45 +01:00
Bastien Nocera
1fdc0824b6 lib: Implement up_client_get_devices_async() 2022-01-23 23:26:33 +01:00
Bastien Nocera
95618dfad4 linux: Remove libtool support from test suite 2022-01-23 23:04:26 +01:00
Bastien Nocera
8f893964a2 tests: Add test for up_client_async*() functions 2022-01-21 22:35:28 +01:00
Bastien Nocera
37b6d4b039 linux: Fix Bluetooth tests for python-dbusmock changes 2022-01-18 14:19:40 +01:00
Bastien Nocera
0847d0c674 linux: Make sure ChargeCycles is unknown in more cases
In the case where the kernel returns "0" as the cycle_count, we need to
assume this also means that the number of cycles is unknown.
2021-11-02 12:15:28 +01:00
Bastien Nocera
27709f6af4 tests: Add ChargeCycles test 2021-09-13 12:55:36 +02:00
Bastien Nocera
bdd2711c2b linux: Postpone importing libraries for tests
They're not needed and might not be available when we're trying to list
the included tests.
2021-09-07 17:16:42 +02:00
Bastien Nocera
20cb2e9610 linux: Rename integration test script
Add the python suffix.
2021-09-07 11:42:17 +02:00
Renamed from src/linux/integration-test (Browse further)