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 'LLVM_DISABLE_CRASH_REPORT' : '1',
22 if sys.platform == 'win32':
24 'INCLUDE' : os.environ.get('INCLUDE',''),
25 'PATHEXT' : os.environ.get('PATHEXT',''),
26 'PYTHONUNBUFFERED' : '1',
27 'TEMP' : os.environ.get('TEMP',''),
28 'TMP' : os.environ.get('TMP',''),
31 config = TestingConfig(parent,
35 environment = environment,
39 test_exec_root = None,
40 test_source_root = None,
42 available_features = [])
44 if os.path.exists(path):
45 # FIXME: Improve detection and error reporting of errors in the
48 cfg_globals = dict(globals())
49 cfg_globals['config'] = config
50 cfg_globals['lit'] = litConfig
51 cfg_globals['__file__'] = path
55 litConfig.note('... loaded config %r' % path)
56 except SystemExit,status:
57 # We allow normal system exit inside a config file to just
58 # return control without error.
64 litConfig.fatal('unable to load config from %r ' % path)
66 litConfig.note('... config not found - %r' %path)
68 config.finish(litConfig)
71 def __init__(self, parent, name, suffixes, test_format,
72 environment, substitutions, unsupported, on_clone,
73 test_exec_root, test_source_root, excludes,
77 self.suffixes = set(suffixes)
78 self.test_format = test_format
79 self.environment = dict(environment)
80 self.substitutions = list(substitutions)
81 self.unsupported = unsupported
82 self.on_clone = on_clone
83 self.test_exec_root = test_exec_root
84 self.test_source_root = test_source_root
85 self.excludes = set(excludes)
86 self.available_features = set(available_features)
88 def clone(self, path):
89 # FIXME: Chain implementations?
91 # FIXME: Allow extra parameters?
92 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
93 self.environment, self.substitutions,
94 self.unsupported, self.on_clone,
95 self.test_exec_root, self.test_source_root,
96 self.excludes, self.available_features)
98 cfg.on_clone(self, cfg, path)
101 def finish(self, litConfig):
102 """finish() - Finish this config object, after loading is complete."""
104 self.name = str(self.name)
105 self.suffixes = set(self.suffixes)
106 self.environment = dict(self.environment)
107 self.substitutions = list(self.substitutions)
108 if self.test_exec_root is not None:
109 # FIXME: This should really only be suite in test suite config
110 # files. Should we distinguish them?
111 self.test_exec_root = str(self.test_exec_root)
112 if self.test_source_root is not None:
113 # FIXME: This should really only be suite in test suite config
114 # files. Should we distinguish them?
115 self.test_source_root = str(self.test_source_root)
116 self.excludes = set(self.excludes)
120 """root attribute - The root configuration for the test suite."""
121 if self.parent is None:
124 return self.parent.root