diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-01 09:14:41 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-08 07:17:09 +0200 |
commit | d322e84eef850d1e16bca81ac9b6811f13a8d7a7 (patch) | |
tree | e961a6dfab07e387b764f3971c56111be70db39c /scripts/test-driver.py | |
parent | 42d729e12c9a03e1140d681a5fdeceb10c4fa548 (diff) |
mtest2make: hide output of successful tests
The softfloat tests are quite noisy; before the Meson conversion
they buffered the output in a file and emitted the output only
if the test failed. Tweak mtest2make.py so that the courtesy
is extended to all non-TAP tests.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts/test-driver.py')
-rw-r--r-- | scripts/test-driver.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/test-driver.py b/scripts/test-driver.py new file mode 100644 index 0000000000..eef74b29a8 --- /dev/null +++ b/scripts/test-driver.py @@ -0,0 +1,35 @@ +#! /usr/bin/env python3 + +# Wrapper for tests that hides the output if they succeed. +# Used by "make check" +# +# Copyright (C) 2020 Red Hat, Inc. +# +# Author: Paolo Bonzini <pbonzini@redhat.com> + +import subprocess +import sys +import os +import argparse + +parser = argparse.ArgumentParser(description='Test driver for QEMU') +parser.add_argument('-C', metavar='DIR', dest='dir', default='.', + help='change to DIR before doing anything else') +parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', + help='be more verbose') +parser.add_argument('test_args', nargs=argparse.REMAINDER) + +args = parser.parse_args() +os.chdir(args.dir) + +test_args = args.test_args +if test_args[0] == '--': + test_args = test_args[1:] + +if args.verbose: + result = subprocess.run(test_args, stdout=None, stderr=None) +else: + result = subprocess.run(test_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if result.returncode: + sys.stdout.buffer.write(result.stdout) +sys.exit(result.returncode) |