Commit Graph

150 Commits

Author SHA1 Message Date
3c8ac241b8 tests: Try to show backtrace when killed by SIGTERM
This means that we may manage to show a backtrace if meson kills the
test process due to a timeout.
2021-07-30 23:52:00 +02:00
f398d09b23 device: Delete existing print in EnrollStart
gnome-control-center expects to be able to re-enroll an existing print
when calling EnrollStart without deleting it first. As such, implicitly
delete the existing print rather than throwing an error.

Ideally, we'll change the API, but we need to give API users time to
adjust to the world.
2021-07-01 12:59:11 +02:00
d7da04fa4b tests: Check storage is cleared if device does not support listing
On the first enroll, the storage must be cleared. Check that this is the
case for the first enroll but not the second.
2021-06-25 16:56:49 +02:00
7f2b5fe7ff device: Avoid clearing storage when we can garbage collect
If the device supports listing prints, then we can do more targeted
deletes once the storage runs out. As such, do not try to clear the
storage on first enroll (therefore allowing dual boot setups to work to
a limited degree).
2021-06-25 15:52:41 +02:00
f44233461f device: Clear storage before enrolling the first print
Clear the device storage before we enroll the first print. At that
point, we know that the storage should be completely empty and we have
no way of deleting "garbage" prints later if the device does not support
listing prints.
2021-04-30 14:41:12 +02:00
4f4b0d5f11 tests/fprintd: Check that garbage collecting works on duplicated print 2021-04-02 00:22:16 +02:00
aae37304e5 tests/fprintd: Cleanup FPrintdVirtualStorageDeviceTests
Avoid repeating the same things multiple times
2021-04-02 00:22:16 +02:00
8869b8296f tests/fprintd: Check an error is thrown if trying to re-enroll a finger 2021-04-02 00:22:16 +02:00
41086ac4c6 tests/fprintd: Test enroll multiple prints with duplicates 2021-04-02 00:22:16 +02:00
4e075ba491 tests/fprintd: Repeat enroll tests with virtual device with no storage
No storage-device does not support identification so we need to try this
case as well
2021-04-01 23:09:30 +02:00
e8622b3e63 device: Support enrolling on devices with no identification support 2021-04-01 23:09:29 +02:00
5785dc65b4 device: Add duplicate checking during enroll
Always do an identify step before starting an enroll. If we find an
existing print, delete or throw an error depending on what is
appropriate.

Doing this ensures that we should not get duplicate prints system wide.
This means we will be able to identify the user that is trying to log
in. But more importantly, we need to do these checks for MoC devices,
which always run "identify" against all device stored prints rather than
the passed gallery.
2021-04-01 22:47:42 +02:00
0af8cf1d56 tests/fprintd: Use intermediate timeouts based on default setup 2021-03-03 19:51:07 +01:00
3a05589685 utils/delete: Add ability to delete single user fingerprints by finger name
Each user can now be followed by an `-f`/`--finger` parameter that when
available will be used to delete a single fingerprint for the user.

Add tests
2021-03-03 19:51:07 +01:00
bb722a0373 tests/fprintd: Add tests for 'verify' utility 2021-03-03 19:49:07 +01:00
022ee1a4c5 tests/fprintd: Add test for the enroll utility using virtual device commands 2021-03-03 19:49:07 +01:00
aba0f0a714 tests/fprintd: Add test for device error during Claim 2021-03-03 19:49:07 +01:00
b1a218d56a tests/fprintd: Add tests to check errors when using the 'delete' tool 2021-03-03 19:49:07 +01:00
59c2dc5df2 tests/fprintd: Use output checker in FPrintdUtilsTest 2021-03-03 19:49:07 +01:00
f4d2e905bd tests/fprintd: Use storage device for more tests
It's quicker to use for various operations, so better to use it
2021-03-03 19:49:07 +01:00
6f355797f8 device: Throw a NoEnrolledPrints error if trying to delete a device with no prints
Adjust tests accordingly
2021-03-03 19:49:07 +01:00
8da1b5e7f5 device: Do not set the device in verification state if we've errored
During VerifyStart we may return early if there are no enrolled prints.
In such case we don't require the verification to be stopped if we're
using identification, but in the verification case we may leave the
device into the verification state.

So ensure we only set the device current state only when we're about to
start it.

Add tests ensuring those cases
2021-03-02 17:15:14 +01:00
1511eb93ea device: Do not list invalid prints as enrolled
The user may have some invalid prints saved (like the ones enrolled with
fprintd 1) in the storage, this lead to list such prints as enrolled but
they're actually not valid.

So load the prints to ensure that those are of the valid type instead of
just discovering them.

We may make just store.discover_prints to be aware of this, but this
would break some assumptions we do in tests, so better to go this way.
2021-03-02 17:15:14 +01:00
a04a60cd8e tests/fprintd: Add better tests for ListEnrolledFingers in unclaimed state 2021-03-02 17:15:14 +01:00
02bd36d8d9 tests/fprintd: Check that we can't try to release a device while closing 2021-01-27 18:18:57 +01:00
b92f39be3d tests/fprintd: Add test to check errors during release 2021-01-27 18:18:57 +01:00
b46aba6fb2 tests/fprintd: Ensure stored print deletion error has higher prio than device error 2021-01-27 18:18:57 +01:00
2b81184b42 device: Fail with any non-zero return value on storage print_data_save()
When saving the prints we use g_file_set_contents under the hood and in
case return its error code that is a positive value.

So in such case we don't fail if we have a write failure at the end of
the enrollment.

While we could ensure in file storage to always return a negative value,
it's always better to ensure that is has to be 0 when we didn't get an
error.

Add a test checking for this case.
2021-01-27 17:52:05 +01:00
2af0e6407a tests/fprintd: Make prints not writable by turning them into directories
Given that the storage will use unlink to delete them, we'll just fail
while writing them, in this way we'll be able to run such tests also in
CI.
2021-01-27 17:52:05 +01:00
9a39f1fde8 tests/fprintd: Verify the case we can't delete prints from device 2021-01-27 17:52:05 +01:00
1deb1e2044 tests/fprintd: Add ability to force-kill the daemon if we're fine to hang 2021-01-27 15:55:48 +01:00
75989bd2be tests/fprintd: Compute timeout for daemon-stop phase depending on platform 2021-01-26 20:52:29 +01:00
3df730faeb tests/fprintd: Make possible to store duplicated prints for an user
Since we so far we had no duplicated-check for prints in fprintd an user
may have enrolled the same print for multiple accounts or even for
different fingers, so we need to simulate this case.

Given that fprintd may not allow to enroll duplicated prints soon, it's
better to just copy the storage value so that we simulate a duplicated
enrollment in the past.
2021-01-26 20:52:29 +01:00
f2514f43f6 tests/fprintd: Return more data about the enrolled prints
It may be useful to be able to associate them to their user
2021-01-26 20:52:29 +01:00
8ef255a3bd tests/fprintd: Add option to claim device for user on enroll_image 2021-01-26 20:52:29 +01:00
15b41aa7c2 tests/fprintd: Add function and tests to enroll multiple users fingers/images
Allow to enroll multiple data in a single shot so that we don't have to
do it for each user, and add a test that uses it to match each possible
combination.
2021-01-26 20:52:29 +01:00
bec42959ad tests/fprintd: Add an utility function to easily check for match/no-match 2021-01-26 20:52:29 +01:00
5e00b01cf1 tests/fprintd: Ensure that the selected finger is emitted as expected 2021-01-26 19:41:53 +01:00
b3bf4ac1a3 tests/fprintd: Unset the values we monitor for results on wait_for_result
We need to ensure those assume the value we want after waiting
2021-01-26 19:41:48 +01:00
4aa70fb6c6 tests/fprintd: Reimplement the tests relying on specific image driver features
Some tests were delaying VerifyStop by not reporting the finger status
in the image driver, we can do the same using sleeps in the virtual
device driver, so let's reimplement such calls
2021-01-26 16:56:31 +01:00
d2c8a383e6 tests/fprintd: Implement device removal via the 'UNPLUG' command 2021-01-26 04:38:09 +01:00
9a85bfa57f tests/fprintd: Ensure the scan type can be changed and is notified 2021-01-25 19:50:46 +01:00
7f2133cc79 tests/fprintd: Verify using no-identification device with 'any' finger 2021-01-25 19:50:46 +01:00
8491d35eef tests/fprintd: Verify that we can enroll with one stage only 2021-01-25 19:50:46 +01:00
32ae65fae6 tests/fprintd: Reduce the enroll stages when possible to avoid operations 2021-01-25 19:50:46 +01:00
8799fd296a tests/fprintd: Repeat all relevant tests with the storage device
Now that FPrintdVirtualStorageDeviceBaseTest is a
FPrintdVirtualDeviceBaseTest we can implement the needed `send_*`
functions that we use in the tests in order to get easily an interface
that can be used to repeat all the tests we've already written with the
new virtual device.

To do this, we've only to create new test classes that use the
FPrintdVirtualStorageDeviceBaseTest as main base class and that
also implement the test class.
2021-01-25 19:50:40 +01:00
0b80245e8a tests/fprintd: Inherit storage tests from FPrintdVirtualDeviceBaseTest
We can avoid lots of duplication
2021-01-25 18:18:40 +01:00
72a2504fc4 device: Wait device to finish for a timeout before completing VerifyStop
When a device has reported the verification status the client should
call VerifyStop to stop the device, however this under the hood may lead
to a premature cancellation, causing the device not to react as expected
in case the finger is still on the sensor or in case it may return to us
some errors that we may want to handle (like the data-missing one).

So, in case we are about to stop the verification and the operation is
still in process, wait for a maximum timeout before proceed to the
cancellation.

However, while waiting, the action may be also cancelled because of a
call to Release() or because the client vanished, and in such case we
have to ensure that the current invocation is saved for being invoked by
stoppable_action_completed() when callback will return. That will also
unset it, and that's a clear indication for us that it has been already
consumed, and thus that we can just return doing nothing else.

Fixes: #100
2021-01-25 18:18:40 +01:00
8d8c181f31 tests/fprintd: Check that errors happening after we got a result are ignored 2021-01-25 18:18:40 +01:00
cce9551c98 tests/fprintd: Be more flexible in accepting async results with exceptions
Some tests may have different behaviors depending on the CPU load when
using parallel tests, so async results could arrive in different order.

Then we need to accept multiple results:
  - A specific exception has to happen all the times
  - One of the accepted exception has to happen all the times
  - No exception or one of the allowed exception may happen

Depending on the test, use one of the possible strategies.
2021-01-25 18:18:40 +01:00