Update cling's testsuite to use the newest llvm lit.

This commit is contained in:
Vassil Vassilev 2013-09-27 14:27:21 +02:00 committed by sftnight
parent 2bdbe82561
commit c31d15a1a1
2 changed files with 30 additions and 25 deletions

View File

@ -6,13 +6,16 @@ import os
import platform
import re
import lit.util
import lit.formats
# name: The name of this test suite.
config.name = 'Cling'
# Tweak PATH for Win32
if platform.system() == 'Windows':
# Seek sane tools in directories and set to $PATH.
path = getattr(config, 'lit_tools_dir', None)
path = lit.getToolsPath(path,
path = lit_config.getToolsPath(path,
config.environment['PATH'],
['cmp.exe', 'grep.exe', 'sed.exe'])
if path is not None:
@ -25,9 +28,9 @@ if platform.system() == 'Windows':
# For now we require '&&' between commands, until they get globally killed and
# the test runner updated.
execute_external = (platform.system() != 'Windows'
or lit.getBashPath() not in [None, ""])
or lit_config.getBashPath() not in [None, ""])
# testFormat: The test format to use to interpret tests.
#config.test_format = lit.formats.TclTest()
#config.test_format = lit_config.formats.TclTest()
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
@ -35,7 +38,7 @@ config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files, this is actually
# set by on_clone().
config.suffixes = []
config.suffixes = ['.C']
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
@ -52,13 +55,13 @@ config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
if cling_obj_root is not None:
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
if not llvm_tools_dir:
lit.fatal('No LLVM tools dir set!')
lit_config.fatal('No LLVM tools dir set!')
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
if not llvm_libs_dir:
lit.fatal('No LLVM libs dir set!')
lit_config.fatal('No LLVM libs dir set!')
path = os.path.pathsep.join((llvm_libs_dir,
config.environment.get('LD_LIBRARY_PATH','')))
config.environment['LD_LIBRARY_PATH'] = path
@ -73,9 +76,9 @@ if config.test_exec_root is None:
# out-of-tree build situation).
# Check for 'cling_site_config' user parameter, and use that if available.
site_cfg = lit.params.get('cling_site_config', None)
site_cfg = lit_config.params.get('cling_site_config', None)
if site_cfg and os.path.exists(site_cfg):
lit.load_config(config, site_cfg)
lit_config.load_config(config, site_cfg)
raise SystemExit
# Try to detect the situation where we are using an out-of-tree build by
@ -89,7 +92,7 @@ if config.test_exec_root is None:
llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
if not llvm_config:
lit.fatal('No site specific configuration available!')
lit_config.fatal('No site specific configuration available!')
# Get the source and object roots.
llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
@ -101,17 +104,17 @@ if config.test_exec_root is None:
# tools/cling layout.
this_src_root = os.path.dirname(config.test_source_root)
if os.path.realpath(cling_src_root) != os.path.realpath(this_src_root):
lit.fatal('No site specific configuration available!')
lit_config.fatal('No site specific configuration available!')
# Check that the site specific configuration exists.
site_cfg = os.path.join(cling_obj_root, 'test', 'lit.site.cfg')
if not os.path.exists(site_cfg):
lit.fatal('No site specific configuration available! You may need to '
lit_config.fatal('No site specific configuration available! You may need to '
'run "make test" in your Clang build directory.')
# Okay, that worked. Notify the user of the automagic, and reconfigure.
lit.note('using out-of-tree build at %r' % cling_obj_root)
lit.load_config(config, site_cfg)
lit_config.note('using out-of-tree build at %r' % cling_obj_root)
lit_config.load_config(config, site_cfg)
raise SystemExit
###
@ -215,19 +218,19 @@ def inferCling(PATH):
cling = lit.util.which('cling', PATH)
if not cling:
lit.fatal("couldn't find 'cling' program, try setting "
lit_config.fatal("couldn't find 'cling' program, try setting "
"CLING in your environment")
return cling
# When running under valgrind, we mangle '-vg' onto the end of the triple so we
# can check it with XFAIL and XTARGET.
if lit.useValgrind:
if lit_config.useValgrind:
config.target_triple += '-vg'
config.cling = inferCling(config.environment['PATH']).replace('\\', '/')
if not lit.quiet:
lit.note('using cling: %r' % config.cling)
if not lit_config.quiet:
lit_config.note('using cling: %r' % config.cling)
#Start cling with nologo
config.substitutions.append( ('%cling', ' ' + config.cling + ' --nologo') )
@ -277,12 +280,12 @@ def on_clone(parent, cfg, for_path):
func = globals().get(funcname)
if not func:
lit.error('unsupported predicate %r' % funcname)
lit_config.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))
lit_config.error('unable to understand %r:\n%s' % (libPath, lib))
config.on_clone = on_clone
@ -290,7 +293,7 @@ config.on_clone = on_clone
# Shell execution
if platform.system() not in ['Windows'] or lit.getBashPath() != '':
if platform.system() not in ['Windows'] or lit_config.getBashPath() != '':
config.available_features.add('shell')
# Loadable module

View File

@ -1,3 +1,4 @@
import sys
## Autogenerated by LLVM/Cling configuration.
# Do not edit!
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
@ -11,11 +12,12 @@ config.shlibext = "@TARGET_SHLIBEXT@"
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
try:
config.llvm_tools_dir = config.llvm_tools_dir % lit.params
config.llvm_libs_dir = config.llvm_libs_dir % lit.params
except KeyError,e:
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
except KeyError:
e = sys.exc_info()[1]
key, = e.args
lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
# Let the main config do the real work.
lit.load_config(config, "@CLING_SOURCE_DIR@/test/lit.cfg")
lit_config.load_config(config, "@CLING_SOURCE_DIR@/test/lit.cfg")