5 TestingConfig - Information on the tests inside a suite.
9 def frompath(path, parent, litConfig, mustExist, config = None):
11 # Set the environment based on the command line arguments.
13 'LIBRARY_PATH' : os.environ.get('LIBRARY_PATH',''),
14 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH',''),
15 'PATH' : os.pathsep.join(litConfig.path +
16 [os.environ.get('PATH','')]),
17 'PATHEXT' : os.environ.get('PATHEXT',''),
18 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''),
19 'LLVM_DISABLE_CRT_DEBUG' : '1',
20 'PYTHONUNBUFFERED' : '1',
23 config = TestingConfig(parent,
27 environment = environment,
31 test_exec_root = None,
32 test_source_root = None,
34 available_features = [])
36 if os.path.exists(path):
37 # FIXME: Improve detection and error reporting of errors in the
40 cfg_globals = dict(globals())
41 cfg_globals['config'] = config
42 cfg_globals['lit'] = litConfig
43 cfg_globals['__file__'] = path
46 except SystemExit,status:
47 # We allow normal system exit inside a config file to just
48 # return control without error.
53 litConfig.fatal('unable to load config from %r ' % path)
55 config.finish(litConfig)
58 def __init__(self, parent, name, suffixes, test_format,
59 environment, substitutions, unsupported, on_clone,
60 test_exec_root, test_source_root, excludes,
64 self.suffixes = set(suffixes)
65 self.test_format = test_format
66 self.environment = dict(environment)
67 self.substitutions = list(substitutions)
68 self.unsupported = unsupported
69 self.on_clone = on_clone
70 self.test_exec_root = test_exec_root
71 self.test_source_root = test_source_root
72 self.excludes = set(excludes)
73 self.available_features = set(available_features)
75 def clone(self, path):
76 # FIXME: Chain implementations?
77 # See attribute chaining in finish()
79 # FIXME: Allow extra parameters?
80 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
81 self.environment, self.substitutions,
82 self.unsupported, self.on_clone,
83 self.test_exec_root, self.test_source_root,
84 self.excludes, self.available_features)
86 cfg.on_clone(self, cfg, path)
89 def finish(self, litConfig):
90 """finish() - Finish this config object, after loading is complete."""
92 self.name = str(self.name)
93 self.suffixes = set(self.suffixes)
94 self.environment = dict(self.environment)
95 self.substitutions = list(self.substitutions)
96 if self.test_exec_root is not None:
97 # FIXME: This should really only be suite in test suite config
98 # files. Should we distinguish them?
99 self.test_exec_root = str(self.test_exec_root)
100 if self.test_source_root is not None:
101 # FIXME: This should really only be suite in test suite config
102 # files. Should we distinguish them?
103 self.test_source_root = str(self.test_source_root)
104 self.excludes = set(self.excludes)
106 # chain attributes by copying them
108 for k,v in vars(self.parent).items():
109 if not hasattr(self, k):