diff options
author | Sean Wilson <spwilson2@wisc.edu> | 2018-08-17 17:48:34 -0500 |
---|---|---|
committer | Sean Wilson <spwilson2@wisc.edu> | 2018-09-05 01:04:43 +0000 |
commit | c7c0678cc6c400bc91af2a838dd26356320bc2d2 (patch) | |
tree | 6b16529bea092a7b6f47b36841f3c459c8e429a3 /ext/testlib/sandbox.py | |
parent | 215d5e4096cb4b06aa7fd5e9936440b28d8fe034 (diff) | |
download | gem5-c7c0678cc6c400bc91af2a838dd26356320bc2d2.tar.xz |
testlib: No catch of custom exceptions in sandbox
Custom exceptions are not always properly pickled which could lead to
the sandbox test executor to crash when it tries to re __init__ pickled
exceptions thrown from the failed test.
Change-Id: I4e2ffe5802dda668b5d61c5a16e0989717121a04
Signed-off-by: Sean Wilson <spwilson27@gmail.com>
Reviewed-on: https://gem5-review.googlesource.com/12167
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'ext/testlib/sandbox.py')
-rw-r--r-- | ext/testlib/sandbox.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/testlib/sandbox.py b/ext/testlib/sandbox.py index 7f8fe2d3b..49fe133ea 100644 --- a/ext/testlib/sandbox.py +++ b/ext/testlib/sandbox.py @@ -133,18 +133,16 @@ class IoManager(object): class SubprocessException(Exception): - def __init__(self, exception, trace): + def __init__(self, trace): super(SubprocessException, self).__init__(trace) class ExceptionProcess(multiprocessing.Process): - class Status(): + class Status(object): def __init__(self, exitcode, exception_tuple): self.exitcode = exitcode if exception_tuple is not None: - self.trace = exception_tuple[1] - self.exception = exception_tuple[0] + self.trace = exception_tuple[0] else: - self.exception = None self.trace = None def __init__(self, *args, **kwargs): @@ -156,9 +154,9 @@ class ExceptionProcess(multiprocessing.Process): try: super(ExceptionProcess, self).run() self._cconn.send(None) - except Exception as e: + except Exception: tb = traceback.format_exc() - self._cconn.send((e, tb)) + self._cconn.send((tb, )) raise @property @@ -186,7 +184,7 @@ class Sandbox(object): status = self.p.status if status.exitcode: - raise SubprocessException(status.exception, status.trace) + raise SubprocessException(status.trace) def entrypoint(self): self.io_manager.setup() |