mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
lit: Provide file location in cfg error messages
Python doesn't do a good job at diagnosing string exec() so use execfile() where available. This should be a timesaver when trying to get to the bottom of build bot failures. Before: File "llvm/utils/lit/lit/TestingConfig.py", line 93, in load_from_path exec("exec data in cfg_globals") File "<string>", line 1, in <module> File "<string>", line 194, in <module> NameError: name 'typo' is not defined After: File "llvm/utils/lit/lit/TestingConfig.py", line 95, in load_from_path execfile(path, cfg_globals) File "clang/test/lit.cfg", line 194, in <module> typo ^~~~ NameError: name 'typo' is not defined git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
PY2 = sys.version_info[0] < 3
|
OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 6
|
||||||
|
|
||||||
class TestingConfig:
|
class TestingConfig:
|
||||||
""""
|
""""
|
||||||
@@ -74,6 +74,8 @@ class TestingConfig:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Load the config script data.
|
# Load the config script data.
|
||||||
|
data = None
|
||||||
|
if OldPy:
|
||||||
f = open(path)
|
f = open(path)
|
||||||
try:
|
try:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
@@ -87,10 +89,10 @@ class TestingConfig:
|
|||||||
cfg_globals['lit_config'] = litConfig
|
cfg_globals['lit_config'] = litConfig
|
||||||
cfg_globals['__file__'] = path
|
cfg_globals['__file__'] = path
|
||||||
try:
|
try:
|
||||||
if PY2:
|
if OldPy:
|
||||||
exec("exec data in cfg_globals")
|
exec("exec data in cfg_globals")
|
||||||
else:
|
else:
|
||||||
exec(data, cfg_globals)
|
execfile(path, cfg_globals)
|
||||||
if litConfig.debug:
|
if litConfig.debug:
|
||||||
litConfig.note('... loaded config %r' % path)
|
litConfig.note('... loaded config %r' % path)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
Reference in New Issue
Block a user