[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/5] Support format or cache specific out file
From: |
Nir Soffer |
Subject: |
[PATCH v2 2/5] Support format or cache specific out file |
Date: |
Mon, 28 Nov 2022 16:15:11 +0200 |
Extend the test finder to find tests with format (*.out.qcow2) or cache
specific (*.out.nocache) out file. This worked before only for the
numbered tests.
---
tests/qemu-iotests/findtests.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/findtests.py b/tests/qemu-iotests/findtests.py
index dd77b453b8..f4344ce78c 100644
--- a/tests/qemu-iotests/findtests.py
+++ b/tests/qemu-iotests/findtests.py
@@ -38,31 +38,37 @@ def chdir(path: Optional[str] = None) -> Iterator[None]:
os.chdir(saved_dir)
class TestFinder:
def __init__(self, test_dir: Optional[str] = None) -> None:
self.groups = defaultdict(set)
with chdir(test_dir):
self.all_tests = glob.glob('[0-9][0-9][0-9]')
self.all_tests += [f for f in glob.iglob('tests/*')
- if not f.endswith('.out') and
- os.path.isfile(f + '.out')]
+ if self.is_test(f)]
for t in self.all_tests:
with open(t, encoding="utf-8") as f:
for line in f:
if line.startswith('# group: '):
for g in line.split()[2:]:
self.groups[g].add(t)
break
+ def is_test(self, fname: str) -> bool:
+ """
+ The tests directory contains tests (no extension) and out files
+ (*.out, *.out.{format}, *.out.{option}).
+ """
+ return re.search(r'.+\.out(\.\w+)?$', fname) is None
+
def add_group_file(self, fname: str) -> None:
with open(fname, encoding="utf-8") as f:
for line in f:
line = line.strip()
if (not line) or line[0] == '#':
continue
words = line.split()
test_file = self.parse_test_name(words[0])
--
2.38.1