libfprint/tests
Benjamin Berg d683b271d4 ssm: Remove delayed action GCancellable integration
Unfortunately, the implementation was not thread safe and was not
sticking to the thread local main context.

In addition to this, it is not entirely clear to me how this API should
behave. The current approach is to simply cancel the transition with the
state machine halting in its current state. Instead, it could also make
sense for cancellation to cause the state machine to return a
G_IO_ERROR_CANCELLED.

As such, simply remove the feature for now. If anyone actually has a
good use-case then we can add it again.
2021-04-28 22:16:37 +02:00
..
aes3500 tests: Add trailing newline to busname/devname sysfs attributes 2021-01-21 11:28:47 +00:00
elan tests: Add trailing newline to busname/devname sysfs attributes 2021-01-21 11:28:47 +00:00
goodixmoc device: Expose supported features publicly as FpDeviceFeature 2021-04-12 22:14:06 +02:00
nb1010 Add nb1010 driver 2021-04-12 20:24:13 +02:00
synaptics device: Expose supported features publicly as FpDeviceFeature 2021-04-12 22:14:06 +02:00
vfs0050 tests: Add trailing newline to busname/devname sysfs attributes 2021-01-21 11:28:47 +00:00
vfs301 tests: Add trailing newline to busname/devname sysfs attributes 2021-01-21 11:28:47 +00:00
vfs5011 tests: Add trailing newline to busname/devname sysfs attributes 2021-01-21 11:28:47 +00:00
vfs7552 Added test for vfs7552 2021-03-12 11:29:43 +01:00
capture.py device: Expose supported features publicly as FpDeviceFeature 2021-04-12 22:14:06 +02:00
hwdb-check-unsupported.py ci: Add check that wiki and generator are in sync 2021-01-20 17:21:38 +01:00
meson.build tests: Use native meson exec wrapper in test setups instead of our script 2021-04-13 19:38:58 +02:00
README.md tests: Mention permissions in test docs 2020-12-17 13:59:53 +01:00
test-device-fake.c fpi-device: Add FpiDeviceFeature flags to FpDeviceClass 2021-04-12 22:14:06 +02:00
test-device-fake.h test-fpi-device: Verify device action error operations 2020-01-17 19:44:52 +01:00
test-fp-context.c tests: Add support for creating other virtual readers 2021-01-20 23:21:04 +01:00
test-fp-device.c device: Deprecate fp_device_{supports,has}_* functions for has_feature 2021-04-12 22:14:06 +02:00
test-fpi-assembling.c nbis: Apply patch to fix scan-build warnings 2020-05-07 14:22:02 +00:00
test-fpi-device.c device: Deprecate fp_device_{supports,has}_* functions for has_feature 2021-04-12 22:14:06 +02:00
test-fpi-ssm.c ssm: Remove delayed action GCancellable integration 2021-04-28 22:16:37 +02:00
test-generated-hwdb.sh test-generated-hwdb: Just use diff to compare for being more informative 2021-01-21 15:55:44 +00:00
test-utils.c virtual-device: Add non-image mock devices 2021-01-20 23:21:41 +01:00
test-utils.h virtual-device: Add non-image mock devices 2021-01-20 23:21:41 +01:00
umockdev-test.py tests: Mark umockdev-test.py executable 2021-01-13 14:45:07 +01:00
unittest_inspector.py tests: Make meson be aware of the single python unit tests 2020-02-10 11:41:40 +01:00
valgrind-python.supp tests: Add setup mode to run tests using valgrind 2019-11-27 21:40:43 +01:00
virtual-device.py tests: Use native meson exec wrapper in test setups instead of our script 2021-04-13 19:38:58 +02:00
virtual-image.py tests: Use native meson exec wrapper in test setups instead of our script 2021-04-13 19:38:58 +02:00

umockdev Tests

umockdev tests use fingerprint devices mocked by umockdev toolchain.

This document describes how to create a 'capture' test: a test that captures a picture of a fingerprint from the device (mocked by umockdev) and compares it with the standard one.

Other kinds of umockdev tests could be created in a similar manner.

'Capture' Test Creation

A new 'capture' test is created by means of capture.py script:

  1. Create (if needed) a directory for the driver under tests directory:

    mkdir DRIVER

  2. Prepare your execution environment.

    In the next step a working and up to date libfprint is needed. This can be achieved by installing it into your system. Alternatively, you can set the following environment variables to run a local build:

    • export LD_PRELOAD=<meson-build-dir>/libfprint/libfprint-2.so
    • export GI_TYPELIB_PATH=<meson-build-dir>/libfprint

    Also, sometimes the driver must be adapted to the emulated environment (mainly if it uses random numbers, see synaptics.c for an example). Set the following environment variable to enable this adaptation:

    • export FP_DEVICE_EMULATION=1

    Run the next steps in the same terminal.

  3. Find the real USB fingerprint device with lsusb, e.g.:

    Bus 001 Device 005: ID 138a:0090 Validity Sensors, Inc. VFS7500 Touch Fingerprint Sensor

    The following USB device is used in the example above: /dev/bus/usb/001/005.

    For the following commands, it is assumed that the user that's running the commands has full access to the device node, whether by running the commands as root, or changing the permissions for that device node.

  4. Record information about this device:

    umockdev-record /dev/bus/usb/001/005 > DRIVER/device

  5. Record interaction of capture.py (or other test) with the device:

    umockdev-record -i /dev/bus/usb/001/005=DRIVER/capture.ioctl -- python3 ./capture.py DRIVER/capture.png

    Files capture.ioctl and capture.png will be created as the result of this command.

  6. Add driver's name to drivers_tests in the meson.build.

  7. Check whether everything works as expected.

Note. To avoid submitting a real fingerprint, the side of finger, arm, or anything else producing an image with the device can be used.

Possible Issues

umockdev-record aggressively groups URBs. In most cases, manual intervention is unfortunately required. Often, drivers do a chain of commands like: A then B each with a different reply. However, umockdev-record could create a file like this:

A
 reply 1
 reply 2
B
 reply 1
 reply 2

In that case, records must be re-ordered:

A
 reply 1
B
 reply 1
A
 reply 2
B
 reply 2

Other changes may be needed to get everything working. For example the elan driver relies on a timeout that is not reported correctly. In this case the driver works around it by interpreting the protocol error differently in the virtual environment (by means of FP_DEVICE_EMULATION environment variable).