| 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 10 matching lines...) Expand all Loading... |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 os | 29 import os |
| 30 import shutil | 30 import shutil |
| 31 import sys |
| 31 import time | 32 import time |
| 32 | 33 |
| 33 from pool import Pool | 34 from pool import Pool |
| 34 from . import commands | 35 from . import commands |
| 35 from . import perfdata | 36 from . import perfdata |
| 36 from . import statusfile | 37 from . import statusfile |
| 37 from . import utils | 38 from . import utils |
| 38 | 39 |
| 39 | 40 |
| 40 class Job(object): | 41 class Job(object): |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 self.crashed += 1 | 144 self.crashed += 1 |
| 144 else: | 145 else: |
| 145 self.succeeded += 1 | 146 self.succeeded += 1 |
| 146 self.remaining -= 1 | 147 self.remaining -= 1 |
| 147 # For the indicator, everything that happens after the first run is treated | 148 # For the indicator, everything that happens after the first run is treated |
| 148 # as unexpected even if it flakily passes in order to include it in the | 149 # as unexpected even if it flakily passes in order to include it in the |
| 149 # output. | 150 # output. |
| 150 self.indicator.HasRun(test, has_unexpected_output or test.run > 1) | 151 self.indicator.HasRun(test, has_unexpected_output or test.run > 1) |
| 151 if has_unexpected_output: | 152 if has_unexpected_output: |
| 152 # Rerun test failures after the indicator has processed the results. | 153 # Rerun test failures after the indicator has processed the results. |
| 154 self._VerbosePrint("Attempting to rerun test after failure.") |
| 153 self._MaybeRerun(pool, test) | 155 self._MaybeRerun(pool, test) |
| 154 # Update the perf database if the test succeeded. | 156 # Update the perf database if the test succeeded. |
| 155 return not has_unexpected_output | 157 return not has_unexpected_output |
| 156 | 158 |
| 157 def _ProcessTestPredictable(self, test, result, pool): | 159 def _ProcessTestPredictable(self, test, result, pool): |
| 158 def HasDifferentAllocations(output1, output2): | 160 def HasDifferentAllocations(output1, output2): |
| 159 def AllocationStr(stdout): | 161 def AllocationStr(stdout): |
| 160 for line in reversed((stdout or "").splitlines()): | 162 for line in reversed((stdout or "").splitlines()): |
| 161 if line.startswith("### Allocations = "): | 163 if line.startswith("### Allocations = "): |
| 162 self.printed_allocations = True | 164 self.printed_allocations = True |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 self.indicator.Heartbeat() | 236 self.indicator.Heartbeat() |
| 235 continue | 237 continue |
| 236 test = test_map[result.value[0]] | 238 test = test_map[result.value[0]] |
| 237 if self.context.predictable: | 239 if self.context.predictable: |
| 238 update_perf = self._ProcessTestPredictable(test, result.value, pool) | 240 update_perf = self._ProcessTestPredictable(test, result.value, pool) |
| 239 else: | 241 else: |
| 240 update_perf = self._ProcessTestNormal(test, result.value, pool) | 242 update_perf = self._ProcessTestNormal(test, result.value, pool) |
| 241 if update_perf: | 243 if update_perf: |
| 242 self._RunPerfSafe(lambda: self.perfdata.UpdatePerfData(test)) | 244 self._RunPerfSafe(lambda: self.perfdata.UpdatePerfData(test)) |
| 243 finally: | 245 finally: |
| 246 self._VerbosePrint("Closing process pool.") |
| 244 pool.terminate() | 247 pool.terminate() |
| 248 self._VerbosePrint("Closing database connection.") |
| 245 self._RunPerfSafe(lambda: self.perf_data_manager.close()) | 249 self._RunPerfSafe(lambda: self.perf_data_manager.close()) |
| 246 if self.perf_failures: | 250 if self.perf_failures: |
| 247 # Nuke perf data in case of failures. This might not work on windows as | 251 # Nuke perf data in case of failures. This might not work on windows as |
| 248 # some files might still be open. | 252 # some files might still be open. |
| 249 print "Deleting perf test data due to db corruption." | 253 print "Deleting perf test data due to db corruption." |
| 250 shutil.rmtree(self.datapath) | 254 shutil.rmtree(self.datapath) |
| 251 if queued_exception: | 255 if queued_exception: |
| 252 raise queued_exception | 256 raise queued_exception |
| 253 | 257 |
| 254 # Make sure that any allocations were printed in predictable mode. | 258 # Make sure that any allocations were printed in predictable mode. |
| 255 assert not self.context.predictable or self.printed_allocations | 259 assert not self.context.predictable or self.printed_allocations |
| 256 | 260 |
| 261 def _VerbosePrint(self, text): |
| 262 if self.context.verbose: |
| 263 print text |
| 264 sys.stdout.flush() |
| 265 |
| 257 def GetCommand(self, test): | 266 def GetCommand(self, test): |
| 258 d8testflag = [] | 267 d8testflag = [] |
| 259 shell = test.suite.shell() | 268 shell = test.suite.shell() |
| 260 if shell == "d8": | 269 if shell == "d8": |
| 261 d8testflag = ["--test"] | 270 d8testflag = ["--test"] |
| 262 if utils.IsWindows(): | 271 if utils.IsWindows(): |
| 263 shell += ".exe" | 272 shell += ".exe" |
| 264 cmd = (self.context.command_prefix + | 273 cmd = (self.context.command_prefix + |
| 265 [os.path.abspath(os.path.join(self.context.shell_dir, shell))] + | 274 [os.path.abspath(os.path.join(self.context.shell_dir, shell))] + |
| 266 d8testflag + | 275 d8testflag + |
| 267 ["--random-seed=%s" % self.context.random_seed] + | 276 ["--random-seed=%s" % self.context.random_seed] + |
| 268 test.suite.GetFlagsForTestCase(test, self.context) + | 277 test.suite.GetFlagsForTestCase(test, self.context) + |
| 269 self.context.extra_flags) | 278 self.context.extra_flags) |
| 270 return cmd | 279 return cmd |
| 271 | 280 |
| 272 | 281 |
| 273 class BreakNowException(Exception): | 282 class BreakNowException(Exception): |
| 274 def __init__(self, value): | 283 def __init__(self, value): |
| 275 self.value = value | 284 self.value = value |
| 276 def __str__(self): | 285 def __str__(self): |
| 277 return repr(self.value) | 286 return repr(self.value) |
| OLD | NEW |