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 20 matching lines...) Expand all Loading... |
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): |
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 | 40 |
41 def __ne__(self, other): | |
42 return (self.exit_code != other.exit_code or | |
43 self.timed_out != other.timed_out or | |
44 self.stdout != other.stdout or | |
45 self.stderr != other.stderr) | |
46 | |
47 def HasCrashed(self): | 41 def HasCrashed(self): |
48 if utils.IsWindows(): | 42 if utils.IsWindows(): |
49 return 0x80000000 & self.exit_code and not (0x3FFFFF00 & self.exit_code) | 43 return 0x80000000 & self.exit_code and not (0x3FFFFF00 & self.exit_code) |
50 else: | 44 else: |
51 # Timed out tests will have exit_code -signal.SIGTERM. | 45 # Timed out tests will have exit_code -signal.SIGTERM. |
52 if self.timed_out: | 46 if self.timed_out: |
53 return False | 47 return False |
54 return (self.exit_code < 0 and | 48 return (self.exit_code < 0 and |
55 self.exit_code != -signal.SIGABRT) | 49 self.exit_code != -signal.SIGABRT) |
56 | 50 |
57 def HasTimedOut(self): | 51 def HasTimedOut(self): |
58 return self.timed_out | 52 return self.timed_out |
59 | 53 |
60 def Pack(self): | 54 def Pack(self): |
61 return [self.exit_code, self.timed_out, self.stdout, self.stderr] | 55 return [self.exit_code, self.timed_out, self.stdout, self.stderr] |
62 | 56 |
63 @staticmethod | 57 @staticmethod |
64 def Unpack(packed): | 58 def Unpack(packed): |
65 # For the order of the fields, refer to Pack() above. | 59 # For the order of the fields, refer to Pack() above. |
66 return Output(packed[0], packed[1], packed[2], packed[3]) | 60 return Output(packed[0], packed[1], packed[2], packed[3]) |
OLD | NEW |