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