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,
53 if os.path.exists(path):
54 # FIXME: Improve detection and error reporting of errors in the
57 cfg_globals = dict(globals())
58 cfg_globals['config'] = config
59 cfg_globals['lit'] = litConfig
60 cfg_globals['__file__'] = path
64 litConfig.note('... loaded config %r' % path)
65 except SystemExit,status:
66 # We allow normal system exit inside a config file to just
67 # return control without error.
73 litConfig.fatal('unable to load config from %r ' % path)
75 litConfig.note('... config not found - %r' %path)
77 config.finish(litConfig)
80 def __init__(self, parent, name, suffixes, test_format,
81 environment, substitutions, unsupported, on_clone,
82 test_exec_root, test_source_root, excludes,
83 available_features, pipefail):
86 self.suffixes = set(suffixes)
87 self.test_format = test_format
88 self.environment = dict(environment)
89 self.substitutions = list(substitutions)
90 self.unsupported = unsupported
91 self.on_clone = on_clone
92 self.test_exec_root = test_exec_root
93 self.test_source_root = test_source_root
94 self.excludes = set(excludes)
95 self.available_features = set(available_features)
96 self.pipefail = pipefail
98 def clone(self, path):
99 # FIXME: Chain implementations?
101 # FIXME: Allow extra parameters?
102 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
103 self.environment, self.substitutions,
104 self.unsupported, self.on_clone,
105 self.test_exec_root, self.test_source_root,
106 self.excludes, self.available_features,
109 cfg.on_clone(self, cfg, path)
112 def finish(self, litConfig):
113 """finish() - Finish this config object, after loading is complete."""
115 self.name = str(self.name)
116 self.suffixes = set(self.suffixes)
117 self.environment = dict(self.environment)
118 self.substitutions = list(self.substitutions)
119 if self.test_exec_root is not None:
120 # FIXME: This should really only be suite in test suite config
121 # files. Should we distinguish them?
122 self.test_exec_root = str(self.test_exec_root)
123 if self.test_source_root is not None:
124 # FIXME: This should really only be suite in test suite config
125 # files. Should we distinguish them?
126 self.test_source_root = str(self.test_source_root)
127 self.excludes = set(self.excludes)
131 """root attribute - The root configuration for the test suite."""
132 if self.parent is None:
135 return self.parent.root