Blob Blame History Raw
From 68c3cf97c87d331843ff7899652c31943b58c6d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 26 Nov 2019 19:37:55 +0100
Subject: [PATCH 034/181] virtual-image: Re-run the test using the defined
 wrapper if any

In case a LIBFPRINT_TEST_WRAPPER is defined, execute again the script using
the same python processor but using the passed wrapper command.
---
 tests/virtual-image.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/virtual-image.py b/tests/virtual-image.py
index a9fe8f5..363219a 100755
--- a/tests/virtual-image.py
+++ b/tests/virtual-image.py
@@ -10,11 +10,20 @@ import sys
 import unittest
 import socket
 import struct
+import subprocess
 import shutil
 import glob
 import cairo
 import tempfile
 
+# Re-run the test with the passed wrapper if set
+wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
+if wrapper:
+    wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
+        sys.argv[1:]
+    os.unsetenv('LIBFPRINT_TEST_WRAPPER')
+    sys.exit(subprocess.check_call(wrap_cmd))
+
 class Connection:
 
     def __init__(self, addr):
@@ -274,7 +283,6 @@ class VirtualImage(unittest.TestCase):
             ctx.iteration(True)
         assert(not self._verify_match)
 
-
 # avoid writing to stderr
 unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))
 
-- 
2.24.1