[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] tests/qemu-iotests: Allow to run "./check -n" from the sourc
From: |
Thomas Huth |
Subject: |
[PATCH 3/6] tests/qemu-iotests: Allow to run "./check -n" from the source directory, too |
Date: |
Tue, 8 Feb 2022 11:13:08 +0100 |
For better integration of the iotests into the meson build system, it
would be very helpful to get the list of the tests in the "auto" group
during the "configure" step already. However, "check -n -g auto"
currently only works if the binaries have already been built. Re-order
the code in the "check" a little bit so that we can use the -n option
without building the binaries first.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qemu-iotests/check | 52 ++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 23 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 75de1b4691..0fa75abf13 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -120,6 +120,30 @@ def make_argparser() -> argparse.ArgumentParser:
if __name__ == '__main__':
args = make_argparser().parse_args()
+ if os.path.islink(sys.argv[0]):
+ # called from the build tree
+ source_iotests = os.path.dirname(os.readlink(sys.argv[0]))
+ else:
+ source_iotests = os.getcwd()
+
+ testfinder = TestFinder(source_iotests)
+
+ groups = args.groups.split(',') if args.groups else None
+ x_groups = args.exclude_groups.split(',') if args.exclude_groups else None
+
+ try:
+ tests = testfinder.find_tests(groups=groups, exclude_groups=x_groups,
+ tests=args.tests,
+ start_from=args.start_from)
+ if not tests:
+ raise ValueError('No tests selected')
+ except ValueError as e:
+ sys.exit(e)
+
+ if args.dry_run:
+ print('\n'.join(tests))
+ sys.exit(0)
+
env = TestEnv(imgfmt=args.imgfmt, imgproto=args.imgproto,
aiomode=args.aiomode, cachemode=args.cachemode,
imgopts=args.imgopts, misalign=args.misalign,
@@ -140,11 +164,6 @@ if __name__ == '__main__':
os.chdir(exec_path.parent)
os.execve(cmd[0], cmd, full_env)
- testfinder = TestFinder(test_dir=env.source_iotests)
-
- groups = args.groups.split(',') if args.groups else None
- x_groups = args.exclude_groups.split(',') if args.exclude_groups else None
-
group_local = os.path.join(env.source_iotests, 'group.local')
if os.path.isfile(group_local):
try:
@@ -152,21 +171,8 @@ if __name__ == '__main__':
except ValueError as e:
sys.exit(f"Failed to parse group file '{group_local}': {e}")
- try:
- tests = testfinder.find_tests(groups=groups, exclude_groups=x_groups,
- tests=args.tests,
- start_from=args.start_from)
- if not tests:
- raise ValueError('No tests selected')
- except ValueError as e:
- sys.exit(e)
-
- if args.dry_run:
- print('\n'.join(tests))
- else:
- with TestRunner(env, tap=args.tap,
- color=args.color) as tr:
- paths = [os.path.join(env.source_iotests, t) for t in tests]
- ok = tr.run_tests(paths, args.jobs)
- if not ok:
- sys.exit(1)
+ with TestRunner(env, tap=args.tap, color=args.color) as tr:
+ paths = [os.path.join(env.source_iotests, t) for t in tests]
+ ok = tr.run_tests(paths, args.jobs)
+ if not ok:
+ sys.exit(1)
--
2.27.0
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, (continued)
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Philippe Mathieu-Daudé, 2022/02/08
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Thomas Huth, 2022/02/08
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Eric Blake, 2022/02/11
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Thomas Huth, 2022/02/11
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Thomas Huth, 2022/02/15
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Daniel P . Berrangé, 2022/02/15
- Re: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed, Thomas Huth, 2022/02/15
[PATCH 2/6] tests/qemu-iotests/meson.build: Improve the indentation, Thomas Huth, 2022/02/08
[PATCH 3/6] tests/qemu-iotests: Allow to run "./check -n" from the source directory, too,
Thomas Huth <=
[PATCH 5/6] tests: Do not treat the iotests as separate meson test target anymore, Thomas Huth, 2022/02/08
[PATCH 6/6] tests: Remove check-block.sh, Thomas Huth, 2022/02/08
[PATCH 4/6] tests/qemu-iotests/meson.build: Call the 'check' script directly, Thomas Huth, 2022/02/08