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 'PATHEXT' : os.environ.get('PATHEXT',''),
25 'PYTHONUNBUFFERED' : '1',
26 'TEMP' : os.environ.get('TEMP',''),
27 'TMP' : os.environ.get('TMP',''),
30 config = TestingConfig(parent,
34 environment = environment,
38 test_exec_root = None,
39 test_source_root = None,
41 available_features = [])
43 if os.path.exists(path):
44 # FIXME: Improve detection and error reporting of errors in the
47 cfg_globals = dict(globals())
48 cfg_globals['config'] = config
49 cfg_globals['lit'] = litConfig
50 cfg_globals['__file__'] = path
54 litConfig.note('... loaded config %r' % path)
55 except SystemExit,status:
56 # We allow normal system exit inside a config file to just
57 # return control without error.
63 litConfig.fatal('unable to load config from %r ' % path)
65 litConfig.note('... config not found - %r' %path)
67 config.finish(litConfig)
70 def __init__(self, parent, name, suffixes, test_format,
71 environment, substitutions, unsupported, on_clone,
72 test_exec_root, test_source_root, excludes,
76 self.suffixes = set(suffixes)
77 self.test_format = test_format
78 self.environment = dict(environment)
79 self.substitutions = list(substitutions)
80 self.unsupported = unsupported
81 self.on_clone = on_clone
82 self.test_exec_root = test_exec_root
83 self.test_source_root = test_source_root
84 self.excludes = set(excludes)
85 self.available_features = set(available_features)
87 def clone(self, path):
88 # FIXME: Chain implementations?
90 # FIXME: Allow extra parameters?
91 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
92 self.environment, self.substitutions,
93 self.unsupported, self.on_clone,
94 self.test_exec_root, self.test_source_root,
95 self.excludes, self.available_features)
97 cfg.on_clone(self, cfg, path)
100 def finish(self, litConfig):
101 """finish() - Finish this config object, after loading is complete."""
103 self.name = str(self.name)
104 self.suffixes = set(self.suffixes)
105 self.environment = dict(self.environment)
106 self.substitutions = list(self.substitutions)
107 if self.test_exec_root is not None:
108 # FIXME: This should really only be suite in test suite config
109 # files. Should we distinguish them?
110 self.test_exec_root = str(self.test_exec_root)
111 if self.test_source_root is not None:
112 # FIXME: This should really only be suite in test suite config
113 # files. Should we distinguish them?
114 self.test_source_root = str(self.test_source_root)
115 self.excludes = set(self.excludes)