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
53 except SystemExit,status:
54 # We allow normal system exit inside a config file to just
55 # return control without error.
60 litConfig.fatal('unable to load config from %r ' % path)
62 config.finish(litConfig)
65 def __init__(self, parent, name, suffixes, test_format,
66 environment, substitutions, unsupported, on_clone,
67 test_exec_root, test_source_root, excludes,
71 self.suffixes = set(suffixes)
72 self.test_format = test_format
73 self.environment = dict(environment)
74 self.substitutions = list(substitutions)
75 self.unsupported = unsupported
76 self.on_clone = on_clone
77 self.test_exec_root = test_exec_root
78 self.test_source_root = test_source_root
79 self.excludes = set(excludes)
80 self.available_features = set(available_features)
82 def clone(self, path):
83 # FIXME: Chain implementations?
85 # FIXME: Allow extra parameters?
86 cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
87 self.environment, self.substitutions,
88 self.unsupported, self.on_clone,
89 self.test_exec_root, self.test_source_root,
90 self.excludes, self.available_features)
92 cfg.on_clone(self, cfg, path)
95 def finish(self, litConfig):
96 """finish() - Finish this config object, after loading is complete."""
98 self.name = str(self.name)
99 self.suffixes = set(self.suffixes)
100 self.environment = dict(self.environment)
101 self.substitutions = list(self.substitutions)
102 if self.test_exec_root is not None:
103 # FIXME: This should really only be suite in test suite config
104 # files. Should we distinguish them?
105 self.test_exec_root = str(self.test_exec_root)
106 if self.test_source_root is not None:
107 # FIXME: This should really only be suite in test suite config
108 # files. Should we distinguish them?
109 self.test_source_root = str(self.test_source_root)
110 self.excludes = set(self.excludes)