configure: Restrict TCG to emulation
[qemu/rayw.git] / scripts / test-driver.py
blobeef74b29a8feda0b197242990c2e83cd085602dc
1 #! /usr/bin/env python3
3 # Wrapper for tests that hides the output if they succeed.
4 # Used by "make check"
6 # Copyright (C) 2020 Red Hat, Inc.
8 # Author: Paolo Bonzini <pbonzini@redhat.com>
10 import subprocess
11 import sys
12 import os
13 import argparse
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()
23 os.chdir(args.dir)
25 test_args = args.test_args
26 if test_args[0] == '--':
27 test_args = test_args[1:]
29 if args.verbose:
30 result = subprocess.run(test_args, stdout=None, stderr=None)
31 else:
32 result = subprocess.run(test_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
33 if result.returncode:
34 sys.stdout.buffer.write(result.stdout)
35 sys.exit(result.returncode)