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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 def GetFlagSets(self, testcase, variant): | 81 def GetFlagSets(self, testcase, variant): |
| 82 if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes): | 82 if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes): |
| 83 return FAST_VARIANT_FLAGS[variant] | 83 return FAST_VARIANT_FLAGS[variant] |
| 84 else: | 84 else: |
| 85 return ALL_VARIANT_FLAGS[variant] | 85 return ALL_VARIANT_FLAGS[variant] |
| 86 | 86 |
| 87 | 87 |
| 88 class TestSuite(object): | 88 class TestSuite(object): |
| 89 | 89 |
| 90 @staticmethod | 90 @staticmethod |
| 91 def LoadTestSuite(root): | 91 def LoadTestSuite(root, global_init=True): |
| 92 name = root.split(os.path.sep)[-1] | 92 name = root.split(os.path.sep)[-1] |
| 93 f = None | 93 f = None |
| 94 try: | 94 try: |
| 95 (f, pathname, description) = imp.find_module("testcfg", [root]) | 95 (f, pathname, description) = imp.find_module("testcfg", [root]) |
| 96 module = imp.load_module("testcfg", f, pathname, description) | 96 module = imp.load_module("testcfg", f, pathname, description) |
| 97 return module.GetSuite(name, root) | 97 suite = module.GetSuite(name, root) |
| 98 except ImportError: | 98 except ImportError: |
| 99 # Use default if no testcfg is present. | 99 # Use default if no testcfg is present. |
| 100 return GoogleTestSuite(name, root) | 100 suite = GoogleTestSuite(name, root) |
| 101 finally: | 101 finally: |
| 102 if f: | 102 if f: |
| 103 f.close() | 103 f.close() |
| 104 if global_init: | |
| 105 suite.global_initialization() | |
| 106 return suite | |
| 104 | 107 |
| 105 def __init__(self, name, root): | 108 def __init__(self, name, root): |
| 109 # Note: This might be called concurrently from different processes. Global | |
| 110 # state (e.g. harddisk state) should be initialized in | |
| 111 # 'global_initialization' below. | |
| 106 self.name = name # string | 112 self.name = name # string |
| 107 self.root = root # string containing path | 113 self.root = root # string containing path |
| 108 self.tests = None # list of TestCase objects | 114 self.tests = None # list of TestCase objects |
| 109 self.rules = None # dictionary mapping test path to list of outcomes | 115 self.rules = None # dictionary mapping test path to list of outcomes |
| 110 self.wildcards = None # dictionary mapping test paths to list of outcomes | 116 self.wildcards = None # dictionary mapping test paths to list of outcomes |
| 111 self.total_duration = None # float, assigned on demand | 117 self.total_duration = None # float, assigned on demand |
| 112 | 118 |
| 119 def global_initialization(self): | |
|
Jakob Kummerow
2015/11/27 10:09:00
I'd keep the original LoadTestSuite and __init__ w
Michael Achenbach
2015/11/27 10:31:21
Method name ack. Regarding calling: I'll have to a
Jakob Kummerow
2015/11/27 10:34:41
Hm... that's a bit less elegant than I was hoping,
Michael Achenbach
2015/11/27 10:58:29
Done.
| |
| 120 # This is called once per test suite object in a multi-process setting. | |
| 121 # Logic that is not multi-process-safe can go here, e.g. set up of a | |
| 122 # working directory for the suite. | |
| 123 pass | |
| 124 | |
| 113 def shell(self): | 125 def shell(self): |
| 114 return "d8" | 126 return "d8" |
| 115 | 127 |
| 116 def suffix(self): | 128 def suffix(self): |
| 117 return ".js" | 129 return ".js" |
| 118 | 130 |
| 119 def status_file(self): | 131 def status_file(self): |
| 120 return "%s/%s.status" % (self.root, self.name) | 132 return "%s/%s.status" % (self.root, self.name) |
| 121 | 133 |
| 122 # Used in the status file and for stdout printing. | 134 # Used in the status file and for stdout printing. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 return (testcase.flags + ["--gtest_filter=" + testcase.path] + | 344 return (testcase.flags + ["--gtest_filter=" + testcase.path] + |
| 333 ["--gtest_random_seed=%s" % context.random_seed] + | 345 ["--gtest_random_seed=%s" % context.random_seed] + |
| 334 ["--gtest_print_time=0"] + | 346 ["--gtest_print_time=0"] + |
| 335 context.mode_flags) | 347 context.mode_flags) |
| 336 | 348 |
| 337 def _VariantGeneratorFactory(self): | 349 def _VariantGeneratorFactory(self): |
| 338 return StandardVariantGenerator | 350 return StandardVariantGenerator |
| 339 | 351 |
| 340 def shell(self): | 352 def shell(self): |
| 341 return self.name | 353 return self.name |
| OLD | NEW |