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 config = TestingConfig(parent,
36 environment = environment,
40 test_exec_root = None,
41 test_source_root = None,
43 available_features = [])
45 if os.path.exists(path):
46 # FIXME: Improve detection and error reporting of errors in the
49 cfg_globals = dict(globals())
50 cfg_globals['config'] = config
51 cfg_globals['lit'] = litConfig
52 cfg_globals['__file__'] = path
56 litConfig.note('... loaded config %r' % path)
57 except SystemExit,status:
58 # We allow normal system exit inside a config file to just
59 # return control without error.
65 litConfig.fatal('unable to load config from %r ' % path)
67 litConfig.note('... config not found - %r' %path)
69 config.finish(litConfig)
72 def __init__(self, parent, name, suffixes, test_format,
73 environment, substitutions, unsupported, on_clone,
74 test_exec_root, test_source_root, excludes,
78 self.suffixes = set(suffixes)
79 self.test_format = test_format
80 self.environment = dict(environment)
81 self.substitutions = list(substitutions)
82 self.unsupported = unsupported
83 self.on_clone = on_clone
84 self.test_exec_root = test_exec_root
85 self.test_source_root = test_source_root
86 self.excludes = set(excludes)
87 self.available_features = set(available_features)
89 def clone(self, path):
90 # FIXME: Chain implementations?
92 # FIXME: Allow extra parameters?
93 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
94 self.environment, self.substitutions,
95 self.unsupported, self.on_clone,
96 self.test_exec_root, self.test_source_root,
97 self.excludes, self.available_features)
99 cfg.on_clone(self, cfg, path)
102 def finish(self, litConfig):
103 """finish() - Finish this config object, after loading is complete."""
105 self.name = str(self.name)
106 self.suffixes = set(self.suffixes)
107 self.environment = dict(self.environment)
108 self.substitutions = list(self.substitutions)
109 if self.test_exec_root is not None:
110 # FIXME: This should really only be suite in test suite config
111 # files. Should we distinguish them?
112 self.test_exec_root = str(self.test_exec_root)
113 if self.test_source_root is not None:
114 # FIXME: This should really only be suite in test suite config
115 # files. Should we distinguish them?
116 self.test_source_root = str(self.test_source_root)
117 self.excludes = set(self.excludes)
121 """root attribute - The root configuration for the test suite."""
122 if self.parent is None:
125 return self.parent.root