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

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

Issue 1251363002: [test] Let test runner only use exact matches of tests on the cmd-line. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years, 5 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
« no previous file with comments | « no previous file | 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return 168 return
169 169
170 for rule in self.rules: 170 for rule in self.rules:
171 if rule not in used_rules: 171 if rule not in used_rules:
172 print("Unused rule: %s -> %s" % (rule, self.rules[rule])) 172 print("Unused rule: %s -> %s" % (rule, self.rules[rule]))
173 for rule in self.wildcards: 173 for rule in self.wildcards:
174 if rule not in used_rules: 174 if rule not in used_rules:
175 print("Unused rule: %s -> %s" % (rule, self.wildcards[rule])) 175 print("Unused rule: %s -> %s" % (rule, self.wildcards[rule]))
176 176
177 def FilterTestCasesByArgs(self, args): 177 def FilterTestCasesByArgs(self, args):
178 """Filter test cases based on command-line arguments.
179
180 An argument with an asterisk in the end will match all test cases
181 that have the argument as a prefix. Without asterisk, only exact matches
182 will be used with the exeption of the test-suite name as argument.
183 """
178 filtered = [] 184 filtered = []
179 filtered_args = [] 185 globs = []
186 exact_matches = []
180 for a in args: 187 for a in args:
181 argpath = a.split(os.path.sep) 188 argpath = a.split(os.path.sep)
182 if argpath[0] != self.name: 189 if argpath[0] != self.name:
183 continue 190 continue
184 if len(argpath) == 1 or (len(argpath) == 2 and argpath[1] == '*'): 191 if len(argpath) == 1 or (len(argpath) == 2 and argpath[1] == '*'):
185 return # Don't filter, run all tests in this suite. 192 return # Don't filter, run all tests in this suite.
186 path = os.path.sep.join(argpath[1:]) 193 path = os.path.sep.join(argpath[1:])
187 if path[-1] == '*': 194 if path[-1] == '*':
188 path = path[:-1] 195 path = path[:-1]
189 filtered_args.append(path) 196 globs.append(path)
197 else:
198 exact_matches.append(path)
190 for t in self.tests: 199 for t in self.tests:
191 for a in filtered_args: 200 for a in globs:
192 if t.path.startswith(a): 201 if t.path.startswith(a):
193 filtered.append(t) 202 filtered.append(t)
194 break 203 break
204 for a in exact_matches:
205 if t.path == a:
206 filtered.append(t)
207 break
195 self.tests = filtered 208 self.tests = filtered
196 209
197 def GetFlagsForTestCase(self, testcase, context): 210 def GetFlagsForTestCase(self, testcase, context):
198 raise NotImplementedError 211 raise NotImplementedError
199 212
200 def GetSourceForTest(self, testcase): 213 def GetSourceForTest(self, testcase):
201 return "(no source available)" 214 return "(no source available)"
202 215
203 def IsFailureOutput(self, output, testpath): 216 def IsFailureOutput(self, output, testpath):
204 return output.exit_code != 0 217 return output.exit_code != 0
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return (testcase.flags + ["--gtest_filter=" + testcase.path] + 283 return (testcase.flags + ["--gtest_filter=" + testcase.path] +
271 ["--gtest_random_seed=%s" % context.random_seed] + 284 ["--gtest_random_seed=%s" % context.random_seed] +
272 ["--gtest_print_time=0"] + 285 ["--gtest_print_time=0"] +
273 context.mode_flags) 286 context.mode_flags)
274 287
275 def VariantFlags(self, testcase, default_flags): 288 def VariantFlags(self, testcase, default_flags):
276 return [[]] 289 return [[]]
277 290
278 def shell(self): 291 def shell(self):
279 return self.name 292 return self.name
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698