| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 | 28 |
| 29 import signal | 29 import signal |
| 30 | 30 |
| 31 from ..local import utils | 31 from ..local import utils |
| 32 | 32 |
| 33 class Output(object): | 33 class Output(object): |
| 34 | 34 |
| 35 def __init__(self, exit_code, timed_out, stdout, stderr): | 35 def __init__(self, exit_code, timed_out, stdout, stderr, pid): |
| 36 self.exit_code = exit_code | 36 self.exit_code = exit_code |
| 37 self.timed_out = timed_out | 37 self.timed_out = timed_out |
| 38 self.stdout = stdout | 38 self.stdout = stdout |
| 39 self.stderr = stderr | 39 self.stderr = stderr |
| 40 self.pid = pid |
| 40 | 41 |
| 41 def HasCrashed(self): | 42 def HasCrashed(self): |
| 42 if utils.IsWindows(): | 43 if utils.IsWindows(): |
| 43 return 0x80000000 & self.exit_code and not (0x3FFFFF00 & self.exit_code) | 44 return 0x80000000 & self.exit_code and not (0x3FFFFF00 & self.exit_code) |
| 44 else: | 45 else: |
| 45 # Timed out tests will have exit_code -signal.SIGTERM. | 46 # Timed out tests will have exit_code -signal.SIGTERM. |
| 46 if self.timed_out: | 47 if self.timed_out: |
| 47 return False | 48 return False |
| 48 return (self.exit_code < 0 and | 49 return (self.exit_code < 0 and |
| 49 self.exit_code != -signal.SIGABRT) | 50 self.exit_code != -signal.SIGABRT) |
| 50 | 51 |
| 51 def HasTimedOut(self): | 52 def HasTimedOut(self): |
| 52 return self.timed_out | 53 return self.timed_out |
| 53 | 54 |
| 54 def Pack(self): | 55 def Pack(self): |
| 55 return [self.exit_code, self.timed_out, self.stdout, self.stderr] | 56 return [self.exit_code, self.timed_out, self.stdout, self.stderr, self.pid] |
| 56 | 57 |
| 57 @staticmethod | 58 @staticmethod |
| 58 def Unpack(packed): | 59 def Unpack(packed): |
| 59 # For the order of the fields, refer to Pack() above. | 60 # For the order of the fields, refer to Pack() above. |
| 60 return Output(packed[0], packed[1], packed[2], packed[3]) | 61 return Output(packed[0], packed[1], packed[2], packed[3], packed[4]) |
| OLD | NEW |