From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>, John Snow <jsnow@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Cleber Rosa <crosa@redhat.com>
Subject: [PATCH 3/5] scripts/device-crash-test: simplify Exception handling
Date: Thu, 11 Nov 2021 09:37:17 -0500 [thread overview]
Message-ID: <20211111143719.2162525-4-jsnow@redhat.com> (raw)
In-Reply-To: <20211111143719.2162525-1-jsnow@redhat.com>
We don't need to handle KeyboardInterruptError specifically; we can
instead tighten the scope of the broad Exception handlers to only catch
"Exception", which has the effect of allowing all BaseException classes
that do not inherit from Exception to be raised through.
KeyboardInterruptError and a few other important ones are
BaseExceptions, so this does the same thing with less code.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/device-crash-test | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 8331c057b8..d91e8616ef 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -317,9 +317,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
@@ -360,9 +358,7 @@ def checkOneCase(args, testcase):
exc_traceback = None
try:
vm.launch()
- except KeyboardInterrupt:
- raise
- except:
+ except Exception:
exc_traceback = traceback.format_exc()
dbg("Exception while running test case")
finally:
--
2.31.1
next prev parent reply other threads:[~2021-11-11 14:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 14:37 [PATCH 0/5] python/aqmp: improve support for device-crash-test John Snow
2021-11-11 14:37 ` [PATCH 1/5] python/aqmp: Fix disconnect during capabilities negotiation John Snow
2021-11-11 14:37 ` [PATCH 2/5] python/aqmp: fix ConnectError string method John Snow
2021-11-11 14:37 ` John Snow [this message]
2021-11-11 14:37 ` [PATCH 4/5] scripts/device-crash-test: don't emit AQMP connection errors to stdout John Snow
2021-11-11 14:37 ` [PATCH 5/5] scripts/device-crash-test: hide tracebacks for QMP connect errors John Snow
2021-11-12 7:20 ` [PATCH 0/5] python/aqmp: improve support for device-crash-test Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211111143719.2162525-4-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).