Right now there is no easy way for "check" to print a reproducer command.
Because such a reproducer command line would be huge, we can instead teach
check to start a command of our choice. This can be for example a Python
unit test with arguments to only run a specific subtest.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qemu-iotests/check | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index d1c87ceaf1..aab25dac6a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -19,6 +19,7 @@
import os
import sys
import argparse
+import shutil
from findtests import TestFinder
from testenv import TestEnv
from testrunner import TestRunner
@@ -100,8 +101,8 @@ def make_argparser() -> argparse.ArgumentParser:
'one to TEST (not inclusive). This may be used to '
'rerun failed ./check command, starting from the '
'middle of the process.')
- g_sel.add_argument('tests', metavar='TEST_FILES', nargs='*',
- help='tests to run')
+ g_sel.add_argument('tests', nargs=argparse.REMAINDER,
+ help='tests to run, or "--" followed by a command')
return p
@@ -114,6 +115,17 @@ if __name__ == '__main__':
imgopts=args.imgopts, misalign=args.misalign,
debug=args.debug, valgrind=args.valgrind)
+ if args.tests[0] == '--':
+ del args.tests[0]
+ cmd = args.tests
+ env.print_env()
+ exec_path = shutil.which(cmd[0])
+ if exec_path is None:
+ sys.exit('command not found: ' + cmd[0])
+ cmd[0] = exec_path
+ full_env = env.prepare_subprocess(cmd)
+ os.execve(cmd[0], cmd, full_env)
+
testfinder = TestFinder(test_dir=env.source_iotests)
groups = args.groups.split(',') if args.groups else None