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

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

Issue 2203013002: [test] Enable test status filtering by variant (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move status lines and deprecate --ignition-turbofan flag Created 4 years, 4 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
« tools/run-tests.py ('K') | « tools/run-tests.py ('k') | no next file » | 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 def status_file(self): 125 def status_file(self):
126 return "%s/%s.status" % (self.root, self.name) 126 return "%s/%s.status" % (self.root, self.name)
127 127
128 # Used in the status file and for stdout printing. 128 # Used in the status file and for stdout printing.
129 def CommonTestName(self, testcase): 129 def CommonTestName(self, testcase):
130 if utils.IsWindows(): 130 if utils.IsWindows():
131 return testcase.path.replace("\\", "/") 131 return testcase.path.replace("\\", "/")
132 else: 132 else:
133 return testcase.path 133 return testcase.path
134 134
135 def VirtualTestName(self, testcase):
136 """Returns the test path prefixed with the variant name."""
137 return "virtual/%s/%s" % (testcase.variant, self.CommonTestName(testcase))
138
135 def ListTests(self, context): 139 def ListTests(self, context):
136 raise NotImplementedError 140 raise NotImplementedError
137 141
138 def _VariantGeneratorFactory(self): 142 def _VariantGeneratorFactory(self):
139 """The variant generator class to be used.""" 143 """The variant generator class to be used."""
140 return VariantGenerator 144 return VariantGenerator
141 145
142 def CreateVariantGenerator(self, variants): 146 def CreateVariantGenerator(self, variants):
143 """Return a generator for the testing variants of this suite. 147 """Return a generator for the testing variants of this suite.
144 148
(...skipping 17 matching lines...) Expand all
162 @staticmethod 166 @staticmethod
163 def _FilterSlow(slow, mode): 167 def _FilterSlow(slow, mode):
164 return (mode == "run" and not slow) or (mode == "skip" and slow) 168 return (mode == "run" and not slow) or (mode == "skip" and slow)
165 169
166 @staticmethod 170 @staticmethod
167 def _FilterPassFail(pass_fail, mode): 171 def _FilterPassFail(pass_fail, mode):
168 return (mode == "run" and not pass_fail) or (mode == "skip" and pass_fail) 172 return (mode == "run" and not pass_fail) or (mode == "skip" and pass_fail)
169 173
170 def FilterTestCasesByStatus(self, warn_unused_rules, 174 def FilterTestCasesByStatus(self, warn_unused_rules,
171 slow_tests="dontcare", 175 slow_tests="dontcare",
172 pass_fail_tests="dontcare"): 176 pass_fail_tests="dontcare",
177 virtual=False):
178
179 # Use only virtual rules and wildcards when filtering virtual test cases
180 # and generic rules when filtering generic test cases.
181 filter_virtual = lambda d: {k:v for k,v in d.iteritems()
182 if not(virtual ^ k.startswith("virtual/"))}
183 rules = filter_virtual(self.rules)
184 wildcards = filter_virtual(self.wildcards)
185
173 filtered = [] 186 filtered = []
174 used_rules = set() 187 used_rules = set()
175 for t in self.tests: 188 for t in self.tests:
176 slow = False 189 slow = False
177 pass_fail = False 190 pass_fail = False
178 testname = self.CommonTestName(t) 191 testname = self.VirtualTestName(t) if virtual else self.CommonTestName(t)
179 if testname in self.rules: 192 if testname in rules:
180 used_rules.add(testname) 193 used_rules.add(testname)
181 # Even for skipped tests, as the TestCase object stays around and 194 # Even for skipped tests, as the TestCase object stays around and
182 # PrintReport() uses it. 195 # PrintReport() uses it.
183 t.outcomes = self.rules[testname] 196 t.outcomes = rules[testname]
184 if statusfile.DoSkip(t.outcomes): 197 if statusfile.DoSkip(t.outcomes):
185 continue # Don't add skipped tests to |filtered|. 198 continue # Don't add skipped tests to |filtered|.
186 for outcome in t.outcomes: 199 for outcome in t.outcomes:
187 if outcome.startswith('Flags: '): 200 if outcome.startswith('Flags: '):
188 t.flags += outcome[7:].split() 201 t.flags += outcome[7:].split()
189 slow = statusfile.IsSlow(t.outcomes) 202 slow = statusfile.IsSlow(t.outcomes)
190 pass_fail = statusfile.IsPassOrFail(t.outcomes) 203 pass_fail = statusfile.IsPassOrFail(t.outcomes)
191 skip = False 204 skip = False
192 for rule in self.wildcards: 205 for rule in wildcards:
193 assert rule[-1] == '*' 206 assert rule[-1] == '*'
194 if testname.startswith(rule[:-1]): 207 if testname.startswith(rule[:-1]):
195 used_rules.add(rule) 208 used_rules.add(rule)
196 t.outcomes |= self.wildcards[rule] 209 t.outcomes |= wildcards[rule]
197 if statusfile.DoSkip(t.outcomes): 210 if statusfile.DoSkip(t.outcomes):
198 skip = True 211 skip = True
199 break # "for rule in self.wildcards" 212 break # "for rule in wildcards"
200 slow = slow or statusfile.IsSlow(t.outcomes) 213 slow = slow or statusfile.IsSlow(t.outcomes)
201 pass_fail = pass_fail or statusfile.IsPassOrFail(t.outcomes) 214 pass_fail = pass_fail or statusfile.IsPassOrFail(t.outcomes)
202 if (skip 215 if (skip
203 or self._FilterSlow(slow, slow_tests) 216 or self._FilterSlow(slow, slow_tests)
204 or self._FilterPassFail(pass_fail, pass_fail_tests)): 217 or self._FilterPassFail(pass_fail, pass_fail_tests)):
205 continue # "for t in self.tests" 218 continue # "for t in self.tests"
206 filtered.append(t) 219 filtered.append(t)
207 self.tests = filtered 220 self.tests = filtered
208 221
209 if not warn_unused_rules: 222 if not warn_unused_rules:
210 return 223 return
211 224
212 for rule in self.rules: 225 for rule in rules:
213 if rule not in used_rules: 226 if rule not in used_rules:
214 print("Unused rule: %s -> %s" % (rule, self.rules[rule])) 227 print("Unused rule: %s -> %s" % (rule, rules[rule]))
215 for rule in self.wildcards: 228 for rule in wildcards:
216 if rule not in used_rules: 229 if rule not in used_rules:
217 print("Unused rule: %s -> %s" % (rule, self.wildcards[rule])) 230 print("Unused rule: %s -> %s" % (rule, wildcards[rule]))
218 231
219 def FilterTestCasesByArgs(self, args): 232 def FilterTestCasesByArgs(self, args):
220 """Filter test cases based on command-line arguments. 233 """Filter test cases based on command-line arguments.
221 234
222 An argument with an asterisk in the end will match all test cases 235 An argument with an asterisk in the end will match all test cases
223 that have the argument as a prefix. Without asterisk, only exact matches 236 that have the argument as a prefix. Without asterisk, only exact matches
224 will be used with the exeption of the test-suite name as argument. 237 will be used with the exeption of the test-suite name as argument.
225 """ 238 """
226 filtered = [] 239 filtered = []
227 globs = [] 240 globs = []
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return (testcase.flags + ["--gtest_filter=" + testcase.path] + 343 return (testcase.flags + ["--gtest_filter=" + testcase.path] +
331 ["--gtest_random_seed=%s" % context.random_seed] + 344 ["--gtest_random_seed=%s" % context.random_seed] +
332 ["--gtest_print_time=0"] + 345 ["--gtest_print_time=0"] +
333 context.mode_flags) 346 context.mode_flags)
334 347
335 def _VariantGeneratorFactory(self): 348 def _VariantGeneratorFactory(self):
336 return StandardVariantGenerator 349 return StandardVariantGenerator
337 350
338 def shell(self): 351 def shell(self):
339 return self.name 352 return self.name
OLDNEW
« tools/run-tests.py ('K') | « tools/run-tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698