From c12778ec5b5a1cdbac5c2edd6128ee17d3948a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 7 Feb 2020 21:18:57 +0100 Subject: [PATCH] tests/fprintd: Verify that each enroll stage happens Instead of automatically replying with the 'whorl' image for every enroll state signal with result 'enroll-stage-passed', only perform the number of required enroll stages and ensure that we get the expected results. This also will allow to manually perform enroll steps in other tests. --- tests/fprintd.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/fprintd.py b/tests/fprintd.py index ff63917..f398c99 100755 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -307,8 +307,9 @@ class FPrintdVirtualDeviceTest(FPrintdTest): self._abort = params[1] self._last_result = params[0] - if not self._abort and self._last_result == 'enroll-stage-passed': - self.send_image('whorl') + if not self._abort and self._last_result.startswith('enroll-'): + # Exit wait loop, onto next enroll state (if any) + self._abort = True elif self._abort: pass else: @@ -354,8 +355,13 @@ class FPrintdVirtualDeviceTest(FPrintdTest): def enroll_image(self, img, finger='right-index-finger'): self.device.EnrollStart('(s)', finger) - self.send_image(img) - self.wait_for_result() + stages = self.device.get_cached_property('num-enroll-stages').unpack() + for stage in range(stages): + self.send_image(img) + if stage < stages - 1: + self.wait_for_result('enroll-stage-passed') + else: + self.wait_for_result('enroll-completed') self.device.EnrollStop() self.assertEqual(self._last_result, 'enroll-completed')