Blame SOURCES/0034-virtual-image-Re-run-the-test-using-the-defined-wrap.patch

73b847
From 68c3cf97c87d331843ff7899652c31943b58c6d3 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 19:37:55 +0100
73b847
Subject: [PATCH 034/181] virtual-image: Re-run the test using the defined
73b847
 wrapper if any
73b847
73b847
In case a LIBFPRINT_TEST_WRAPPER is defined, execute again the script using
73b847
the same python processor but using the passed wrapper command.
73b847
---
73b847
 tests/virtual-image.py | 10 +++++++++-
73b847
 1 file changed, 9 insertions(+), 1 deletion(-)
73b847
73b847
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
73b847
index a9fe8f5..363219a 100755
73b847
--- a/tests/virtual-image.py
73b847
+++ b/tests/virtual-image.py
73b847
@@ -10,11 +10,20 @@ import sys
73b847
 import unittest
73b847
 import socket
73b847
 import struct
73b847
+import subprocess
73b847
 import shutil
73b847
 import glob
73b847
 import cairo
73b847
 import tempfile
73b847
 
73b847
+# Re-run the test with the passed wrapper if set
73b847
+wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
73b847
+if wrapper:
73b847
+    wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
73b847
+        sys.argv[1:]
73b847
+    os.unsetenv('LIBFPRINT_TEST_WRAPPER')
73b847
+    sys.exit(subprocess.check_call(wrap_cmd))
73b847
+
73b847
 class Connection:
73b847
 
73b847
     def __init__(self, addr):
73b847
@@ -274,7 +283,6 @@ class VirtualImage(unittest.TestCase):
73b847
             ctx.iteration(True)
73b847
         assert(not self._verify_match)
73b847
 
73b847
-
73b847
 # avoid writing to stderr
73b847
 unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))
73b847
 
73b847
-- 
73b847
2.24.1
73b847