Commit graph

149 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
ad514c3775 test-fpi-device: Fix file description 2020-01-17 19:44:52 +01:00
Marco Trevisan (Treviño)
3c5b7f8ea6 test-fpi-device: Add more probe tests with errors 2020-01-17 19:44:52 +01:00
Marco Trevisan (Treviño)
b09df0e40a test-fpi-device: Add tests for error message creation 2020-01-17 19:44:50 +01:00
Marco Trevisan (Treviño)
027ac8d843 fpi-device: Only mark a device as closed if the operation succeeded
We may fail during the close phase, in such case the device should not be
marked as closed.
2020-01-17 19:03:33 +01:00
Marco Trevisan (Treviño)
b3a4c2cf9a fpi-device: Improve logging and testing on report/complete 2020-01-17 19:03:33 +01:00
Marco Trevisan (Treviño)
9f3272f296 test-fpi-device: Use smart pointer to handle CB data 2020-01-17 18:43:01 +01:00
Marco Trevisan (Treviño)
0889ec20a8 fp-device: Remove confusing success parameter on FpMatchCb
This was added as alias to the error check, but given we're passing to the
callback both the error and the match itself, we can just avoid adding an
extra parameter that could be confusing (as may imply that the matching
happened).

Also clarify the documentation and ensure that the match value is properly
set in tests.
2020-01-16 20:24:42 +01:00
Benjamin Berg
29a13a9b4a tests: Add error reporting tests based on virtual driver
We were not testing the image device error reporting functions yet
inside libfprint (fprintd already had such tests). Add tests to make
sure we catch errors earlier.
2020-01-13 17:58:41 +01:00
Benjamin Berg
7aaeec3d6a tests: Check that missing identify/verify result returns error 2020-01-13 14:37:39 +01:00
Benjamin Berg
0b8e2d6074 tests: Add tests for the verify/identify retry cases 2020-01-13 14:37:39 +01:00
Benjamin Berg
0c582230f3 tests: Add tests for the early reporting mechanism
This adds tests to check whether the verify/identify early reporting
mechanism is behaving correctly.
2020-01-13 14:37:39 +01:00
Benjamin Berg
829fb9f873 device: Add early match reporting to sync API
This makes the sync/async APIs more similar again. It also simplifies
testing as otherwise we would need the async methods for some tests.
2020-01-13 14:37:39 +01:00
Benjamin Berg
4d5c34e11a Introduce an early reporting mechanism for verify and match
It is a good idea to report match results early, to e.g. log in a user
immediately even if more device interaction is needed. Add new _full
variants for the verify/identify functions, with a corresponding
callback. Also move driver result reporting into new
fpi_device_{identify,verify}_report functions and remove the reporting
from the fpi_device_{identify,verify}_complete calls.

Basic updates to code is done in places. Only the upekts driver is
actually modified from a behaviour point of view. The image driver code
should be restructured quite a bit to split the reporting and only
report completion after device deactivation. This should simplifiy the
code quite a bit again.
2020-01-13 14:37:39 +01:00
Benjamin Berg
8292c449f7 device: Better define ownership passing for results
Some things were odd with regard to the ownership of passed objects. Try
to make things sane overall, in particular with the possible floating
FpPrint reference.
2020-01-13 13:45:05 +01:00
Benjamin Berg
ba07c74006 tests: Always add dummy skipping tests
Just hiding tests that cannot be run does not seem like the best idea.
So add dummy tests that are skipped, to denote that we could test more
than we actually do (even if it is just for drivers that are not
enabled).
2020-01-08 18:40:41 +01:00
Benjamin Berg
6716359fe8 tests: Add more notes about umockdev recording creation
umockdev recordings are usually not usable as is. Add some notes to the
README to summarise what kind of changes may be required.
2020-01-08 18:14:06 +01:00
Benjamin Berg
c27a4faeca elan: Add umockdev based test
Unfortunately, the timeout handling cannot be simulated properly. This
also adds a workaround in the driver to not consider it a protocol error
if this happens.
2020-01-08 18:14:06 +01:00
Benjamin Berg
19f239ce61 tests: Add some frame assembly unit tests 2020-01-08 18:14:06 +01:00
Benjamin Berg
f91e5310bb tests: Set MESON_SOURCE_ROOT to source root not build root 2020-01-02 13:46:46 +01:00
Benjamin Berg
5b17eda011 Prefix internal properties/signals with fpi- and annotate them
We prefixed them with fp- which is not as obvious as fpi-. Also,
explicitly mark them as private and to be skipped in the GObject
Introspection annotatinos.

Warning: FPrint: (Signal)fp-image-device-state-changed: argument object: Unresolved type: 'FpiImageDeviceState'
2019-12-18 12:25:06 +01:00
Marco Trevisan (Treviño)
0566f82219 tests: Add a reference to the enrolled print before returning it 2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño)
c8e1269f61 cleanup: Use FPI prefix for all the internal enum types 2019-12-17 14:38:19 +01:00
Benjamin Berg
2af0531994 tests: Fix stack corruption in FpiSsm test
Using a function with a void return value for a g_timeout_add is not a
good idea after all.
2019-12-17 14:32:59 +01:00
Benjamin Berg
1d1c39c234 tests: Ensure objects are free'ed at the end of tests
The objects may not be garbage collected otherwise.
2019-12-16 10:20:49 +00:00
Marco Trevisan (Treviño)
42b1deaeea tests: Add unit tests for fpi-ssm
Verify that the state machine actions are done as we expected, being the
main tool for drivers, better to check that is done as we expect.
2019-12-14 17:20:47 +01:00
Marco Trevisan (Treviño)
f31b8483d4 tests: Add fpi device tests
Verify drivers operations simulating a fake driver to check that the lib
interaction is correct.
2019-12-14 17:20:46 +01:00
Marco Trevisan (Treviño)
324258bc8c tests/meson: Support unit-tests non depending on virtual driver
Since tests depending on the fake device don't depend on virtual-image
driver anymore, let's change the way we organize the things, by putting
everything in the test lib, but enabling unit-tests depending on what they
depend on.
2019-12-14 17:20:46 +01:00
Marco Trevisan (Treviño)
f578ebe82d test-device-fake: Add fake test driver to verify fpi functions 2019-12-14 17:20:46 +01:00
Marco Trevisan (Treviño)
b4c3756ab0 tests: Add fp-device basic unit tests
Use the virtual image device as base for now, while the new setup allows
to create easily fake device drivers without including the driver in
libfprint itself and test all the fpi_device functionalities.
2019-12-14 17:20:45 +01:00
Marco Trevisan (Treviño)
da46f53e82 tests: Add basic unit tests for fp-context
Link the tests with the private library using an utils library that will
be useful to share other tests functions
2019-12-14 17:20:45 +01:00
Marco Trevisan (Treviño)
43a8c909bf fp-context: Use an env to define a whitelist of drivers to enable
This avoids that we pick unwanted drivers when running the tests in a
machine that has some supported device attached.
2019-12-14 17:20:45 +01:00
Marco Trevisan (Treviño)
d01bb41b7c tests/meson: Set the typelib env var only if we have introspection 2019-12-10 19:20:21 +01:00
Benjamin Berg
f404a69b73 tests: Test finger removal after minutiae scan completion 2019-12-04 19:49:07 +00:00
Benjamin Berg
50a837573d tests: Update helper functions for new virtual-image features
This also changes the code to keep the connection open and adds
automatic mainloop iteration to ensure the driver processes the request.
This is important so we will not deadlock when we send multiple
requests.
2019-12-04 19:49:07 +00:00
Benjamin Berg
ae285e790d tests: Fix image writing on big endian
The code tried to only write the RGB bytes of FORMAT_RGB24, however, the
in-memory layout is different on big-endian which would result in the
wrong bytes being written.

Fix this by simply also writing the byte we do not care about.
2019-12-04 13:23:08 +01:00
Benjamin Berg
8cc0fd321f assembling: Use fixed point for image assembly
Using floating point causes architecture dependent results due to
accuracy/rounding differences. It is not hard to switch to fixed point,
and while this does cause quite different rounding errors, the
difference is small.

Fixes: #200
2019-11-28 20:41:45 +00:00
Benjamin Berg
a7541b1f76 tests: Fix endianness issue in test suite
The test suite needs to compare greyscale images and was picking an
undefined byte in the pixel data on big-endian. Select a byte that works
on any endian instead.

See: #200
2019-11-28 20:41:45 +00:00
Marco Trevisan (Treviño)
545af23536 tests: Use a loop for generating drivers tests and use suites
So we can just run drivers tests with --suite=drivers
2019-11-27 21:40:44 +01:00
Marco Trevisan (Treviño)
c9216cf96c tests: Add setup mode to run tests using valgrind
In such case we need to ignore the python errors, so including a suppression
file when using --setup=valgrind.
2019-11-27 21:40:43 +01:00
Marco Trevisan (Treviño)
53713c0098 tests: Add 'gdb' setup to run tests using gdb
When using --setup=gdb the tests will be running using gdb, however this
as per meson limitation allows only running a test when using verbose mode.
2019-11-27 21:40:43 +01:00
Marco Trevisan (Treviño)
222c33ec32 virtual-image: Re-run the test using the defined wrapper if any
In case a LIBFPRINT_TEST_WRAPPER is defined, execute again the script using
the same python processor but using the passed wrapper command.
2019-11-27 21:40:43 +01:00
Marco Trevisan (Treviño)
19a50cfdc3 umockdev-test: Make possible to use a wrapper to run tests
Support LIBFPRINT_TEST_WRAPPER env variable to run tests with a wrapper.
2019-11-27 21:40:43 +01:00
Marco Trevisan (Treviño)
099fa9f005 meson: Use preferred syntax everywhere
Meson files are normally using 4-spaces to indent and functions use first
parameter on the same line while others at next indentation level, not
following the parenthesis indentation.

So adapt libfprint to follow the meson standard.
2019-11-25 18:59:46 +01:00
Benjamin Berg
9b37256175 tests: Only run tests when introspection bindings are build
The tests cannot work without the introspection bindings. So put them
into a corresponding if branch and also add the correct dependency on
libfprint_typelib for them to be run.
2019-11-20 13:53:45 +01:00
Benjamin Berg
951d482bc6 tests: Skip umockdev based test for missing dependencies
Also print a warning if umockdev-run is too old. Note that we still try
to run the unreliable tests as they are still useful for development.
2019-11-20 13:53:45 +01:00
Vincent Huang
6a1e7103f6 synaptics: Put sensor into lower power mode after closing 2019-11-20 13:53:45 +01:00
Benjamin Berg
b92e6d6acd tests: Add testing to the synaptics driver
As the driver is not a normal image device, we need to add a custom
script to test it. Note that the ioctl dump must also be manually
modified unfortunately as the state is tracked incorrectly for the
device by umockdev-record.
2019-11-20 13:53:45 +01:00
Benjamin Berg
538038867b tests: Add umockdev based testing
Initially only the vfs5011 driver is tested. Please note that these
tests will be unreliable before umockdev 0.13.2.

See also https://github.com/martinpitt/umockdev/pull/92
2019-11-20 13:53:45 +01:00
Benjamin Berg
6e25a27870 tests: Add basic unit test based on virtual_image device 2019-11-20 13:53:45 +01:00