fix an embarassing typo that resulted in llvm-gcc bootstrap miscompare
[llvm/avr.git] / utils / lit / LitConfig.py
blob4fb0ccc09353067e8dedd796e570591a5264d9e6
1 class LitConfig:
2 """LitConfig - Configuration data for a 'lit' test runner instance, shared
3 across all tests.
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
8 easily.
9 """
11 # Provide access to built-in formats.
12 import LitFormats as formats
14 # Provide access to built-in utility functions.
15 import Util as util
17 def __init__(self, progname, path, quiet,
18 useValgrind, valgrindArgs,
19 useTclAsSh,
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
30 self.debug = debug
31 self.isWindows = bool(isWindows)
33 self.numErrors = 0
34 self.numWarnings = 0
36 def load_config(self, config, path):
37 """load_config(config, path) - Load a config object from an alternate
38 path."""
39 from TestingConfig import TestingConfig
40 return TestingConfig.frompath(path, config.parent, self,
41 mustExist = True,
42 config = config)
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.
50 f = f.f_back.f_back
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,
55 kind, message)
57 def note(self, message):
58 self._write_message('note', message)
60 def warning(self, message):
61 self._write_message('warning', message)
62 self.numWarnings += 1
64 def error(self, message):
65 self._write_message('error', message)
66 self.numErrors += 1
68 def fatal(self, message):
69 import sys
70 self._write_message('fatal', message)
71 sys.exit(2)