mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01: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. llvm-svn: 109062
This commit is contained in:
parent
859ffd353e
commit
044ebec2b8
@ -21,3 +21,6 @@ config.test_exec_root = None
|
||||
|
||||
# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
|
||||
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 = []
|
||||
xfails = []
|
||||
xtargets = []
|
||||
requires = []
|
||||
for ln in open(sourcepath):
|
||||
if 'RUN:' in ln:
|
||||
# Isolate the command to run.
|
||||
@ -442,6 +443,9 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
|
||||
elif 'XTARGET:' in ln:
|
||||
items = ln[ln.index('XTARGET:') + 8:].split(',')
|
||||
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:
|
||||
# Check for END. lines.
|
||||
if ln[ln.index('END.'):].strip() == 'END.':
|
||||
@ -461,9 +465,18 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
|
||||
if not script:
|
||||
return (Test.UNRESOLVED, "Test has no run line!")
|
||||
|
||||
# Check for unterminated run lines.
|
||||
if script[-1][-1] == '\\':
|
||||
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)
|
||||
return script,isXFail,tmpBase,execdir
|
||||
|
||||
|
@ -28,7 +28,8 @@ class TestingConfig:
|
||||
on_clone = None,
|
||||
test_exec_root = None,
|
||||
test_source_root = None,
|
||||
excludes = [])
|
||||
excludes = [],
|
||||
available_features = [])
|
||||
|
||||
if os.path.exists(path):
|
||||
# FIXME: Improve detection and error reporting of errors in the
|
||||
@ -54,7 +55,8 @@ class TestingConfig:
|
||||
|
||||
def __init__(self, parent, name, suffixes, test_format,
|
||||
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.name = str(name)
|
||||
self.suffixes = set(suffixes)
|
||||
@ -66,6 +68,7 @@ class TestingConfig:
|
||||
self.test_exec_root = test_exec_root
|
||||
self.test_source_root = test_source_root
|
||||
self.excludes = set(excludes)
|
||||
self.available_features = set(available_features)
|
||||
|
||||
def clone(self, path):
|
||||
# FIXME: Chain implementations?
|
||||
@ -75,7 +78,7 @@ class TestingConfig:
|
||||
self.environment, self.substitutions,
|
||||
self.unsupported, self.on_clone,
|
||||
self.test_exec_root, self.test_source_root,
|
||||
self.excludes)
|
||||
self.excludes, self.available_features)
|
||||
if cfg.on_clone:
|
||||
cfg.on_clone(self, cfg, path)
|
||||
return cfg
|
||||
|
Loading…
Reference in New Issue
Block a user