Commit graph

297 commits

Author SHA1 Message Date
fossdd
cda9ab61fa build: Add tests meson option 2025-04-02 16:56:22 +00:00
Marco Trevisan (Treviño)
7b16491029 build: Do not use deprecated function to get pkg config variable 2025-02-20 20:09:47 +00:00
Marco Trevisan (Treviño)
f7b26a518f build: Do not use deprecated meson object functions 2025-02-20 20:09:47 +00:00
Marco Trevisan (Treviño)
5f73ca1e3f build: Do not use deprecated hacks in newer meson 2025-02-20 20:09:47 +00:00
Marco Trevisan (Treviño)
609a246e97 build: Add check argument to run_command() calls 2025-02-20 20:09:47 +00:00
Marco Trevisan (Treviño)
5e6af4d56d device: Return enroll-duplicate error on FP_DEVICE_ERROR_DATA_DUPLICATE 2025-02-20 20:15:17 +01:00
Marco Trevisan (Treviño)
798f608033 device: Map the removed and too-hot device errors to disconnected 2025-02-20 20:15:17 +01:00
Marco Trevisan (Treviño)
afb1011e44 device: Add enroll-too-fast error 2025-02-20 20:15:17 +01:00
Marco Trevisan (Treviño)
244be2511f device: Generalize verify-too-fast error
It's not just related to swipe devices, so let's make it more generic
2025-02-20 20:15:17 +01:00
MrNerdHair
b64a4f7fbd Handle new FP_DEVICE_RETRY_TOO_FAST error code 2025-02-13 23:55:33 +00:00
Marco Trevisan (Treviño)
7e7f5028d4 tests/pam: Call overridden parent methods
This is the expected practice when overriding
2024-09-05 04:07:04 +02:00
Marco Trevisan (Treviño)
64ad4b7fc9 tests/pam: Call parent class tearDown class method
Tests were passing but we were also hanging in some platforms (as debian
and ubuntu) because the resources were not released.

So fix this by ensuring that we call the parent class tearDown function
when required
2024-09-05 04:07:04 +02:00
Marco Trevisan (Treviño)
e429e68246 tests/fprintd: Make tests pass with libfprint 1.94.7 2024-04-04 03:13:40 +02:00
Marco Trevisan (Treviño)
d065842604 tests/fprintd: Close opened pipes on tests cleanup 2024-04-04 03:13:40 +02:00
Fabio Bas
b04d4eb3e8 Permit build without pam_wrapper 2022-05-24 16:00:02 +02:00
Benjamin Berg
27b618a93e tests: Hide intermediate error in output checker
The output checker raises from an exception handler. Add the appropriate
"from None" to hide that intermediate exception.
2022-05-10 09:50:10 +02:00
Benjamin Berg
ae04fa9897 tests: Fix dbusmock AddDevice calls to include optional argument
The dbusmock code checks that all parameters wanted by the dbus
signature are given. As such, pass them, even though the parameters is
optional on the python side.
2022-05-03 10:05:58 +00:00
Benjamin Berg
b440acb57d tests: Use dbusmock start_system_bus instead of GLib server 2021-09-15 15:06:06 +00:00
Benjamin Berg
0cf0fea902 tests: Better cleanup helper processes and objects
We were leaking the bus connections for the proxy objects. Also, now the
subprocesses will be forcefully killed at shutdown.
2021-09-15 15:06:06 +00:00
Benjamin Berg
b3d6bf0825 tests: Set G_MESSAGES_DEBUG=all for daemon as it is needed
Otherwise executing the test script outside of the meson environment
will fail as the inhibitor test relies on being able to parse the log.
2021-09-15 15:06:06 +00:00
Benjamin Berg
fc65055279 device: Always report selected finger if there is only one
If the user specified "any" finger, then we would mirror this back even
if there is only one finger available. Change it so that we act as if
that finger was passed explicitly, meaning we use the "verify" method
and also send the signal for the selected finger accordingly.
2021-09-15 15:00:14 +00:00
Benjamin Berg
e4c155d5b8 tests: Give fprintd some more time to be ready
While the delay inhibitor is grabbed almost immediately, this can be
slow enough to not have happened immediately after the bus name has been
registered. Add a generous timeout to prevent issues.
2021-08-25 15:27:26 +02:00
Benjamin Berg
717a919996 tests: Make class cleanup more robust
Use addClassCleanup rather than doing cleanup in tearDownClass, which
may not be called in all cases.
2021-08-25 15:22:42 +02:00
Benjamin Berg
e6fc854a9a tests: Use addCleanup to stop polkitd 2021-08-25 15:19:43 +02:00
Benjamin Berg
5d7422e17a tests: Cleanup inhibitor fifo properly
Unlink the fifo itself and use addCleanup to close it.
2021-08-25 13:43:30 +02:00
Benjamin Berg
626128a0fa device: Remove local storage prints if they've been removed from device
If a print we have stored locally is not available in device anymore, we
need to cleanup the local database.

We do not get a proper DATA_NOT_FOUND error for most devices (indeed, at
this point no device does this properly). As such, do this when we see a
DATA_NOT_FOUND error and the first time that we get a verify-no-match
results on a device which is capable of listing all known prints.

Co-Authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-08-19 18:22:36 +02:00
Marco Trevisan (Treviño)
0bba073dff device: Handle data not-found error as verify-no-match
In case we got a data-not-found error, it means that the device has not
such prints stored, and thus the verification failed, and there's no
need to expose the internal reasons to fprintd clients.
2021-08-18 13:09:38 +02:00
Benjamin Berg
70182083a1 Implement suspend/resume handling 2021-08-09 13:25:11 +02:00
Benjamin Berg
37e6939fa9 tests: Verify PAM VerifyStop/disconnect behaviour
For verify-match, the PAM module should simply drop off the bus. In
other cases it should correctly run VerifyStop and Release the device.
Verify this for verify-match and verify-no-match.
2021-08-02 13:00:43 +02:00
Benjamin Berg
80eb673e83 tests: Remove broken test_verify_stop_restarts_immediately test
Before VerifyStart can be called again the current verify operation
needs to be completed. This requires waiting for VerifyStop to happen.

As such, remove the test, which is expected to fail randomly.
2021-08-02 13:00:43 +02:00
Benjamin Berg
6bc19c8892 tests: Speed up tests by only using parts of the image
We just need large enough samples to tell them apart correctly. For this
a 128x128 area from the center of each image is sufficient.

This speeds up the test run considerably. Other ways of achieving this
could be to also lower the number of enroll steps for the image device.
2021-07-31 11:53:33 +02:00
Benjamin Berg
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
Benjamin Berg
9ae3c16f2d tests: Pull more OutputChecker fixes
While debugging the g-s-d testsuite a few more issues in the
OutputChecker code came up. Pull in these fixes ensuring that EOF and
the read side FD are handled correctly.
2021-07-23 13:50:52 +02:00
Benjamin Berg
f4995dcabe tests: Pull OutputChecker fixes
Mark the thread as daemon. Also use poll and fix a wrong variable
reference.
2021-07-19 21:38:25 +00:00
Benjamin Berg
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
Benjamin Berg
9ec1747b84 Revert "pam_fprintd: Just return a PAM_AUTH_ERROR on unknown errors"
This reverts commit ecf6b7c323.

The idea of the commit was to make device failures less fatal to the
system. Unfortunately, we can fail quickly in this case, and returning
PAM_AUTH_ERR means that the user might run into a retry limit due to
this.

Go back to reporting PAM_AUTHINFO_UNAVAIL, it appears as the lesser evil
right now. Ideally we want to a way to tell the upper stack to retry
authentication whenever there is a good opportunity, but to not consider
it as an authentication failure.
2021-07-01 12:59:11 +02:00
Benjamin Berg
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
Benjamin Berg
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
Vincent Huang
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
Marco Trevisan (Treviño)
4f4b0d5f11 tests/fprintd: Check that garbage collecting works on duplicated print 2021-04-02 00:22:16 +02:00
Marco Trevisan (Treviño)
aae37304e5 tests/fprintd: Cleanup FPrintdVirtualStorageDeviceTests
Avoid repeating the same things multiple times
2021-04-02 00:22:16 +02:00
Marco Trevisan (Treviño)
8869b8296f tests/fprintd: Check an error is thrown if trying to re-enroll a finger 2021-04-02 00:22:16 +02:00
Marco Trevisan (Treviño)
41086ac4c6 tests/fprintd: Test enroll multiple prints with duplicates 2021-04-02 00:22:16 +02:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
e8622b3e63 device: Support enrolling on devices with no identification support 2021-04-01 23:09:29 +02:00
Benjamin Berg
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
Marco Trevisan (Treviño)
084e5bfafd tests/dbusmock/polkitd: Remove unwanted method, from a fprintd copy-paste 2021-03-23 19:00:33 +01:00
Marco Trevisan (Treviño)
d53eaa7d89 tests/dbusmock/polkitd: Do not look for mock object again
We already get it as the parameter of the load function, so no need
to find it
2021-03-23 19:00:23 +01:00
Marco Trevisan (Treviño)
29a83ec49a tests/dbusmock/fprintd: Do not redefine device object methods multiple times
They will picked anyways by python dbusmock
2021-03-23 18:59:22 +01:00
Marco Trevisan (Treviño)
0af8cf1d56 tests/fprintd: Use intermediate timeouts based on default setup 2021-03-03 19:51:07 +01:00