Skip to contentSkip to conversation

iotests: add --quiet arg to hide env variable dump

PATCH Applied Daniel P. Berrangé 3 participants 3 messages Nov 2 – Nov 3

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iotests: add --quiet arg to hide env variable dump

Every test run dumps a long list of environment variable settings. While this is often useful, if you are trying to reproduce a bug while repeatedly running a single test it can be quiet noisy. Add a --quiet flag to 'check' which allows the env variable dump to be hidden. With this is only prints out the tests being run and the overall status on completion.

---
 tests/qemu-iotests/check         | 4 +++-
 tests/qemu-iotests/testrunner.py | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
tests/qemu-iotests/check +3 -1
index 3941eac8e21..c8ba536970c 100755
@@ -46,6 +46,8 @@ def make_argparser() -> argparse.ArgumentParser:
         description="Test run options",
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
 
+    p.add_argument('-q', '--quiet', action='store_true',
+                   help='reduce output verbosity to only test results')
     p.add_argument('-n', '--dry-run', action='store_true',
                    help='show me, do not run tests')
     p.add_argument('-j', dest='jobs', type=int, default=1,
@@ -230,6 +232,6 @@ if __name__ == '__main__':
         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)
+            ok = tr.run_tests(paths, args.jobs, args.quiet)
             if not ok:
                 sys.exit(1)
tests/qemu-iotests/testrunner.py +5 -3
index 729680da4aa..f35e65f805f 100644
@@ -376,7 +376,8 @@ def run_test(self, test: str,
         sys.stdout.flush()
         return res
 
-    def run_tests(self, tests: List[str], jobs: int = 1) -> bool:
+    def run_tests(self, tests: List[str], jobs: int = 1,
+                  quiet: bool = False) -> bool:
         n_run = 0
         failed = []
         notrun = []
@@ -384,9 +385,10 @@ def run_tests(self, tests: List[str], jobs: int = 1) -> bool:
 
         if self.tap:
             print('TAP version 13')
-            self.env.print_env('# ')
+            if not quiet:
+                self.env.print_env('# ')
             print('1..%d' % len(tests))
-        else:
+        elif not quiet:
             self.env.print_env()
 
         test_field_width = max(len(os.path.basename(t)) for t in tests) + 2
Signature · 1 line
2.56.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 3 lines · Daniel P. Berrangé

Every test run dumps a long list of environment variable settings. While this is often useful, if you are trying to reproduce a bug while repeatedly running a single test it can be quiet noisy. Add

Humorous typo; you meant 'quite noisy'.

Quoted 9 lines

a --quiet flag to 'check' which allows the env variable dump to be hidden. With this is only prints out the tests being run and the overall status on completion.

---
 tests/qemu-iotests/check         | 4 +++-
 tests/qemu-iotests/testrunner.py | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
Applied
#2 lore raw
In reply to Daniel P. Berrangé

Am 02.11.2026 um 17:34 hat Daniel P. Berrangé geschrieben:

Quoted 8 lines

Every test run dumps a long list of environment variable settings. While this is often useful, if you are trying to reproduce a bug while repeatedly running a single test it can be quiet noisy. Add a --quiet flag to 'check' which allows the env variable dump to be hidden. With this is only prints out the tests being run and the overall status on completion.

Thanks, applied to the block branch.

Kevin