2 """LitConfig - Configuration data for a 'lit' test runner instance, shared
5 The LitConfig object is also used to communicate with client configuration
6 files, it is always passed in as the global variable 'lit' so that
7 configuration files can access common functionality and internal components
11 # Provide access to built-in formats.
12 import LitFormats
as formats
14 # Provide access to built-in utility functions.
17 def __init__(self
, progname
, path
, quiet
,
18 useValgrind
, valgrindArgs
,
20 noExecute
, debug
, isWindows
):
21 # The name of the test runner.
22 self
.progname
= progname
23 # The items to add to the PATH environment variable.
24 self
.path
= list(map(str, path
))
25 self
.quiet
= bool(quiet
)
26 self
.useValgrind
= bool(useValgrind
)
27 self
.valgrindArgs
= list(valgrindArgs
)
28 self
.useTclAsSh
= bool(useTclAsSh
)
29 self
.noExecute
= noExecute
31 self
.isWindows
= bool(isWindows
)
36 def load_config(self
, config
, path
):
37 """load_config(config, path) - Load a config object from an alternate
39 from TestingConfig
import TestingConfig
40 return TestingConfig
.frompath(path
, config
.parent
, self
,
44 def _write_message(self
, kind
, message
):
45 import inspect
, os
, sys
47 # Get the file/line where this message was generated.
48 f
= inspect
.currentframe()
49 # Step out of _write_message, and then out of wrapper.
51 file,line
,_
,_
,_
= inspect
.getframeinfo(f
)
52 location
= '%s:%d' % (os
.path
.basename(file), line
)
54 print >>sys
.stderr
, '%s: %s: %s: %s' % (self
.progname
, location
,
57 def note(self
, message
):
58 self
._write
_message
('note', message
)
60 def warning(self
, message
):
61 self
._write
_message
('warning', message
)
64 def error(self
, message
):
65 self
._write
_message
('error', message
)
68 def fatal(self
, message
):
70 self
._write
_message
('fatal', message
)