debian/patches: Improve testing for various drivers

This commit is contained in:
Marco Trevisan (Treviño)
2022-10-13 13:37:35 +02:00
parent bacb72183d
commit 62a048ea6f
6 changed files with 201 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
From: mbv06 <mbv06.dev@gmail.com>
Date: Tue, 27 Sep 2022 08:59:49 +0000
Subject: Update autosuspend.hwdb
---
data/autosuspend.hwdb | 1 +
1 file changed, 1 insertion(+)
diff --git a/data/autosuspend.hwdb b/data/autosuspend.hwdb
index d8127c3..ca2435a 100644
--- a/data/autosuspend.hwdb
+++ b/data/autosuspend.hwdb
@@ -212,6 +212,7 @@ usb:v147Ep1001*
# Supported by libfprint driver upektc
usb:v0483p2015*
+usb:v0483p2017*
usb:v147Ep3001*
ID_AUTOSUSPEND=1
ID_PERSIST=0
@@ -0,0 +1,26 @@
From: Benjamin Berg <bberg@redhat.com>
Date: Wed, 22 Jun 2022 17:37:26 +0200
Subject: goodix: Make fingerlist parse error non-fatal
Otherwise we cannot recover from the error by doing a device reset.
---
libfprint/drivers/goodixmoc/goodix_proto.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libfprint/drivers/goodixmoc/goodix_proto.c b/libfprint/drivers/goodixmoc/goodix_proto.c
index b615dba..72511a8 100644
--- a/libfprint/drivers/goodixmoc/goodix_proto.c
+++ b/libfprint/drivers/goodixmoc/goodix_proto.c
@@ -393,10 +393,8 @@ gx_proto_parse_body (uint16_t cmd, uint8_t *buffer, uint16_t buffer_len, pgxfp_c
fingerid_length,
&presp->finger_list_resp.finger_list[num]) != 0)
{
- g_error ("parse fingerlist error");
- presp->finger_list_resp.finger_num = 0;
- presp->result = GX_FAILED;
- break;
+ g_warning ("Failed to parse finger list");
+ return -1;
}
offset += fingerid_length;
}
+1 -1
View File
@@ -9,7 +9,7 @@ Signed-off-by: Lv Ying <lvying.system.thoughts@gmail.com>
2 files changed, 3 insertions(+)
diff --git a/data/autosuspend.hwdb b/data/autosuspend.hwdb
index d8127c3..9a63c43 100644
index ca2435a..5291831 100644
--- a/data/autosuspend.hwdb
+++ b/data/autosuspend.hwdb
@@ -159,6 +159,7 @@ usb:v1C7Ap0603*
+4
View File
@@ -17,4 +17,8 @@ synaptics-Add-new-PID-0x0104.patch
goodixmoc-add-PID-0x634C.patch
goodixmoc-add-PID-6094.patch
upek-add-PID-0x2017.patch
Update-autosuspend.hwdb.patch
goodixmoc-add-PID-0x6014.patch
goodix-Lower-poor-capture-warnings-to-debug-message.patch
synaptics-goodix-Properly-check-for-finger-status-during-.patch
tests-Ensure-python-tests-exit-with-error-on-every-except.patch
@@ -0,0 +1,40 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 28 Sep 2022 01:21:31 +0200
Subject: synaptics,
goodix: Properly check for finger status during enroll progress
It may contain other values, but for sure we finger must be neeeded
---
tests/goodixmoc/custom.py | 2 +-
tests/synaptics/custom.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
mode change 100755 => 100644 tests/goodixmoc/custom.py
diff --git a/tests/goodixmoc/custom.py b/tests/goodixmoc/custom.py
old mode 100755
new mode 100644
index 38fdd26..73f90a5
--- a/tests/goodixmoc/custom.py
+++ b/tests/goodixmoc/custom.py
@@ -31,7 +31,7 @@ d.clear_storage_sync()
template = FPrint.Print.new(d)
def enroll_progress(*args):
- assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
+ assert d.get_finger_status() & FPrint.FingerStatusFlags.NEEDED
print('enroll progress: ' + str(args))
def identify_done(dev, res):
diff --git a/tests/synaptics/custom.py b/tests/synaptics/custom.py
index 3e48341..dae651b 100755
--- a/tests/synaptics/custom.py
+++ b/tests/synaptics/custom.py
@@ -29,7 +29,7 @@ d.clear_storage_sync()
template = FPrint.Print.new(d)
def enroll_progress(*args):
- assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
+ assert d.get_finger_status() & FPrint.FingerStatusFlags.NEEDED
print('enroll progress: ' + str(args))
# List, enroll, list, verify, delete, list
@@ -0,0 +1,110 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 28 Sep 2022 01:22:15 +0200
Subject: tests: Ensure python tests exit with error on every exception
We ignored assertions happening on callbacks as they only raise
exceptions that does not stop the execution.
So ensure that this is happening in all the tests as synaptics was
doing already
---
tests/capture.py | 9 +++++++--
tests/elanmoc/custom.py | 6 ++++++
tests/goodixmoc/custom.py | 6 ++++++
tests/virtual-device.py | 3 +++
tests/virtual-image.py | 3 +++
5 files changed, 25 insertions(+), 2 deletions(-)
mode change 100644 => 100755 tests/goodixmoc/custom.py
diff --git a/tests/capture.py b/tests/capture.py
index c25afbf..d6573a8 100755
--- a/tests/capture.py
+++ b/tests/capture.py
@@ -1,10 +1,15 @@
#!/usr/bin/python3
+import cairo
+import sys
+import traceback
import gi
+
gi.require_version('FPrint', '2.0')
from gi.repository import FPrint, GLib
-import cairo
-import sys
+
+# Exit with error on any exception, included those happening in async callbacks
+sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
if len(sys.argv) != 2:
print("Please specify exactly one argument, the output location for the capture image")
diff --git a/tests/elanmoc/custom.py b/tests/elanmoc/custom.py
index c64414c..1a3b8b3 100755
--- a/tests/elanmoc/custom.py
+++ b/tests/elanmoc/custom.py
@@ -1,9 +1,15 @@
#!/usr/bin/python3
+import traceback
+import sys
import gi
+
gi.require_version('FPrint', '2.0')
from gi.repository import FPrint, GLib
+# Exit with error on any exception, included those happening in async callbacks
+sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
+
ctx = GLib.main_context_default()
c = FPrint.Context()
diff --git a/tests/goodixmoc/custom.py b/tests/goodixmoc/custom.py
old mode 100644
new mode 100755
index 73f90a5..aee4391
--- a/tests/goodixmoc/custom.py
+++ b/tests/goodixmoc/custom.py
@@ -1,9 +1,15 @@
#!/usr/bin/python3
+import traceback
+import sys
import gi
+
gi.require_version('FPrint', '2.0')
from gi.repository import FPrint, GLib
+# Exit with error on any exception, included those happening in async callbacks
+sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
+
ctx = GLib.main_context_default()
c = FPrint.Context()
diff --git a/tests/virtual-device.py b/tests/virtual-device.py
index e15b432..beec97f 100644
--- a/tests/virtual-device.py
+++ b/tests/virtual-device.py
@@ -22,6 +22,9 @@ except Exception as e:
FPrint = None
+# Exit with error on any exception, included those happening in async callbacks
+sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
+
ctx = GLib.main_context_default()
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
index e4a464e..5563003 100755
--- a/tests/virtual-image.py
+++ b/tests/virtual-image.py
@@ -21,6 +21,9 @@ except Exception as e:
FPrint = None
+# Exit with error on any exception, included those happening in async callbacks
+sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
+
def load_image(img):
png = cairo.ImageSurface.create_from_png(img)