On 28.11.22 15:15, Nir Soffer wrote:
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(-)
This patch lacks an S-o-b, too.
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)]
So previously a file was only considered a test file if there was a corresponding reference output file (`f + '.out'`), so files without such a reference output aren’t considered test files...
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
...but this new function doesn’t check that. I think we should check it (just whether there’s any variant of `/{fname}\.out(\.\w+)?/` to go with `fname`) so that behavior isn’t changed.
Hanna
