6 TestingConfig - Information on the tests inside a suite.
10 def frompath(path, parent, litConfig, mustExist, config = None):
12 # Set the environment based on the command line arguments.
14 'LIBRARY_PATH' : os.environ.get('LIBRARY_PATH',''),
15 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH',''),
16 'PATH' : os.pathsep.join(litConfig.path +
17 [os.environ.get('PATH','')]),
18 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''),
21 if sys.platform == 'win32':
23 'LLVM_DISABLE_CRT_DEBUG' : '1',
24 'PATHEXT' : os.environ.get('PATHEXT',''),
25 'PYTHONUNBUFFERED' : '1',
28 config = TestingConfig(parent,
32 environment = environment,
36 test_exec_root = None,
37 test_source_root = None,
39 available_features = [])
41 if os.path.exists(path):
42 # FIXME: Improve detection and error reporting of errors in the
45 cfg_globals = dict(globals())
46 cfg_globals['config'] = config
47 cfg_globals['lit'] = litConfig
48 cfg_globals['__file__'] = path
51 except SystemExit,status:
52 # We allow normal system exit inside a config file to just
53 # return control without error.
58 litConfig.fatal('unable to load config from %r ' % path)
60 config.finish(litConfig)
63 def __init__(self, parent, name, suffixes, test_format,
64 environment, substitutions, unsupported, on_clone,
65 test_exec_root, test_source_root, excludes,
69 self.suffixes = set(suffixes)
70 self.test_format = test_format
71 self.environment = dict(environment)
72 self.substitutions = list(substitutions)
73 self.unsupported = unsupported
74 self.on_clone = on_clone
75 self.test_exec_root = test_exec_root
76 self.test_source_root = test_source_root
77 self.excludes = set(excludes)
78 self.available_features = set(available_features)
80 def clone(self, path):
81 # FIXME: Chain implementations?
83 # FIXME: Allow extra parameters?
84 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
85 self.environment, self.substitutions,
86 self.unsupported, self.on_clone,
87 self.test_exec_root, self.test_source_root,
88 self.excludes, self.available_features)
90 cfg.on_clone(self, cfg, path)
93 def finish(self, litConfig):
94 """finish() - Finish this config object, after loading is complete."""
96 self.name = str(self.name)
97 self.suffixes = set(self.suffixes)
98 self.environment = dict(self.environment)
99 self.substitutions = list(self.substitutions)
100 if self.test_exec_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_exec_root = str(self.test_exec_root)
104 if self.test_source_root is not None:
105 # FIXME: This should really only be suite in test suite config
106 # files. Should we distinguish them?
107 self.test_source_root = str(self.test_source_root)
108 self.excludes = set(self.excludes)