mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
lit: Add support for 'REQUIRES: feature-one, feature-two, ...' in the
integrated-test formats (sh and tcl style). The particular features which get recognized are up to the test suite itself to define. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
17aa92c92a
commit
b937549e51
@ -21,3 +21,6 @@ config.test_exec_root = None
|
|||||||
|
|
||||||
# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
|
# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
|
||||||
config.target_triple = 'foo'
|
config.target_triple = 'foo'
|
||||||
|
|
||||||
|
# available_features: Used by ShTest and TclTest formats for REQUIRES checks.
|
||||||
|
config.available_features = ['some-feature-name']
|
||||||
|
@ -422,6 +422,7 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
|
|||||||
script = []
|
script = []
|
||||||
xfails = []
|
xfails = []
|
||||||
xtargets = []
|
xtargets = []
|
||||||
|
requires = []
|
||||||
for ln in open(sourcepath):
|
for ln in open(sourcepath):
|
||||||
if 'RUN:' in ln:
|
if 'RUN:' in ln:
|
||||||
# Isolate the command to run.
|
# Isolate the command to run.
|
||||||
@ -442,6 +443,9 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
|
|||||||
elif 'XTARGET:' in ln:
|
elif 'XTARGET:' in ln:
|
||||||
items = ln[ln.index('XTARGET:') + 8:].split(',')
|
items = ln[ln.index('XTARGET:') + 8:].split(',')
|
||||||
xtargets.extend([s.strip() for s in items])
|
xtargets.extend([s.strip() for s in items])
|
||||||
|
elif 'REQUIRES:' in ln:
|
||||||
|
items = ln[ln.index('REQUIRES:') + 9:].split(',')
|
||||||
|
requires.extend([s.strip() for s in items])
|
||||||
elif 'END.' in ln:
|
elif 'END.' in ln:
|
||||||
# Check for END. lines.
|
# Check for END. lines.
|
||||||
if ln[ln.index('END.'):].strip() == 'END.':
|
if ln[ln.index('END.'):].strip() == 'END.':
|
||||||
@ -461,9 +465,18 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
|
|||||||
if not script:
|
if not script:
|
||||||
return (Test.UNRESOLVED, "Test has no run line!")
|
return (Test.UNRESOLVED, "Test has no run line!")
|
||||||
|
|
||||||
|
# Check for unterminated run lines.
|
||||||
if script[-1][-1] == '\\':
|
if script[-1][-1] == '\\':
|
||||||
return (Test.UNRESOLVED, "Test has unterminated run lines (with '\\')")
|
return (Test.UNRESOLVED, "Test has unterminated run lines (with '\\')")
|
||||||
|
|
||||||
|
# Check that we have the required features:
|
||||||
|
missing_required_features = [f for f in requires
|
||||||
|
if f not in test.config.available_features]
|
||||||
|
if missing_required_features:
|
||||||
|
msg = ', '.join(missing_required_features)
|
||||||
|
return (Test.UNSUPPORTED,
|
||||||
|
"Test requires the following features: %s" % msg)
|
||||||
|
|
||||||
isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
|
isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
|
||||||
return script,isXFail,tmpBase,execdir
|
return script,isXFail,tmpBase,execdir
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ class TestingConfig:
|
|||||||
on_clone = None,
|
on_clone = None,
|
||||||
test_exec_root = None,
|
test_exec_root = None,
|
||||||
test_source_root = None,
|
test_source_root = None,
|
||||||
excludes = [])
|
excludes = [],
|
||||||
|
available_features = [])
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
# FIXME: Improve detection and error reporting of errors in the
|
# FIXME: Improve detection and error reporting of errors in the
|
||||||
@ -54,7 +55,8 @@ class TestingConfig:
|
|||||||
|
|
||||||
def __init__(self, parent, name, suffixes, test_format,
|
def __init__(self, parent, name, suffixes, test_format,
|
||||||
environment, substitutions, unsupported, on_clone,
|
environment, substitutions, unsupported, on_clone,
|
||||||
test_exec_root, test_source_root, excludes):
|
test_exec_root, test_source_root, excludes,
|
||||||
|
available_features):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.name = str(name)
|
self.name = str(name)
|
||||||
self.suffixes = set(suffixes)
|
self.suffixes = set(suffixes)
|
||||||
@ -66,6 +68,7 @@ class TestingConfig:
|
|||||||
self.test_exec_root = test_exec_root
|
self.test_exec_root = test_exec_root
|
||||||
self.test_source_root = test_source_root
|
self.test_source_root = test_source_root
|
||||||
self.excludes = set(excludes)
|
self.excludes = set(excludes)
|
||||||
|
self.available_features = set(available_features)
|
||||||
|
|
||||||
def clone(self, path):
|
def clone(self, path):
|
||||||
# FIXME: Chain implementations?
|
# FIXME: Chain implementations?
|
||||||
@ -75,7 +78,7 @@ class TestingConfig:
|
|||||||
self.environment, self.substitutions,
|
self.environment, self.substitutions,
|
||||||
self.unsupported, self.on_clone,
|
self.unsupported, self.on_clone,
|
||||||
self.test_exec_root, self.test_source_root,
|
self.test_exec_root, self.test_source_root,
|
||||||
self.excludes)
|
self.excludes, self.available_features)
|
||||||
if cfg.on_clone:
|
if cfg.on_clone:
|
||||||
cfg.on_clone(self, cfg, path)
|
cfg.on_clone(self, cfg, path)
|
||||||
return cfg
|
return cfg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user