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',''),
19 'TERM' : os.environ.get('TERM',''),
20 'LLVM_DISABLE_CRASH_REPORT' : '1',
23 if sys.platform == 'win32':
25 'INCLUDE' : os.environ.get('INCLUDE',''),
26 'PATHEXT' : os.environ.get('PATHEXT',''),
27 'PYTHONUNBUFFERED' : '1',
28 'TEMP' : os.environ.get('TEMP',''),
29 'TMP' : os.environ.get('TMP',''),
32 # Set the default available features based on the LitConfig.
33 available_features = []
34 if litConfig.useValgrind:
35 available_features.append('valgrind')
36 if litConfig.valgrindLeakCheck:
37 available_features.append('vg_leak')
39 config = TestingConfig(parent,
43 environment = environment,
47 test_exec_root = None,
48 test_source_root = None,
50 available_features = available_features)
52 if os.path.exists(path):
53 # FIXME: Improve detection and error reporting of errors in the
56 cfg_globals = dict(globals())
57 cfg_globals['config'] = config
58 cfg_globals['lit'] = litConfig
59 cfg_globals['__file__'] = path
63 litConfig.note('... loaded config %r' % path)
64 except SystemExit,status:
65 # We allow normal system exit inside a config file to just
66 # return control without error.
72 litConfig.fatal('unable to load config from %r ' % path)
74 litConfig.note('... config not found - %r' %path)
76 config.finish(litConfig)
79 def __init__(self, parent, name, suffixes, test_format,
80 environment, substitutions, unsupported, on_clone,
81 test_exec_root, test_source_root, excludes,
85 self.suffixes = set(suffixes)
86 self.test_format = test_format
87 self.environment = dict(environment)
88 self.substitutions = list(substitutions)
89 self.unsupported = unsupported
90 self.on_clone = on_clone
91 self.test_exec_root = test_exec_root
92 self.test_source_root = test_source_root
93 self.excludes = set(excludes)
94 self.available_features = set(available_features)
97 def clone(self, path):
98 # FIXME: Chain implementations?
100 # FIXME: Allow extra parameters?
101 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
102 self.environment, self.substitutions,
103 self.unsupported, self.on_clone,
104 self.test_exec_root, self.test_source_root,
105 self.excludes, self.available_features)
107 cfg.on_clone(self, cfg, path)
110 def finish(self, litConfig):
111 """finish() - Finish this config object, after loading is complete."""
113 self.name = str(self.name)
114 self.suffixes = set(self.suffixes)
115 self.environment = dict(self.environment)
116 self.substitutions = list(self.substitutions)
117 if self.test_exec_root is not None:
118 # FIXME: This should really only be suite in test suite config
119 # files. Should we distinguish them?
120 self.test_exec_root = str(self.test_exec_root)
121 if self.test_source_root is not None:
122 # FIXME: This should really only be suite in test suite config
123 # files. Should we distinguish them?
124 self.test_source_root = str(self.test_source_root)
125 self.excludes = set(self.excludes)
129 """root attribute - The root configuration for the test suite."""
130 if self.parent is None:
133 return self.parent.root