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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 import imp | 29 import imp |
30 import os | 30 import os |
31 | 31 |
32 from . import statusfile | 32 from . import statusfile |
33 from . import utils | 33 from . import utils |
34 | 34 |
35 class TestSuite(object): | 35 class TestSuite(object): |
36 | 36 |
37 @staticmethod | 37 @staticmethod |
38 def LoadTestSuite(root): | 38 def LoadTestSuite(root, default): |
39 name = root.split(os.path.sep)[-1] | 39 name = root.split(os.path.sep)[-1] |
40 f = None | 40 f = None |
41 try: | 41 try: |
42 (f, pathname, description) = imp.find_module("testcfg", [root]) | 42 (f, pathname, description) = imp.find_module("testcfg", [root]) |
43 module = imp.load_module("testcfg", f, pathname, description) | 43 module = imp.load_module("testcfg", f, pathname, description) |
44 suite = module.GetSuite(name, root) | 44 return module.GetSuite(name, root) |
| 45 except: |
| 46 # Use default if no testcfg is present. |
| 47 return default(name, root) |
45 finally: | 48 finally: |
46 if f: | 49 if f: |
47 f.close() | 50 f.close() |
48 return suite | |
49 | 51 |
50 def __init__(self, name, root): | 52 def __init__(self, name, root): |
51 self.name = name # string | 53 self.name = name # string |
52 self.root = root # string containing path | 54 self.root = root # string containing path |
53 self.tests = None # list of TestCase objects | 55 self.tests = None # list of TestCase objects |
54 self.rules = None # dictionary mapping test path to list of outcomes | 56 self.rules = None # dictionary mapping test path to list of outcomes |
55 self.wildcards = None # dictionary mapping test paths to list of outcomes | 57 self.wildcards = None # dictionary mapping test paths to list of outcomes |
56 self.total_duration = None # float, assigned on demand | 58 self.total_duration = None # float, assigned on demand |
57 | 59 |
58 def shell(self): | 60 def shell(self): |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 def StripOutputForTransmit(self, testcase): | 209 def StripOutputForTransmit(self, testcase): |
208 if not self.HasUnexpectedOutput(testcase): | 210 if not self.HasUnexpectedOutput(testcase): |
209 testcase.output.stdout = "" | 211 testcase.output.stdout = "" |
210 testcase.output.stderr = "" | 212 testcase.output.stderr = "" |
211 | 213 |
212 def CalculateTotalDuration(self): | 214 def CalculateTotalDuration(self): |
213 self.total_duration = 0.0 | 215 self.total_duration = 0.0 |
214 for t in self.tests: | 216 for t in self.tests: |
215 self.total_duration += t.duration | 217 self.total_duration += t.duration |
216 return self.total_duration | 218 return self.total_duration |
OLD | NEW |