|
|
73b847 |
From 2803498d804fedc6de37ceb52f5f28072ace247a Mon Sep 17 00:00:00 2001
|
|
|
73b847 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
73b847 |
Date: Tue, 26 Nov 2019 18:39:09 +0100
|
|
|
73b847 |
Subject: [PATCH 033/181] umockdev-test: Make possible to use a wrapper to run
|
|
|
73b847 |
tests
|
|
|
73b847 |
|
|
|
73b847 |
Support LIBFPRINT_TEST_WRAPPER env variable to run tests with a wrapper.
|
|
|
73b847 |
---
|
|
|
73b847 |
tests/umockdev-test.py | 31 ++++++++++++++-----------------
|
|
|
73b847 |
1 file changed, 14 insertions(+), 17 deletions(-)
|
|
|
73b847 |
|
|
|
73b847 |
diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py
|
|
|
73b847 |
index f1387d6..d91fcb9 100755
|
|
|
73b847 |
--- a/tests/umockdev-test.py
|
|
|
73b847 |
+++ b/tests/umockdev-test.py
|
|
|
73b847 |
@@ -50,18 +50,23 @@ def cmp_pngs(png_a, png_b):
|
|
|
73b847 |
for y in range(img_a.get_height()):
|
|
|
73b847 |
assert(data_a[y * stride + x * 4] == data_b[y * stride + x * 4])
|
|
|
73b847 |
|
|
|
73b847 |
-def capture():
|
|
|
73b847 |
- ioctl = os.path.join(ddir, "capture.ioctl")
|
|
|
73b847 |
+def get_umockdev_runner(ioctl_basename):
|
|
|
73b847 |
+ ioctl = os.path.join(ddir, "{}.ioctl".format(ioctl_basename))
|
|
|
73b847 |
device = os.path.join(ddir, "device")
|
|
|
73b847 |
dev = open(ioctl).readline().strip()
|
|
|
73b847 |
assert dev.startswith('@DEV ')
|
|
|
73b847 |
dev = dev[5:]
|
|
|
73b847 |
|
|
|
73b847 |
- subprocess.check_call(['umockdev-run', '-d', device,
|
|
|
73b847 |
- '-i', "%s=%s" % (dev, ioctl),
|
|
|
73b847 |
- '--',
|
|
|
73b847 |
- '%s' % os.path.join(edir, "capture.py"),
|
|
|
73b847 |
- '%s' % os.path.join(tmpdir, "capture.png")])
|
|
|
73b847 |
+ umockdev = ['umockdev-run', '-d', device,
|
|
|
73b847 |
+ '-i', "%s=%s" % (dev, ioctl),
|
|
|
73b847 |
+ '--']
|
|
|
73b847 |
+ wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
|
|
|
73b847 |
+ return umockdev + (wrapper.split(' ') if wrapper else []) + [sys.executable]
|
|
|
73b847 |
+
|
|
|
73b847 |
+def capture():
|
|
|
73b847 |
+ subprocess.check_call(get_umockdev_runner("capture") +
|
|
|
73b847 |
+ ['%s' % os.path.join(edir, "capture.py"),
|
|
|
73b847 |
+ '%s' % os.path.join(tmpdir, "capture.png")])
|
|
|
73b847 |
|
|
|
73b847 |
assert os.path.isfile(os.path.join(tmpdir, "capture.png"))
|
|
|
73b847 |
if os.path.isfile(os.path.join(ddir, "capture.png")):
|
|
|
73b847 |
@@ -69,16 +74,8 @@ def capture():
|
|
|
73b847 |
cmp_pngs(os.path.join(tmpdir, "capture.png"), os.path.join(ddir, "capture.png"))
|
|
|
73b847 |
|
|
|
73b847 |
def custom():
|
|
|
73b847 |
- ioctl = os.path.join(ddir, "custom.ioctl")
|
|
|
73b847 |
- device = os.path.join(ddir, "device")
|
|
|
73b847 |
- dev = open(ioctl).readline().strip()
|
|
|
73b847 |
- assert dev.startswith('@DEV ')
|
|
|
73b847 |
- dev = dev[5:]
|
|
|
73b847 |
-
|
|
|
73b847 |
- subprocess.check_call(['umockdev-run', '-d', device,
|
|
|
73b847 |
- '-i', "%s=%s" % (dev, ioctl),
|
|
|
73b847 |
- '--',
|
|
|
73b847 |
- '%s' % os.path.join(ddir, "custom.py")])
|
|
|
73b847 |
+ subprocess.check_call(get_umockdev_runner("custom") +
|
|
|
73b847 |
+ ['%s' % os.path.join(ddir, "custom.py")])
|
|
|
73b847 |
|
|
|
73b847 |
try:
|
|
|
73b847 |
if os.path.exists(os.path.join(ddir, "capture.ioctl")):
|
|
|
73b847 |
--
|
|
|
73b847 |
2.24.1
|
|
|
73b847 |
|