Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 asterisc in the end will match all test cases | |
| 
 
Jakob Kummerow
2015/07/23 12:55:46
nit: "asterisk" is the more common spelling
 
Michael Achenbach
2015/07/23 12:59:21
Done.
 
 | |
| 181 that have the argument as a prefix. Without asterisc, 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 Loading... | |
| 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 | 
| OLD | NEW |