1 #! /usr/bin/env python3
3 # Wrapper for tests that hides the output if they succeed.
6 # Copyright (C) 2020 Red Hat, Inc.
8 # Author: Paolo Bonzini <pbonzini@redhat.com>
15 parser
= argparse
.ArgumentParser(description
='Test driver for QEMU')
16 parser
.add_argument('-C', metavar
='DIR', dest
='dir', default
='.',
17 help='change to DIR before doing anything else')
18 parser
.add_argument('-v', '--verbose', dest
='verbose', action
='store_true',
19 help='be more verbose')
20 parser
.add_argument('test_args', nargs
=argparse
.REMAINDER
)
22 args
= parser
.parse_args()
25 test_args
= args
.test_args
26 if test_args
[0] == '--':
27 test_args
= test_args
[1:]
30 result
= subprocess
.run(test_args
, stdout
=None, stderr
=None)
32 result
= subprocess
.run(test_args
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.STDOUT
)
34 sys
.stdout
.buffer.write(result
.stdout
)
35 sys
.exit(result
.returncode
)