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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 self.datapath = os.path.join("out", "testrunner_data") | 66 self.datapath = os.path.join("out", "testrunner_data") |
67 self.perf_data_manager = perfdata.PerfDataManager(self.datapath) | 67 self.perf_data_manager = perfdata.PerfDataManager(self.datapath) |
68 self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode) | 68 self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode) |
69 self.perf_failures = False | 69 self.perf_failures = False |
70 self.printed_allocations = False | 70 self.printed_allocations = False |
71 self.tests = [ t for s in suites for t in s.tests ] | 71 self.tests = [ t for s in suites for t in s.tests ] |
72 if not context.no_sorting: | 72 if not context.no_sorting: |
73 for t in self.tests: | 73 for t in self.tests: |
74 t.duration = self.perfdata.FetchPerfData(t) or 1.0 | 74 t.duration = self.perfdata.FetchPerfData(t) or 1.0 |
75 self.tests.sort(key=lambda t: t.duration, reverse=True) | 75 self.tests.sort(key=lambda t: t.duration, reverse=True) |
76 self._CommonInit(suites, progress_indicator, context) | 76 self._CommonInit(len(self.tests), progress_indicator, context) |
77 | 77 |
78 def _CommonInit(self, suites, progress_indicator, context): | 78 def _CommonInit(self, num_tests, progress_indicator, context): |
79 self.total = 0 | |
80 for s in suites: | |
81 for t in s.tests: | |
82 t.id = self.total | |
83 self.total += 1 | |
84 self.indicator = progress_indicator | 79 self.indicator = progress_indicator |
85 progress_indicator.runner = self | 80 progress_indicator.runner = self |
86 self.context = context | 81 self.context = context |
87 self.succeeded = 0 | 82 self.succeeded = 0 |
88 self.remaining = self.total | 83 self.total = num_tests |
| 84 self.remaining = num_tests |
89 self.failed = [] | 85 self.failed = [] |
90 self.crashed = 0 | 86 self.crashed = 0 |
91 self.reran_tests = 0 | 87 self.reran_tests = 0 |
92 | 88 |
93 def _RunPerfSafe(self, fun): | 89 def _RunPerfSafe(self, fun): |
94 try: | 90 try: |
95 fun() | 91 fun() |
96 except Exception, e: | 92 except Exception, e: |
97 print("PerfData exception: %s" % e) | 93 print("PerfData exception: %s" % e) |
98 self.perf_failures = True | 94 self.perf_failures = True |
(...skipping 30 matching lines...) Expand all Loading... |
129 if test.run >= 2 and test.duration > self.context.timeout / 20.0: | 125 if test.run >= 2 and test.duration > self.context.timeout / 20.0: |
130 # Rerun slow tests at most once. | 126 # Rerun slow tests at most once. |
131 return | 127 return |
132 | 128 |
133 # Rerun this test. | 129 # Rerun this test. |
134 test.duration = None | 130 test.duration = None |
135 test.output = None | 131 test.output = None |
136 test.run += 1 | 132 test.run += 1 |
137 pool.add([self._GetJob(test)]) | 133 pool.add([self._GetJob(test)]) |
138 self.remaining += 1 | 134 self.remaining += 1 |
139 self.total += 1 | |
140 | 135 |
141 def _ProcessTestNormal(self, test, result, pool): | 136 def _ProcessTestNormal(self, test, result, pool): |
142 self.indicator.AboutToRun(test) | 137 self.indicator.AboutToRun(test) |
143 test.output = result[1] | 138 test.output = result[1] |
144 test.duration = result[2] | 139 test.duration = result[2] |
145 has_unexpected_output = test.suite.HasUnexpectedOutput(test) | 140 has_unexpected_output = test.suite.HasUnexpectedOutput(test) |
146 if has_unexpected_output: | 141 if has_unexpected_output: |
147 self.failed.append(test) | 142 self.failed.append(test) |
148 if test.output.HasCrashed(): | 143 if test.output.HasCrashed(): |
149 self.crashed += 1 | 144 self.crashed += 1 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 test.suite.GetFlagsForTestCase(test, self.context) + | 282 test.suite.GetFlagsForTestCase(test, self.context) + |
288 self.context.extra_flags) | 283 self.context.extra_flags) |
289 return cmd | 284 return cmd |
290 | 285 |
291 | 286 |
292 class BreakNowException(Exception): | 287 class BreakNowException(Exception): |
293 def __init__(self, value): | 288 def __init__(self, value): |
294 self.value = value | 289 self.value = value |
295 def __str__(self): | 290 def __str__(self): |
296 return repr(self.value) | 291 return repr(self.value) |
OLD | NEW |