5 TestingConfig - Information on the tests inside a suite.
9 def frompath(path
, parent
, litConfig
, mustExist
, config
= None):
11 # Set the environment based on the command line arguments.
13 'PATH' : os
.pathsep
.join(litConfig
.path
+
14 [os
.environ
.get('PATH','')]),
15 'SYSTEMROOT' : os
.environ
.get('SYSTEMROOT',''),
18 config
= TestingConfig(parent
,
22 environment
= environment
,
26 test_exec_root
= None,
27 test_source_root
= None,
30 if os
.path
.exists(path
):
31 # FIXME: Improve detection and error reporting of errors in the
34 cfg_globals
= dict(globals())
35 cfg_globals
['config'] = config
36 cfg_globals
['lit'] = litConfig
37 cfg_globals
['__file__'] = path
40 except SystemExit,status
:
41 # We allow normal system exit inside a config file to just
42 # return control without error.
47 litConfig
.fatal('unable to load config from %r ' % path
)
49 config
.finish(litConfig
)
52 def __init__(self
, parent
, name
, suffixes
, test_format
,
53 environment
, substitutions
, unsupported
, on_clone
,
54 test_exec_root
, test_source_root
, excludes
):
57 self
.suffixes
= set(suffixes
)
58 self
.test_format
= test_format
59 self
.environment
= dict(environment
)
60 self
.substitutions
= list(substitutions
)
61 self
.unsupported
= unsupported
62 self
.on_clone
= on_clone
63 self
.test_exec_root
= test_exec_root
64 self
.test_source_root
= test_source_root
65 self
.excludes
= set(excludes
)
67 def clone(self
, path
):
68 # FIXME: Chain implementations?
70 # FIXME: Allow extra parameters?
71 cfg
= TestingConfig(self
, self
.name
, self
.suffixes
, self
.test_format
,
72 self
.environment
, self
.substitutions
,
73 self
.unsupported
, self
.on_clone
,
74 self
.test_exec_root
, self
.test_source_root
,
77 cfg
.on_clone(self
, cfg
, path
)
80 def finish(self
, litConfig
):
81 """finish() - Finish this config object, after loading is complete."""
83 self
.name
= str(self
.name
)
84 self
.suffixes
= set(self
.suffixes
)
85 self
.environment
= dict(self
.environment
)
86 self
.substitutions
= list(self
.substitutions
)
87 if self
.test_exec_root
is not None:
88 # FIXME: This should really only be suite in test suite config
89 # files. Should we distinguish them?
90 self
.test_exec_root
= str(self
.test_exec_root
)
91 if self
.test_source_root
is not None:
92 # FIXME: This should really only be suite in test suite config
93 # files. Should we distinguish them?
94 self
.test_source_root
= str(self
.test_source_root
)
95 self
.excludes
= set(self
.excludes
)