mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
iotests: always use a unique sub-directory per test
The current test runner is only safe against parallel execution within a single instance of the 'check' process, and only if -j is given a value greater than 2. This prevents running multiple copies of the 'check' process for different test scenarios. This change switches the output / socket directories to always include the test name, image format and image protocol. This should allow full parallelism of all distinct test scenarios. eg running both qcow2 and raw tests at the same time, or both file and nbd tests at the same time. It would be possible to allow for parallelism of the same test scenario by including the pid, but that would potentially let many directories accumulate over time on failures, so is not done. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Hanna Czenczek <hreitz@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230303160727.3977246-7-berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230315174331.2959-24-alex.bennee@linaro.org>
This commit is contained in:
parent
cb845eaa88
commit
5ba7db0938
|
@ -228,13 +228,11 @@ def find_reference(self, test: str) -> str:
|
||||||
|
|
||||||
return f'{test}.out'
|
return f'{test}.out'
|
||||||
|
|
||||||
def do_run_test(self, test: str, mp: bool) -> TestResult:
|
def do_run_test(self, test: str) -> TestResult:
|
||||||
"""
|
"""
|
||||||
Run one test
|
Run one test
|
||||||
|
|
||||||
:param test: test file path
|
:param test: test file path
|
||||||
:param mp: if true, we are in a multiprocessing environment, use
|
|
||||||
personal subdirectories for test run
|
|
||||||
|
|
||||||
Note: this method may be called from subprocess, so it does not
|
Note: this method may be called from subprocess, so it does not
|
||||||
change ``self`` object in any way!
|
change ``self`` object in any way!
|
||||||
|
@ -257,12 +255,14 @@ def do_run_test(self, test: str, mp: bool) -> TestResult:
|
||||||
|
|
||||||
args = [str(f_test.resolve())]
|
args = [str(f_test.resolve())]
|
||||||
env = self.env.prepare_subprocess(args)
|
env = self.env.prepare_subprocess(args)
|
||||||
if mp:
|
|
||||||
# Split test directories, so that tests running in parallel don't
|
# Split test directories, so that tests running in parallel don't
|
||||||
# break each other.
|
# break each other.
|
||||||
for d in ['TEST_DIR', 'SOCK_DIR']:
|
for d in ['TEST_DIR', 'SOCK_DIR']:
|
||||||
env[d] = os.path.join(env[d], f_test.name)
|
env[d] = os.path.join(
|
||||||
Path(env[d]).mkdir(parents=True, exist_ok=True)
|
env[d],
|
||||||
|
f"{self.env.imgfmt}-{self.env.imgproto}-{f_test.name}")
|
||||||
|
Path(env[d]).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
test_dir = env['TEST_DIR']
|
test_dir = env['TEST_DIR']
|
||||||
f_bad = Path(test_dir, f_test.name + '.out.bad')
|
f_bad = Path(test_dir, f_test.name + '.out.bad')
|
||||||
|
@ -347,7 +347,7 @@ def run_test(self, test: str,
|
||||||
testname = os.path.basename(test)
|
testname = os.path.basename(test)
|
||||||
print(f'# running {self.env.imgfmt} {testname}')
|
print(f'# running {self.env.imgfmt} {testname}')
|
||||||
|
|
||||||
res = self.do_run_test(test, mp)
|
res = self.do_run_test(test)
|
||||||
|
|
||||||
end = datetime.datetime.now().strftime('%H:%M:%S')
|
end = datetime.datetime.now().strftime('%H:%M:%S')
|
||||||
self.test_print_one_line(test=test,
|
self.test_print_one_line(test=test,
|
||||||
|
|
Loading…
Reference in a new issue