Commit graph

24 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
c85ca09e35 tests/fprintd-utils: Ensure that we exit with error if we have no device 2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
091f373109 tests/fprintd-utils: Check the tools return values in some tests 2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
f6eb3b3ea5 verify: Pass the "any" finger parameter to the daemon
fprintd supports "any" finger parameter for the VerifyStart call, and it's
up to the daemon to pick the first known if the device doesn't support
identification.

So remove the check to verify utility and add a test to verify this is
respected.
2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
d7ca9e6095 tests/fprintd-utils: Verify happens on first finger if device has no identification
Ensure that this is true when using the utility
2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
d33a7c7e9d tests/fprintd-utils: Check that all fingers are listed 2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
94d3a18dcd tests/fprintd-utils: Check that verify returns an error if no finger is set 2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
5635383c96 tests/fprintd-utils: Check that fprintd-verify requests the expected finger 2020-11-04 21:06:13 +01:00
Marco Trevisan (Treviño)
5a703baa20 verify: Fail if we try to verify a non-enrolled finger
Since we list the fingers available fail early in case it's not found
2020-11-04 21:06:10 +01:00
Marco Trevisan (Treviño)
6641cb6da8 tests/fprintd-utils: Verify that we can match all the enrolled fingers 2020-11-04 21:04:21 +01:00
Marco Trevisan (Treviño)
870b48637a tests/fprintd-utils: Verify errors if the device is already claimed 2020-11-04 21:04:21 +01:00
Marco Trevisan (Treviño)
4b0cde81fd tests/fprintd-utils: Add utility function to stop the utility process
This avoids addCleanup ordering errors and also errors when we may try to
print an invalid stdout pipe (like when we have processed it all), as python
might fail with something like:

 ======================================================================
 ERROR: test_fprintd_multiple_verify_fails (__main__.TestFprintdUtilsVerify)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "~/GNOME/fprintd/tests/test_fprintd_utils.py", line 102, in <lambda>
     self.addCleanup(lambda: print(process.stdout.read()))
   File "/usr/lib/python3.8/codecs.py", line 321, in decode
     data = self.buffer + input
 TypeError: can't concat NoneType to bytes
2020-11-04 21:04:21 +01:00
Marco Trevisan (Treviño)
59b3d2af8d tests/fprintd-utils: Call addCleanup actions in reverse order
unittest addCleanup calls are called in reverse order, so we need to reverse
the order of the calls as well, otherwise we won't correctly terminate the
subprocess children
2020-11-04 21:04:21 +01:00
Marco Trevisan (Treviño)
93bcac946e tests/fprintd-utils: Move verification tests to a single class
We can factorize various checks, so let's simplify test code
2020-11-04 21:04:19 +01:00
Marco Trevisan (Treviño)
a5063dc0e4 tests/fprintd-utils: Setup the device on setUp()
No need to repeat the action in every unit test, but move the tests to a
different class to easily allow adding another class with tests with no
such initialization
2020-11-04 20:20:29 +01:00
Marco Trevisan (Treviño)
5fbc38c938 tests/fprintd-utils: Run super setUp/tearDown functions 2020-11-04 20:04:21 +01:00
Marco Trevisan (Treviño)
714f499ab6 tests: Double the timeouts when testing with address sanitizer 2020-04-01 13:58:08 +00:00
Marco Trevisan (Treviño)
d27872ff86 test_fprintd_utils: Don't use hard-coded sleep time
Make sleep time on verification dependent on the environment, so that it's
different when under valgrind
2020-03-17 17:14:35 +01:00
Marco Trevisan (Treviño)
cfbded36e1 test_fprintd_utils: Use a non-blocking pipe to read output
Avoid using a temporary file for reading the utilities output, so we can
read it as it comes, ignoring the previous one, and avoiding open/closing
the file.

To keep the output printing on cleanup working, adding an utility function
that reads the output and save it for later printing
2020-03-17 17:14:35 +01:00
Marco Trevisan (Treviño)
072fbc2b46 tests_fprintd_utils: Print the process output when done
This is particularly useful when using valgrind or address sanitizer to read
the output log
2020-03-17 17:14:35 +01:00
Marco Trevisan (Treviño)
7846359b65 test_fprintd_utils: De-duplicate utilities launching
Avoid repeating the same operation to launch the utilities all the times,
but provide instead a function that allows to start a process and saves its
output without having to handle this in every test.

Simplify the operation when we just want the final output, still reusing
the same code.
2020-03-17 17:14:35 +01:00
Marco Trevisan (Treviño)
048181ae7f test_fprintd_utils: Support running under valgrind
Like for the fprintd test, run the tests under valgrind if the `VALGRIND`
environment variable is set, and use the contents of the variable as the
path to the suppression file.
2020-02-04 15:39:01 +01:00
Bastien Nocera
f1517af09a tests: Add fprintd-verify test that uses scripting 2020-01-20 17:31:46 +01:00
Bastien Nocera
c0bf1515fd tests: Check that verify test doesn't succeed early 2020-01-20 17:31:08 +01:00
Bastien Nocera
431755becd tests: Add test for fprintd utils 2020-01-17 15:32:22 +01:00