summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Huang <vincent.huang@tw.synaptics.com>2021-03-10 17:16:37 +0800
committerBenjamin Berg <bberg@redhat.com>2021-04-30 14:41:12 +0200
commitf44233461f5c764ed8a680b38629ca1c1ab49e4f (patch)
tree8df5fc97cb4cc1a3183bf1227628d7ae5152b112 /tests
parent9e8139e6d4f58fb89d8fbd9c4ab41fa6802f6d85 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/fprintd.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/fprintd.py b/tests/fprintd.py
index b3366d9..2517d8e 100644
--- a/tests/fprintd.py
+++ b/tests/fprintd.py
@@ -850,7 +850,7 @@ class FPrintdVirtualStorageDeviceBaseTest(FPrintdVirtualDeviceBaseTest):
self.assertIn(command, ['INSERT', 'REMOVE', 'SCAN', 'ERROR', 'RETRY',
'FINGER', 'UNPLUG', 'SLEEP', 'SET_ENROLL_STAGES', 'SET_SCAN_TYPE',
'SET_CANCELLATION_ENABLED', 'LIST', 'IGNORED_COMMAND',
- 'SET_KEEP_ALIVE'])
+ 'SET_KEEP_ALIVE', 'CONT'])
with Connection(self.sockaddr) as con:
res = self._send_command(con, command, *args)
@@ -935,6 +935,8 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
'FP1-20201231-7-ABCDEFGH-testuser' : 'right-index-finger',
'no-metadata-new' : 'left-middle-finger',
}
+ # Explicitly fail initial cleanup (not needed, but faster)
+ self.send_command('ERROR', 0)
for i, f in enrolled_prints.items():
self.enroll_print(i, f)
@@ -973,6 +975,8 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
self.device.Claim('(s)', 'testuser')
self.assertEqual(self.get_stored_prints(), ['stored-print'])
+ # Explicitly fail initial cleanup (not needed, but faster)
+ self.send_command('ERROR', 0)
self.device.EnrollStart('(s)', 'right-thumb')
self.send_image('stored-print') # During identify
self.wait_for_result('enroll-stage-passed')
@@ -990,6 +994,8 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
self.device.Claim('(s)', 'testuser')
self.assertEqual(self.get_stored_prints(), ['stored-print'])
+ # Explicitly fail initial cleanup (not needed, but faster)
+ self.send_command('ERROR', 0)
self.device.EnrollStart('(s)', 'right-thumb')
self.send_image('stored-print') # During identify
self.send_error(FPrint.DeviceError.PROTO) # During garbage collecting
@@ -3065,6 +3071,10 @@ class FPrintdUtilsTest(FPrintdVirtualStorageDeviceBaseTest):
self.set_keep_alive(True)
self.device.Release()
+ # Open and clear storage
+ self.send_command('CONT')
+ self.send_command('CONT')
+
finger_name = self.get_finger_name(FPrint.Finger.LEFT_THUMB)
enroll, out = self.util_start('enroll', [self.get_current_user(),
'-f', finger_name])
@@ -3105,6 +3115,10 @@ class FPrintdUtilsTest(FPrintdVirtualStorageDeviceBaseTest):
self.set_keep_alive(True)
self.device.Release()
+ # Open and clear storage
+ self.send_command('CONT')
+ self.send_command('CONT')
+
finger_name = self.get_finger_name(FPrint.Finger.LEFT_MIDDLE)
enroll, out = self.util_start('enroll', [self.get_current_user(),
'-f', finger_name])