[clang-tools-extra] r188092 - [tests] Update to use lit_config and lit package, as appropriate.
Daniel Dunbar
daniel at zuster.org
Fri Aug 9 11:49:22 PDT 2013
Author: ddunbar
Date: Fri Aug 9 13:49:22 2013
New Revision: 188092
URL: http://llvm.org/viewvc/llvm-project?rev=188092&view=rev
Log:
[tests] Update to use lit_config and lit package, as appropriate.
Modified:
clang-tools-extra/trunk/test/Unit/lit.cfg
clang-tools-extra/trunk/test/Unit/lit.site.cfg.in
clang-tools-extra/trunk/test/lit.cfg
clang-tools-extra/trunk/test/lit.site.cfg.in
Modified: clang-tools-extra/trunk/test/Unit/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/Unit/lit.cfg?rev=188092&r1=188091&r2=188092&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/Unit/lit.cfg (original)
+++ clang-tools-extra/trunk/test/Unit/lit.cfg Fri Aug 9 13:49:22 2013
@@ -1,5 +1,7 @@
# -*- Python -*-
+import lit.formats
+
config.name = "Extra Tools Unit Tests"
config.suffixes = [] # Seems not to matter for google tests?
@@ -21,9 +23,9 @@ config.test_format = lit.formats.GoogleT
# sane config options.
if config.test_exec_root is None:
# Look for a --param=extra_tools_unit_site_config option.
- site_cfg = lit.params.get('extra_tools_unit_site_config', None)
+ site_cfg = lit_config.params.get('extra_tools_unit_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
# FIXME: Support out-of-tree builds? See clang/test/Unit/lit.cfg if we care.
Modified: clang-tools-extra/trunk/test/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/Unit/lit.site.cfg.in?rev=188092&r1=188091&r2=188092&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/Unit/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/Unit/lit.site.cfg.in Fri Aug 9 13:49:22 2013
@@ -10,4 +10,4 @@ def on_clone(parent, clone, path):
clone.extra_tools_src_dir = parent.extra_tools_src_dir
config.on_clone = on_clone
-lit.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg")
Modified: clang-tools-extra/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg?rev=188092&r1=188091&r2=188092&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/lit.cfg (original)
+++ clang-tools-extra/trunk/test/lit.cfg Fri Aug 9 13:49:22 2013
@@ -5,6 +5,8 @@ import platform
import re
import subprocess
+import lit.formats
+import lit.util
# Configuration file for the 'lit' test runner.
@@ -15,9 +17,9 @@ config.name = 'Clang Tools'
if platform.system() == 'Windows':
# Seek sane tools in directories and set to $PATH.
path = getattr(config, 'lit_tools_dir', None)
- path = lit.getToolsPath(path,
- config.environment['PATH'],
- ['cmp.exe', 'grep.exe', 'sed.exe'])
+ path = lit_config.getToolsPath(path,
+ config.environment['PATH'],
+ ['cmp.exe', 'grep.exe', 'sed.exe'])
if path is not None:
path = os.path.pathsep.join((path,
config.environment['PATH']))
@@ -28,7 +30,7 @@ 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, ""])
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
@@ -75,13 +77,13 @@ for name in possibly_dangerous_env_vars:
if clang_tools_binary_dir 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
@@ -96,9 +98,9 @@ if config.test_exec_root is None:
# out-of-tree build situation).
# Check for 'clang_site_config' user parameter, and use that if available.
- site_cfg = lit.params.get('clang_tools_extra_site_config', None)
+ site_cfg = lit_config.params.get('clang_tools_extra_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
@@ -112,7 +114,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()
@@ -126,17 +128,18 @@ if config.test_exec_root is None:
# tools/clang layout.
this_src_root = os.path.dirname(config.test_source_root)
if os.path.realpath(clang_tools_extra_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(clang_tools_extra_obj_root, 'test', 'lit.site.cfg')
if not os.path.exists(site_cfg):
- lit.fatal('No site specific configuration available! You may need to '
- 'run "make test" in your Clang build directory.')
+ 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' % clang_obj_root)
- lit.load_config(config, site_cfg)
+ lit_config.note('using out-of-tree build at %r' % clang_obj_root)
+ lit_config.load_config(config, site_cfg)
raise SystemExit
###
@@ -158,19 +161,19 @@ def inferClang(PATH):
clang = lit.util.which('clang', PATH)
if not clang:
- lit.fatal("couldn't find 'clang' program, try setting "
- "CLANG in your environment")
+ lit_config.fatal("couldn't find 'clang' program, try setting "
+ "CLANG in your environment")
return clang
# 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.clang = inferClang(config.environment['PATH']).replace('\\', '/')
-if not lit.quiet:
- lit.note('using clang: %r' % config.clang)
+if not lit_config.quiet:
+ lit_config.note('using clang: %r' % config.clang)
# Note that when substituting %clang_cc1 also fill in the include directory of
# the builtin headers. Those are part of even a freestanding environment, but
@@ -181,7 +184,7 @@ def getClangBuiltinIncludeDir(clang):
cmd = subprocess.Popen([clang, '-print-file-name=include'],
stdout=subprocess.PIPE)
if not cmd.stdout:
- lit.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
+ lit_config.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
return cmd.stdout.read().strip()
config.substitutions.append( ('%clang_cc1', '%s -cc1 -internal-isystem %s'
@@ -216,7 +219,7 @@ if platform.system() not in ['FreeBSD']:
config.available_features.add('crash-recovery')
# 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')
# ANSI escape sequences in non-dumb terminal
Modified: clang-tools-extra/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=188092&r1=188091&r2=188092&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/lit.site.cfg.in Fri Aug 9 13:49:22 2013
@@ -11,11 +11,11 @@ config.target_triple = "@TARGET_TRIPLE@"
# 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
+ 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:
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, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")
More information about the cfe-commits
mailing list