Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu

* Removed test/lib/llvm.exp - it is no longer needed 
* Deleted the dg.exp reading code from test/lit.cfg. There are no dg.exp files
  left in the test suite so this code is no longer required. test/lit.cfg is
  now much shorter and clearer 
* Removed a lot of duplicate code in lit.local.cfg files that need access to
  the root configuration, by adding a "root" attribute to the TestingConfig
  object. This attribute is dynamically computed to provide the same
  information as was previously provided by the custom getRoot functions. 
* Documented the config.root attribute in docs/CommandGuide/lit.pod

llvm-svn: 153408
This commit is contained in:
Eli Bendersky 2012-03-25 09:02:19 +00:00
parent e9ca55ea9b
commit f33086052d
40 changed files with 45 additions and 352 deletions

View File

@ -301,6 +301,9 @@ reported as unsupported. Used by: I<ShTest>, I<TclTest>.
B<parent> The parent configuration, this is the config object for the directory
containing the test suite, or None.
B<root> The root configuration. This is the top-most B<lit> configuration in
the project.
B<on_clone> The config is actually cloned for every subdirectory inside a test
suite, to allow local configuration on a per-directory basis. The I<on_clone>
variable can be set to a Python function which will be called whenever a

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp', '.ml']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
bindings = set([s.strip() for s in root.llvm_bindings.split(',')])
bindings = set([s.strip() for s in config.root.llvm_bindings.split(',')])
if not 'ocaml' in bindings:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'CBackend' in targets or not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'CBackend' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'CppBackend' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'CellSPU' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'Hexagon' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'MBlaze' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'MSP430' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'Mips' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'PTX' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'PowerPC' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'Sparc' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'XCore' in targets:
config.unsupported = True

View File

@ -1,12 +1,5 @@
config.suffixes = ['.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp', '.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.s', '.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.txt']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.txt']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'MBlaze' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.txt']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp', '.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'MBlaze' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll', '.c', '.cpp', '.s']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'Mips' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.test']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,13 +1,6 @@
config.suffixes = ['.ll']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

@ -1,12 +1,5 @@
config.suffixes = ['.ll', '.c', '.cpp']
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
targets = set(root.targets_to_build.split())
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True

View File

View File

@ -218,70 +218,6 @@ for pattern in [r"\bbugpoint\b(?!-)", r"(?<!/|-)\bclang\b(?!-)",
break
config.substitutions.append((pattern, substitution))
excludes = []
# Provide llvm_supports_target for use in local configs.
targets = set(site_exp["TARGETS_TO_BUILD"].split())
def llvm_supports_target(name):
return name in targets
def llvm_supports_darwin_and_target(name):
return 'darwin' in config.target_triple and llvm_supports_target(name)
bindings = set([s.strip() for s in site_exp['llvm_bindings'].split(',')])
def llvm_supports_binding(name):
return name.strip() in bindings
# Provide on_clone hook for reading 'dg.exp'.
import os
simpleLibData = re.compile(r"""load_lib llvm.exp
RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]""",
re.MULTILINE)
conditionalLibData = re.compile(r"""load_lib llvm.exp
if.*\[ ?(llvm[^ ]*) ([^ ]*) ?\].*{
*RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]
\}""", re.MULTILINE)
def on_clone(parent, cfg, for_path):
def addSuffixes(match):
if match[0] == '{' and match[-1] == '}':
cfg.suffixes = ['.' + s for s in match[1:-1].split(',')]
else:
cfg.suffixes = ['.' + match]
libPath = os.path.join(os.path.dirname(for_path),
'dg.exp')
if not os.path.exists(libPath):
return
# Reset unsupported, in case we inherited it.
cfg.unsupported = False
lib = open(libPath).read().strip()
# Check for a simple library.
m = simpleLibData.match(lib)
if m:
addSuffixes(m.group(1))
return
# Check for a conditional test set.
m = conditionalLibData.match(lib)
if m:
funcname,arg,match = m.groups()
addSuffixes(match)
func = globals().get(funcname)
if not func:
lit.error('unsupported predicate %r' % funcname)
elif not func(arg):
cfg.unsupported = True
return
# Otherwise, give up.
lit.error('unable to understand %r:\n%s' % (libPath, lib))
config.on_clone = on_clone
### Features
# Shell execution

View File

@ -114,3 +114,9 @@ class TestingConfig:
# files. Should we distinguish them?
self.test_source_root = str(self.test_source_root)
self.excludes = set(self.excludes)
@property
def root(self):
"""root attribute - The root configuration for the test suite."""
return self if self.parent is None else self.parent.root