[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/5] scripts/device-crash-test: simplify Exception handling
From: |
John Snow |
Subject: |
[PULL 3/5] scripts/device-crash-test: simplify Exception handling |
Date: |
Tue, 16 Nov 2021 19:33:15 -0500 |
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>
Reported-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-id: 20211111143719.2162525-4-jsnow@redhat.com
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
- [PULL 0/5] Python patches, John Snow, 2021/11/16
- [PULL 1/5] python/aqmp: Fix disconnect during capabilities negotiation, John Snow, 2021/11/16
- [PULL 2/5] python/aqmp: fix ConnectError string method, John Snow, 2021/11/16
- [PULL 3/5] scripts/device-crash-test: simplify Exception handling,
John Snow <=
- [PULL 4/5] scripts/device-crash-test: don't emit AQMP connection errors to stdout, John Snow, 2021/11/16
- [PULL 5/5] scripts/device-crash-test: hide tracebacks for QMP connect errors, John Snow, 2021/11/16
- Re: [PULL 0/5] Python patches, Richard Henderson, 2021/11/17
- Re: [PULL 0/5] Python patches, Gerd Hoffmann, 2021/11/17
- Re: [PULL 0/5] Python patches, Gerd Hoffmann, 2021/11/18
- Re: [PULL 0/5] Python patches, John Snow, 2021/11/18