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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 self.remaining = num_tests | 83 self.remaining = num_tests |
84 self.failed = [] | 84 self.failed = [] |
85 self.crashed = 0 | 85 self.crashed = 0 |
86 self.terminate = False | 86 self.terminate = False |
87 self.lock = threading.Lock() | 87 self.lock = threading.Lock() |
88 | 88 |
89 def Run(self, jobs): | 89 def Run(self, jobs): |
90 self.indicator.Starting() | 90 self.indicator.Starting() |
91 self._RunInternal(jobs) | 91 self._RunInternal(jobs) |
92 self.indicator.Done() | 92 self.indicator.Done() |
93 return not self.failed | 93 if self.failed: |
| 94 return 1 |
| 95 return 0 |
94 | 96 |
95 def _RunInternal(self, jobs): | 97 def _RunInternal(self, jobs): |
96 pool = multiprocessing.Pool(processes=jobs) | 98 pool = multiprocessing.Pool(processes=jobs) |
97 test_map = {} | 99 test_map = {} |
98 queue = [] | 100 queue = [] |
99 queued_exception = None | 101 queued_exception = None |
100 for test in self.tests: | 102 for test in self.tests: |
101 assert test.id >= 0 | 103 assert test.id >= 0 |
102 test_map[test.id] = test | 104 test_map[test.id] = test |
103 try: | 105 try: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 self.failed.append(test) | 142 self.failed.append(test) |
141 if test.output.HasCrashed(): | 143 if test.output.HasCrashed(): |
142 self.crashed += 1 | 144 self.crashed += 1 |
143 else: | 145 else: |
144 self.succeeded += 1 | 146 self.succeeded += 1 |
145 self.remaining -= 1 | 147 self.remaining -= 1 |
146 self.indicator.HasRun(test) | 148 self.indicator.HasRun(test) |
147 except KeyboardInterrupt: | 149 except KeyboardInterrupt: |
148 pool.terminate() | 150 pool.terminate() |
149 pool.join() | 151 pool.join() |
| 152 raise |
150 except Exception, e: | 153 except Exception, e: |
151 print("Exception: %s" % e) | 154 print("Exception: %s" % e) |
152 pool.terminate() | 155 pool.terminate() |
153 pool.join() | 156 pool.join() |
154 raise | 157 raise |
155 if queued_exception: | 158 if queued_exception: |
156 raise queued_exception | 159 raise queued_exception |
157 return | 160 return |
158 | 161 |
159 | 162 |
(...skipping 11 matching lines...) Expand all Loading... |
171 [self.context.extra_flags]) | 174 [self.context.extra_flags]) |
172 cmd = [ c for c in cmd if c != "" ] | 175 cmd = [ c for c in cmd if c != "" ] |
173 return cmd | 176 return cmd |
174 | 177 |
175 | 178 |
176 class BreakNowException(Exception): | 179 class BreakNowException(Exception): |
177 def __init__(self, value): | 180 def __init__(self, value): |
178 self.value = value | 181 self.value = value |
179 def __str__(self): | 182 def __str__(self): |
180 return repr(self.value) | 183 return repr(self.value) |
OLD | NEW |