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 return 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 return GoogleTestSuite(name, root) |
101 finally: | 101 finally: |
102 if f: | 102 if f: |
103 f.close() | 103 f.close() |
104 | 104 |
105 def __init__(self, name, root): | 105 def __init__(self, name, root): |
| 106 # Note: This might be called concurrently from different processes. |
| 107 # Changing harddisk state should be done in 'SetupWorkingDirectory' below. |
106 self.name = name # string | 108 self.name = name # string |
107 self.root = root # string containing path | 109 self.root = root # string containing path |
108 self.tests = None # list of TestCase objects | 110 self.tests = None # list of TestCase objects |
109 self.rules = None # dictionary mapping test path to list of outcomes | 111 self.rules = None # dictionary mapping test path to list of outcomes |
110 self.wildcards = None # dictionary mapping test paths to list of outcomes | 112 self.wildcards = None # dictionary mapping test paths to list of outcomes |
111 self.total_duration = None # float, assigned on demand | 113 self.total_duration = None # float, assigned on demand |
112 | 114 |
| 115 def SetupWorkingDirectory(self): |
| 116 # This is called once per test suite object in a multi-process setting. |
| 117 # Multi-process-unsafe work-directory setup can go here. |
| 118 pass |
| 119 |
113 def shell(self): | 120 def shell(self): |
114 return "d8" | 121 return "d8" |
115 | 122 |
116 def suffix(self): | 123 def suffix(self): |
117 return ".js" | 124 return ".js" |
118 | 125 |
119 def status_file(self): | 126 def status_file(self): |
120 return "%s/%s.status" % (self.root, self.name) | 127 return "%s/%s.status" % (self.root, self.name) |
121 | 128 |
122 # Used in the status file and for stdout printing. | 129 # 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] + | 339 return (testcase.flags + ["--gtest_filter=" + testcase.path] + |
333 ["--gtest_random_seed=%s" % context.random_seed] + | 340 ["--gtest_random_seed=%s" % context.random_seed] + |
334 ["--gtest_print_time=0"] + | 341 ["--gtest_print_time=0"] + |
335 context.mode_flags) | 342 context.mode_flags) |
336 | 343 |
337 def _VariantGeneratorFactory(self): | 344 def _VariantGeneratorFactory(self): |
338 return StandardVariantGenerator | 345 return StandardVariantGenerator |
339 | 346 |
340 def shell(self): | 347 def shell(self): |
341 return self.name | 348 return self.name |
OLD | NEW |