Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: tools/testrunner/local/execution.py

Issue 307553003: Add flag to test harness to stop sorting test cases. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/run-tests.py ('k') | tools/testrunner/objects/context.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return (job.id, output, time.time() - start_time) 58 return (job.id, output, time.time() - start_time)
59 59
60 class Runner(object): 60 class Runner(object):
61 61
62 def __init__(self, suites, progress_indicator, context): 62 def __init__(self, suites, progress_indicator, context):
63 datapath = os.path.join("out", "testrunner_data") 63 datapath = os.path.join("out", "testrunner_data")
64 self.perf_data_manager = perfdata.PerfDataManager(datapath) 64 self.perf_data_manager = perfdata.PerfDataManager(datapath)
65 self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode) 65 self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode)
66 self.tests = [ t for s in suites for t in s.tests ] 66 self.tests = [ t for s in suites for t in s.tests ]
67 for t in self.tests: 67 for t in self.tests:
68 t.duration = self.perfdata.FetchPerfData(t) or 1.0 68 if not context.no_sorting:
Jakob Kummerow 2014/05/28 09:42:41 As discussed, a better implementation might be to
Michael Starzinger 2014/05/28 10:47:54 Done.
69 t.duration = self.perfdata.FetchPerfData(t) or 1.0
69 self._CommonInit(len(self.tests), progress_indicator, context) 70 self._CommonInit(len(self.tests), progress_indicator, context)
70 71
71 def _CommonInit(self, num_tests, progress_indicator, context): 72 def _CommonInit(self, num_tests, progress_indicator, context):
72 self.indicator = progress_indicator 73 self.indicator = progress_indicator
73 progress_indicator.runner = self 74 progress_indicator.runner = self
74 self.context = context 75 self.context = context
75 self.succeeded = 0 76 self.succeeded = 0
76 self.total = num_tests 77 self.total = num_tests
77 self.remaining = num_tests 78 self.remaining = num_tests
78 self.failed = [] 79 self.failed = []
79 self.crashed = 0 80 self.crashed = 0
80 81
81 def Run(self, jobs): 82 def Run(self, jobs):
82 self.indicator.Starting() 83 self.indicator.Starting()
83 self._RunInternal(jobs) 84 self._RunInternal(jobs)
84 self.indicator.Done() 85 self.indicator.Done()
85 if self.failed or self.remaining: 86 if self.failed or self.remaining:
86 return 1 87 return 1
87 return 0 88 return 0
88 89
89 def _RunInternal(self, jobs): 90 def _RunInternal(self, jobs):
90 pool = Pool(jobs) 91 pool = Pool(jobs)
91 test_map = {} 92 test_map = {}
92 # TODO(machenbach): Instead of filling the queue completely before 93 # TODO(machenbach): Instead of filling the queue completely before
93 # pool.imap_unordered, make this a generator that already starts testing 94 # pool.imap_unordered, make this a generator that already starts testing
94 # while the queue is filled. 95 # while the queue is filled.
95 queue = [] 96 queue = []
96 queued_exception = None 97 queued_exception = None
97 for test in sorted(self.tests, key=lambda t: t.duration, reverse=True): 98 for test in sorted(self.tests, key=lambda t: t.duration, reverse=True):
Jakob Kummerow 2014/05/28 09:42:41 ...and instead do here: if not self.context.no_so
Michael Starzinger 2014/05/28 10:47:54 Done.
98 assert test.id >= 0 99 assert test.id >= 0
99 test_map[test.id] = test 100 test_map[test.id] = test
100 try: 101 try:
101 command = self.GetCommand(test) 102 command = self.GetCommand(test)
102 except Exception, e: 103 except Exception, e:
103 # If this failed, save the exception and re-raise it later (after 104 # If this failed, save the exception and re-raise it later (after
104 # all other tests have had a chance to run). 105 # all other tests have had a chance to run).
105 queued_exception = e 106 queued_exception = e
106 continue 107 continue
107 timeout = self.context.timeout 108 timeout = self.context.timeout
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 test.suite.GetFlagsForTestCase(test, self.context) + 158 test.suite.GetFlagsForTestCase(test, self.context) +
158 self.context.extra_flags) 159 self.context.extra_flags)
159 return cmd 160 return cmd
160 161
161 162
162 class BreakNowException(Exception): 163 class BreakNowException(Exception):
163 def __init__(self, value): 164 def __init__(self, value):
164 self.value = value 165 self.value = value
165 def __str__(self): 166 def __str__(self):
166 return repr(self.value) 167 return repr(self.value)
OLDNEW
« no previous file with comments | « tools/run-tests.py ('k') | tools/testrunner/objects/context.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698