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 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH',''),
14 'PATH' : os.pathsep.join(litConfig.path +
15 [os.environ.get('PATH','')]),
16 'PATHEXT' : os.environ.get('PATHEXT',''),
17 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''),
18 'LLVM_DISABLE_CRT_DEBUG' : '1',
21 config = TestingConfig(parent,
25 environment = environment,
29 test_exec_root = None,
30 test_source_root = None,
33 if os.path.exists(path):
34 # FIXME: Improve detection and error reporting of errors in the
37 cfg_globals = dict(globals())
38 cfg_globals['config'] = config
39 cfg_globals['lit'] = litConfig
40 cfg_globals['__file__'] = path
43 except SystemExit,status:
44 # We allow normal system exit inside a config file to just
45 # return control without error.
50 litConfig.fatal('unable to load config from %r ' % path)
52 config.finish(litConfig)
55 def __init__(self, parent, name, suffixes, test_format,
56 environment, substitutions, unsupported, on_clone,
57 test_exec_root, test_source_root, excludes):
60 self.suffixes = set(suffixes)
61 self.test_format = test_format
62 self.environment = dict(environment)
63 self.substitutions = list(substitutions)
64 self.unsupported = unsupported
65 self.on_clone = on_clone
66 self.test_exec_root = test_exec_root
67 self.test_source_root = test_source_root
68 self.excludes = set(excludes)
70 def clone(self, path):
71 # FIXME: Chain implementations?
73 # FIXME: Allow extra parameters?
74 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
75 self.environment, self.substitutions,
76 self.unsupported, self.on_clone,
77 self.test_exec_root, self.test_source_root,
80 cfg.on_clone(self, cfg, path)
83 def finish(self, litConfig):
84 """finish() - Finish this config object, after loading is complete."""
86 self.name = str(self.name)
87 self.suffixes = set(self.suffixes)
88 self.environment = dict(self.environment)
89 self.substitutions = list(self.substitutions)
90 if self.test_exec_root is not None:
91 # FIXME: This should really only be suite in test suite config
92 # files. Should we distinguish them?
93 self.test_exec_root = str(self.test_exec_root)
94 if self.test_source_root is not None:
95 # FIXME: This should really only be suite in test suite config
96 # files. Should we distinguish them?
97 self.test_source_root = str(self.test_source_root)
98 self.excludes = set(self.excludes)