mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
[lit] Eliminate mustExist parameter from TestingConfig.frompath().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3279653eb8
commit
49e51429c1
@ -72,8 +72,7 @@ class LitConfig:
|
|||||||
path."""
|
path."""
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.note('load_config from %r' % path)
|
self.note('load_config from %r' % path)
|
||||||
return lit.TestingConfig.TestingConfig.frompath(
|
return lit.TestingConfig.TestingConfig.frompath(path, config, self)
|
||||||
path, config, self, mustExist = True)
|
|
||||||
|
|
||||||
def getBashPath(self):
|
def getBashPath(self):
|
||||||
"""getBashPath - Get the path to 'bash'"""
|
"""getBashPath - Get the path to 'bash'"""
|
||||||
|
@ -9,7 +9,7 @@ class TestingConfig:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def frompath(path, config, litConfig, mustExist=True):
|
def frompath(path, config, litConfig):
|
||||||
"""
|
"""
|
||||||
frompath(path, config, litConfig, mustExist) -> TestingConfig
|
frompath(path, config, litConfig, mustExist) -> TestingConfig
|
||||||
|
|
||||||
@ -58,39 +58,37 @@ class TestingConfig:
|
|||||||
available_features = available_features,
|
available_features = available_features,
|
||||||
pipefail = True)
|
pipefail = True)
|
||||||
|
|
||||||
if os.path.exists(path):
|
# Load the config script data.
|
||||||
# FIXME: Improve detection and error reporting of errors in the
|
f = open(path)
|
||||||
# config file.
|
try:
|
||||||
f = open(path)
|
data = f.read()
|
||||||
cfg_globals = dict(globals())
|
except:
|
||||||
cfg_globals['config'] = config
|
litConfig.fatal('unable to load config file: %r' % (path,))
|
||||||
cfg_globals['lit'] = litConfig
|
f.close()
|
||||||
cfg_globals['__file__'] = path
|
|
||||||
try:
|
# Execute the config script to initialize the object.
|
||||||
data = f.read()
|
cfg_globals = dict(globals())
|
||||||
if PY2:
|
cfg_globals['config'] = config
|
||||||
exec("exec data in cfg_globals")
|
cfg_globals['lit'] = litConfig
|
||||||
else:
|
cfg_globals['__file__'] = path
|
||||||
exec(data, cfg_globals)
|
try:
|
||||||
if litConfig.debug:
|
if PY2:
|
||||||
litConfig.note('... loaded config %r' % path)
|
exec("exec data in cfg_globals")
|
||||||
except SystemExit:
|
else:
|
||||||
e = sys.exc_info()[1]
|
exec(data, cfg_globals)
|
||||||
# We allow normal system exit inside a config file to just
|
if litConfig.debug:
|
||||||
# return control without error.
|
litConfig.note('... loaded config %r' % path)
|
||||||
if e.args:
|
except SystemExit:
|
||||||
raise
|
e = sys.exc_info()[1]
|
||||||
except:
|
# We allow normal system exit inside a config file to just
|
||||||
import traceback
|
# return control without error.
|
||||||
litConfig.fatal(
|
if e.args:
|
||||||
'unable to parse config file %r, traceback: %s' % (
|
raise
|
||||||
path, traceback.format_exc()))
|
except:
|
||||||
f.close()
|
import traceback
|
||||||
else:
|
litConfig.fatal(
|
||||||
if mustExist:
|
'unable to parse config file %r, traceback: %s' % (
|
||||||
litConfig.fatal('unable to load config from %r ' % path)
|
path, traceback.format_exc()))
|
||||||
elif litConfig.debug:
|
|
||||||
litConfig.note('... config not found - %r' %path)
|
|
||||||
|
|
||||||
config.finish(litConfig)
|
config.finish(litConfig)
|
||||||
return config
|
return config
|
||||||
|
@ -42,7 +42,7 @@ def getTestSuite(item, litConfig, cache):
|
|||||||
if litConfig.debug:
|
if litConfig.debug:
|
||||||
litConfig.note('loading suite config %r' % cfgpath)
|
litConfig.note('loading suite config %r' % cfgpath)
|
||||||
|
|
||||||
cfg = TestingConfig.frompath(cfgpath, None, litConfig, mustExist = True)
|
cfg = TestingConfig.frompath(cfgpath, None, litConfig)
|
||||||
source_root = os.path.realpath(cfg.test_source_root or path)
|
source_root = os.path.realpath(cfg.test_source_root or path)
|
||||||
exec_root = os.path.realpath(cfg.test_exec_root or path)
|
exec_root = os.path.realpath(cfg.test_exec_root or path)
|
||||||
return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
|
return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user