aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-17 07:41:08 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-17 07:41:08 +0100
commit8d5fcb1990bc64b62c0bc12121fe510940be5664 (patch)
treeeee77ac188895efcd9b16dc07ae94ca68b386bd9 /scripts
parent67f9968ce3f0847ffddb6ee2837a3641acd92abf (diff)
parentc398a241ec4138e0b995a0215dea84ca93b0384f (diff)
Merge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging
Pull request # gpg: Signature made Wed 17 Nov 2021 01:33:06 AM CET # gpg: using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full] * tag 'python-pull-request' of https://gitlab.com/jsnow/qemu: scripts/device-crash-test: hide tracebacks for QMP connect errors scripts/device-crash-test: don't emit AQMP connection errors to stdout scripts/device-crash-test: simplify Exception handling python/aqmp: fix ConnectError string method python/aqmp: Fix disconnect during capabilities negotiation Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/device-crash-test33
1 files changed, 25 insertions, 8 deletions
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 8331c057b8..3db0ffe5b8 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -36,6 +36,7 @@ from itertools import chain
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
from qemu.machine import QEMUMachine
+from qemu.aqmp import ConnectError
logger = logging.getLogger('device-crash-test')
dbg = logger.debug
@@ -317,9 +318,7 @@ class QemuBinaryInfo(object):
try:
vm.launch()
mi['runnable'] = True
- except KeyboardInterrupt:
- raise
- except:
+ except Exception:
dbg("exception trying to run binary=%s machine=%s", self.binary, machine, exc_info=sys.exc_info())
dbg("log: %r", vm.get_log())
mi['runnable'] = False
@@ -357,12 +356,12 @@ def checkOneCase(args, testcase):
dbg("will launch QEMU: %s", cmdline)
vm = QEMUMachine(binary=binary, args=args)
+ exc = None
exc_traceback = None
try:
vm.launch()
- except KeyboardInterrupt:
- raise
- except:
+ except Exception as this_exc:
+ exc = this_exc
exc_traceback = traceback.format_exc()
dbg("Exception while running test case")
finally:
@@ -370,8 +369,9 @@ def checkOneCase(args, testcase):
ec = vm.exitcode()
log = vm.get_log()
- if exc_traceback is not None or ec != 0:
- return {'exc_traceback':exc_traceback,
+ if exc is not None or ec != 0:
+ return {'exc': exc,
+ 'exc_traceback':exc_traceback,
'exitcode':ec,
'log':log,
'testcase':testcase,
@@ -459,6 +459,17 @@ def logFailure(f, level):
for l in f['log'].strip().split('\n'):
logger.log(level, "log: %s", l)
logger.log(level, "exit code: %r", f['exitcode'])
+
+ # If the Exception is merely a QMP connect error,
+ # reduce the logging level for its traceback to
+ # improve visual clarity.
+ if isinstance(f.get('exc'), ConnectError):
+ logger.log(level, "%s.%s: %s",
+ type(f['exc']).__module__,
+ type(f['exc']).__qualname__,
+ str(f['exc']))
+ level = logging.DEBUG
+
if f['exc_traceback']:
logger.log(level, "exception:")
for l in f['exc_traceback'].split('\n'):
@@ -503,6 +514,12 @@ def main():
lvl = logging.WARN
logging.basicConfig(stream=sys.stdout, level=lvl, format='%(levelname)s: %(message)s')
+ if not args.debug:
+ # Async QMP, when in use, is chatty about connection failures.
+ # This script knowingly generates a ton of connection errors.
+ # Silence this logger.
+ logging.getLogger('qemu.aqmp.qmp_client').setLevel(logging.CRITICAL)
+
fatal_failures = []
wl_stats = {}
skipped = 0