[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 2/5] iotests: add testenv.py
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [PATCH v8 2/5] iotests: add testenv.py |
Date: |
Mon, 25 Jan 2021 15:32:42 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 |
24.01.2021 00:04, Vladimir Sementsov-Ogievskiy wrote:
Add TestEnv class, which will handle test environment in a new python
iotests running framework.
Don't add compat=1.1 for qcow2 IMGOPTS, as v3 is default anyway.
Signed-off-by: Vladimir Sementsov-Ogievskiy<vsementsov@virtuozzo.com>
---
tests/qemu-iotests/testenv.py | 278 ++++++++++++++++++++++++++++++++++
1 file changed, 278 insertions(+)
create mode 100644 tests/qemu-iotests/testenv.py
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
new file mode 100644
index 0000000000..348af593e9
[..]
+ def init_binaries(self):
+ """Init binary path variables:
+ PYTHON (for bash tests)
+ QEMU_PROG, QEMU_IMG_PROG, QEMU_IO_PROG, QEMU_NBD_PROG, QSD_PROG
+ SOCKET_SCM_HELPER
+ """
+ self.python = sys.executable
+
+ def root(*names):
+ return os.path.join(self.build_root, *names)
+
+ arch = os.uname().machine
+ if 'ppc64' in arch:
+ arch = 'ppc64'
+
+ self.qemu_prog = os.getenv('QEMU_PROG', root(f'qemu-system-{arch}'))
+ if not os.path.exists(self.qemu_prog):
+ pattern = root('qemu-system-*')
+ progs = glob.glob(pattern)
+ if not progs:
+ sys.exit(f"Not found any Qemu binary by pattern '{pattern}'")
+ if len(progs) > 1:
+ progs_list = ', '.join(progs)
+ sys.exit(f"Several non '{arch}' qemu binaries found: "
+ f"{progs_list}, please set QEMU_PROG environment "
+ "variable")
+ self.qemu_prog = progs[0]
squash-in:
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 348af593e9..1633510caf 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -129,14 +129,14 @@ class TestEnv(AbstractContextManager['TestEnv']):
if not os.path.exists(self.qemu_prog):
pattern = root('qemu-system-*')
progs = glob.glob(pattern)
- if not progs:
- sys.exit(f"Not found any Qemu binary by pattern '{pattern}'")
- if len(progs) > 1:
- progs_list = ', '.join(progs)
- sys.exit(f"Several non '{arch}' qemu binaries found: "
- f"{progs_list}, please set QEMU_PROG environment "
- "variable")
- self.qemu_prog = progs[0]
+ found = False
+ for p in progs:
+ if os.access(p, os.X_OK):
+ self.qemu_prog = p
+ found = True
+ if not found:
+ sys.exit("Not found any Qemu executable binary by pattern "
+ f"'{pattern}'")
--
Best regards,
Vladimir
[PATCH v8 3/5] iotests: add testrunner.py, Vladimir Sementsov-Ogievskiy, 2021/01/23
[PATCH v8 4/5] iotests: rewrite check into python, Vladimir Sementsov-Ogievskiy, 2021/01/23
[PATCH v8 5/5] iotests: rename and move 169 and 199 tests, Vladimir Sementsov-Ogievskiy, 2021/01/23
Re: [PATCH v8 0/5] Rework iotests/check, Kevin Wolf, 2021/01/25