summary refs log tree commit diff stats
path: root/tests/qemu-iotests/testrunner.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-05-03 13:01:08 +0200
committerMax Reitz <mreitz@redhat.com>2021-05-14 16:14:10 +0200
commitc64430d2386d9968342a8e1ae00ed34ff0b98bbb (patch)
tree38e32f7f5a7e3c82e7f2532a58d06877611c38ce /tests/qemu-iotests/testrunner.py
parent00dbc85e0efd863498d52408b248039816c10532 (diff)
downloadfocaccia-qemu-c64430d2386d9968342a8e1ae00ed34ff0b98bbb.tar.gz
focaccia-qemu-c64430d2386d9968342a8e1ae00ed34ff0b98bbb.zip
qemu-iotests: move command line and environment handling from TestRunner to TestEnv
In the next patch, "check" will learn how to execute a test script without
going through TestRunner.  To enable this, keep only the text output
and subprocess handling in the TestRunner; move into TestEnv the logic
to prepare for running a subprocess.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20210323181928.311862-4-pbonzini@redhat.com>
Message-Id: <20210503110110.476887-4-pbonzini@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to '')
-rw-r--r--tests/qemu-iotests/testrunner.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 1fc61fcaa3..519924dc81 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -129,7 +129,6 @@ class TestRunner(ContextManager['TestRunner']):
     def __init__(self, env: TestEnv, makecheck: bool = False,
                  color: str = 'auto') -> None:
         self.env = env
-        self.test_run_env = self.env.get_env()
         self.makecheck = makecheck
         self.last_elapsed = LastElapsedTime('.last-elapsed-cache', env)
 
@@ -243,18 +242,7 @@ class TestRunner(ContextManager['TestRunner']):
             silent_unlink(p)
 
         args = [str(f_test.resolve())]
-        if self.env.debug:
-            args.append('-d')
-
-        with f_test.open(encoding="utf-8") as f:
-            try:
-                if f.readline().rstrip() == '#!/usr/bin/env python3':
-                    args.insert(0, self.env.python)
-            except UnicodeDecodeError:  # binary test? for future.
-                pass
-
-        env = os.environ.copy()
-        env.update(self.test_run_env)
+        env = self.env.prepare_subprocess(args)
 
         t0 = time.time()
         with f_bad.open('w', encoding="utf-8") as f: