Commit graph

111 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
3d6fb15b5c virtual-device: Add API to change current finger status 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
f0443ba2f3 virtual-device: Add support for reporting device Retry "errors" 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
546f35132c tests/virtual-device: Use FPrint.DeviceError values to send errors 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
170924ee4f test-generated-hwdb: Just use diff to compare for being more informative 2021-01-21 15:55:44 +00:00
Benjamin Berg
63bfaf4f60 tests: Add trailing newline to busname/devname sysfs attributes
libusb 1.0.24 now expects busnum/devnum to be \n terminated. Update the
device descriptions accordingly.

https://github.com/martinpitt/umockdev/issues/115
2021-01-21 11:28:47 +00:00
Benjamin Berg
8ded064e65 tests: Add test based on the new virtual devices
Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-01-20 23:21:41 +01:00
Benjamin Berg
3f7a638eed virtual-device: Add non-image mock devices
There are two variants one with storage and identify support and the
other without storage.

It implements the following commands:
 * INSERT id
 * REMOVE id
 * SCAN id
 * ERROR error-code
 * LIST (returns saved print)

The INSERT/REMOVE/LIST commands are only available in the storage
driver. The SCAN command emulates presenting a finger.

These commands can be send ahead of time, and will be queued and
processed when appropriate. i.e. for INSERT/REMOVE that is immediately
when possible, for SCAN/ERROR processing is delayed.

The LIST command is always processed immediately.

Note that only a single command can be send per socket connection and
the command must be send in a single message. The socket will be closed
after the command has been processed.

Co-authored-by: Bastien Nocera <hadess@hadess.net>
Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-01-20 23:21:41 +01:00
Benjamin Berg
5df14206d8 tests: Add support for creating other virtual readers
Add support for creating more virtual readers.

Co-authored-by: Bastien Nocera <hadess@hadess.net>
2021-01-20 23:21:04 +01:00
Marco Trevisan (Treviño)
533180a2e6 data: Use auto-generated but hardcoded autosuspend hwdb file
This solves various problems:
 1. It stays the same also if some drivers have been disabled
 2. It uses a stable path for being imported by systemd
 3. It is still checked for its validity by tests
 4. It can be auto-generated using a simple command
2021-01-20 21:17:42 +01:00
Marco Trevisan (Treviño)
99c269b3fe meson: Do not support drivers known to fail in Big Endian archs
When building in big endian architectures some device tests will fail,
as per this we're pretty sure that most of the drivers are not ready
to work in big-endian architectures.
Since we're aware of this, better to just stop supporting those drivers
instead of having each distribution to handle the problem.

So, add a list of supported drivers that is filled depending the
architecture type we're building on. Keep continue building those
drivers since we want to at least test-build them, but do not expose
them as libfprint drivers, so if a device in the system uses any of them
will be ignored.

At the same time, we keep track of the problem, so that we can fix the
drivers.

Related to #236
2021-01-20 18:29:05 +01:00
Benjamin Berg
284f6f1ef8 ci: Add check that wiki and generator are in sync
Add a new test that checks that the unsupported list is not out of date.
As the wiki can be edited at any time, add this as a further optional
check into the CI pipeline.
2021-01-20 17:21:38 +01:00
Benjamin Berg
55a2bb5536 Generate a hwdb instead of udev rules
We only use the rules/hwdb to enable auto-suspend. So, instead of
shipping our own rules, we can just use the existing autosuspend rules
and ship a hwdb that sets the appropriate flag.

Closes: #336
2021-01-19 14:21:44 +01:00
Benjamin Berg
16095a21fd tests: Add check that no supported device is whitelisted 2021-01-19 13:47:21 +01:00
Benjamin Berg
6d4b498dae tests: Mark umockdev-test.py executable
This makes it easier to execute it for out-of-tree tests.
2021-01-13 14:45:07 +01:00
Aris Lin
a6c2509ca8 synaptics: check if current firmware supports during device probe
Fixes: #239 and #351
2021-01-12 18:49:36 +08:00
boger
8254b9e99e goodixmoc: support finger status report
there is no specific API for report finger status,
finger needed status is set when captrue sample cmd send, once cmd receive correct,
finger is pressing on sensor.
2021-01-05 13:36:17 +00:00
Bastien Nocera
d6ca8ff2b0 tests: Fix typo in comment 2020-12-17 13:59:53 +01:00
Bastien Nocera
b1b20f8ab9 tests: Mention permissions in test docs 2020-12-17 13:59:53 +01:00
Bastien Nocera
7e2b89791e tests: Fix typo in instructions 2020-12-17 13:59:53 +01:00
Marco Trevisan (Treviño)
c02771d16b goodixmoc: Add async identification test using on-owned deseralized prints
This simulates what fprintd does
2020-12-09 13:30:37 +01:00
Benjamin Berg
28ba6a0de9 test-fpi-device: Do deep comparison of gallery
The gallery needs to be copied, as such we must do a deep comparison
instead of comparing the pointers. We also can't do the comparison
afterwards, as the gallery is owned by the operation and that operation
is finished already.
2020-12-09 11:47:33 +01:00
Marco Trevisan (Treviño)
faade91c39 test-fpi-device: Add function to create fake FpPrint's and galleries 2020-12-09 11:47:33 +01:00
Marco Trevisan (Treviño)
6ca8441df9 umockdev-tests: Don't fail when trying to save other errors 2020-12-09 10:26:58 +01:00
Marco Trevisan (Treviño)
8112da0358 umockdev-tests: Still raise an error when storing the exception output
Otherwise we won't ever fail
2020-12-09 10:26:58 +01:00
Marco Trevisan (Treviño)
b5496fd257 fp-device: Ensure finger status is set to proper type on property getter
Finger status is a flag not an enum.

Add tests.
2020-12-04 12:15:22 +00:00
Marco Trevisan (Treviño)
12b0120a3d test-fpi-device: Always check the return values for the API calls
Ensure that the return value of the API calls match the expected one,
as we need to ensure that it also matches with the error/no-error case.
2020-12-02 16:28:36 +00:00
Benjamin Berg
1b5dd0057f tests: Add device removal test
This tests all relevant scenarios of device removal, i.e.:
 * device is not open
 * device is currently closing
 * device is open and idle
 * device is currently opening
 * device is open and active

The test ensures that in all scenarios the following holds true:
 * device "removed" signal is only emitted after the action completes
 * context "device-removed" signal is only emitted after the device has
   been closed

Note that the "opening" case is special. Here we confirm that a success
from "open" will not be overriden by a FP_DEVICE_ERROR_REMOVED error, in
order to correctly signal that the internal device state is open and it
needs to be closed.
2020-11-23 17:47:03 +01:00
Benjamin Berg
0051ff6352 device: Treat devices as closed even after a close failure
We require the close call, but as the underlying transport layer is
gone, it will generally just return an error.

In principle, it makes sense to think of close as a function that always
succeeds (i.e. it makes no sense to try again). Should the device be in
a bad state, then a subsequent open() will simply fail.
2020-11-23 17:47:03 +01:00
Marco Trevisan (Treviño)
0c56e0de6d synaptics: Report finger status to libfprint
The inactivation in case would be set back by libfprint
2020-11-07 13:23:30 +00:00
Marco Trevisan (Treviño)
893ff9c033 fp-image-device: Report finger status changes to the device
While the image device has its own finger status tracking, we use a simpler
version as public data information, so let's just report the finger-on/off
and when a finger is expected to the parent class.

Verify that this happens as expected using the virtual-image class
2020-11-07 13:23:30 +00:00
Marco Trevisan (Treviño)
42e4506b1b fp-device: Add finger-status property
It can be used by drivers to report the state of the finger on sensor
2020-11-07 13:23:30 +00:00
Benjamin Berg
ae3baadcf9 tests: Add a new test for vfs301
See: #320
2020-11-05 15:55:09 +01:00
Benjamin Berg
4f29a32da8 tests: Store temporary directory on failure
It is not very useful to just delete the data again after a failure, as
it might be useful for debugging. Just store it into an "errors"
subdirectory of the PWD in the hope that this is a sane location.

Note that it'll error out if the directory already exists, but that
should be acceptable in all cases. i.e. it won't exist in the CI and
developers can just wipe the directory.
2020-11-05 15:52:54 +01:00
Benjamin Berg
b03f9a502a tests: Remove old README-umockdev file
It has been superseeded by README.md.
2020-10-14 12:39:10 +02:00
Benjamin Berg
62edf93958 tests: Add AES3500 test case
Thanks for Federico Cupellini for providing test samples.
2020-09-29 10:35:48 +02:00
boger.wang
3962372f47 tests: add identify test for driver goodixmoc
add identify ioctl file, modify custom.py add identify test
2020-09-14 09:55:55 +00:00
boger.wang
c85f385191 tests: add test for goodixmoc driver 2020-09-01 16:39:06 +08:00
Benjamin Berg
390611d5c9 tests: Improve the instructions to create new umockdev captures
Thanks to Evgeny for much of the work and suggestions from Boger Wang.

Co-authored-by: Evgeny Gagauz <evgenij.gagauz@gmail.com>
2020-06-05 15:03:38 +00:00
Benjamin Berg
685052c605 tests: Add test for vfs0050 driver
This test is based on data captured by Evgeny.

Co-authored-by: Evgeny Gagauz <evgenij.gagauz@gmail.com>
2020-06-05 15:03:38 +00:00
Benjamin Berg
4f0b0fa526 tests: Ensure FpDevice checks enrolled prints for completeness
Enrolled prints need to have their type set. FpDevice should ensure that
is the case when a driver returns a print back.
2020-06-05 14:48:57 +00:00
Benjamin Berg
7f58556011 tests: An enrolled print needs to have a type set 2020-06-05 14:48:57 +00:00
Benjamin Berg
e4f9935706 Uncrustify with newer version 2020-06-02 11:56:19 +00:00
Benjamin Berg
a464f602ca nbis: Apply patch to fix scan-build warnings
Apply the newly added patch to the checkout.
2020-05-07 14:22:02 +00:00
Benjamin Berg
422fc5facf tests: Add unused annotation
The variables exist for memory management but are unused otherwise. Tag
them as such.
2020-05-07 14:22:02 +00:00
Benjamin Berg
6d542edf8a test: Remove unused initialisers
Make the static analysis happy.
2020-05-07 14:22:02 +00:00
Benjamin Berg
8d4d56b1f1 tests: Annotate a few variables as unused
These solely exist for memory management, but the static analysis
complains.
2020-05-07 14:22:02 +00:00
Marco Trevisan (Treviño)
41e05b1133 test-fpi-device: Don't compare error pointers that have been cleared
During verify/identify complete we replace the error pointer that the driver
returned with another error we created, after clearing that one.

However, when we initialize a new error the compiler may reuse the same
allocation of the cleared one, and this might lead to a test failure.

So, don't be so fragile and ignore the pointer check
2020-04-15 14:19:53 +02:00
Bastien Nocera
d0751ae06b tests/elan: Fix typos 2020-04-14 13:51:02 +02:00
Marco Trevisan (Treviño)
e7ff4f705c tests: Import FPrint only during execution not when parsing
The unittest_parser script would try to import FPrint gi module, but it
would fail as per the fact that none is installed yet, so make sure that
we don't load any FPrint module until we try to actually run the tests
2020-03-27 21:19:09 +00:00
Benjamin Berg
f4ec816a6b tests: Cast to correct pointer type rather than gpointer
This is just a small cleanup
2020-02-19 16:42:30 +01:00