[PATCH 3/5] iotests: strip subdir path when listing tests

Daniel P. Berrangé posted 5 patches 2 years, 11 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
There is a newer version of this series
[PATCH 3/5] iotests: strip subdir path when listing tests
Posted by Daniel P. Berrangé 2 years, 11 months ago
When asking 'check' to list individual tests by invoking it in dry run
mode, it prints the paths to the tests relative to the base of the
I/O test directory.

When asking 'check' to run an individual test, however, it mandates that
only the unqualified test name is given, without any path prefix. This
inconsistency makes it harder to ask for a list of tests and then invoke
each one.

Thus the test listing code is change to flatten the test names, by
printing only the base name, which can be directly invoked.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/qemu-iotests/check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 7e287a79a3..3a8744220a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -169,7 +169,7 @@ if __name__ == '__main__':
         sys.exit(str(e))
 
     if args.dry_run:
-        print('\n'.join(tests))
+        print('\n'.join([os.path.basename(t) for t in tests]))
     else:
         with TestRunner(env, tap=args.tap,
                         color=args.color) as tr:
-- 
2.39.2


Re: [PATCH 3/5] iotests: strip subdir path when listing tests
Posted by Alex Bennée 2 years, 11 months ago
Daniel P. Berrangé <berrange@redhat.com> writes:

> When asking 'check' to list individual tests by invoking it in dry run
> mode, it prints the paths to the tests relative to the base of the
> I/O test directory.
>
> When asking 'check' to run an individual test, however, it mandates that
> only the unqualified test name is given, without any path prefix. This
> inconsistency makes it harder to ask for a list of tests and then invoke
> each one.
>
> Thus the test listing code is change to flatten the test names, by
> printing only the base name, which can be directly invoked.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro