r188072 - [tests] Update to use lit_config and lit package, as appropriate.
Daniel Dunbar
daniel at zuster.org
Fri Aug 9 07:43:05 PDT 2013
Author: ddunbar
Date: Fri Aug 9 09:43:04 2013
New Revision: 188072
URL: http://llvm.org/viewvc/llvm-project?rev=188072&view=rev
Log:
[tests] Update to use lit_config and lit package, as appropriate.
Modified:
cfe/trunk/test/Unit/lit.cfg
cfe/trunk/test/Unit/lit.site.cfg.in
cfe/trunk/test/lit.cfg
cfe/trunk/test/lit.site.cfg.in
Modified: cfe/trunk/test/Unit/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Unit/lit.cfg?rev=188072&r1=188071&r2=188072&view=diff
==============================================================================
--- cfe/trunk/test/Unit/lit.cfg (original)
+++ cfe/trunk/test/Unit/lit.cfg Fri Aug 9 09:43:04 2013
@@ -4,6 +4,9 @@
import os
+import lit.formats
+import lit.util
+
# name: The name of this test suite.
config.name = 'Clang-Unit'
@@ -43,9 +46,9 @@ if config.test_exec_root is None:
# out-of-tree build situation).
# Check for 'clang_unit_site_config' user parameter, and use that if available.
- site_cfg = lit.params.get('clang_unit_site_config', None)
+ site_cfg = lit_config.params.get('clang_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
# Try to detect the situation where we are using an out-of-tree build by
@@ -58,7 +61,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()
@@ -70,16 +73,16 @@ if config.test_exec_root is None:
# tools/clang layout.
this_src_root = os.path.join(os.path.dirname(__file__),'..','..')
if os.path.realpath(clang_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_obj_root, 'test', 'Unit', 'lit.site.cfg')
if not os.path.exists(site_cfg):
- lit.fatal('No site specific configuration available!')
+ lit_config.fatal('No site specific configuration available!')
# 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
# If necessary, point the dynamic loader at libLLVM.so.
Modified: cfe/trunk/test/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Unit/lit.site.cfg.in?rev=188072&r1=188071&r2=188072&view=diff
==============================================================================
--- cfe/trunk/test/Unit/lit.site.cfg.in (original)
+++ cfe/trunk/test/Unit/lit.site.cfg.in Fri Aug 9 09:43:04 2013
@@ -17,13 +17,13 @@ config.target_triple = "@TARGET_TRIPLE@"
# 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_build_mode = config.llvm_build_mode % lit.params
+ config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+ config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+ config.llvm_build_mode = config.llvm_build_mode % 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, "@CLANG_SOURCE_DIR@/test/Unit/lit.cfg")
+lit_config.load_config(config, "@CLANG_SOURCE_DIR@/test/Unit/lit.cfg")
Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=188072&r1=188071&r2=188072&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Fri Aug 9 09:43:04 2013
@@ -6,6 +6,8 @@ import re
import subprocess
import tempfile
+import lit.formats
+import lit.util
# Configuration file for the 'lit' test runner.
@@ -16,9 +18,9 @@ config.name = 'Clang'
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']))
@@ -89,12 +91,12 @@ for name in possibly_dangerous_env_vars:
if clang_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
@@ -114,9 +116,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_site_config', None)
+ site_cfg = lit_config.params.get('clang_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
@@ -130,7 +132,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()
@@ -142,17 +144,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_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_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
###
@@ -174,14 +177,14 @@ 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
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
@@ -192,7 +195,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)
dir = cmd.stdout.read().strip()
if sys.platform in ['win32'] and execute_external:
# Don't pass dosish path separator to msys bash.exe.
@@ -309,7 +312,7 @@ llc_props = get_llc_props(os.path.join(l
if len(llc_props['set_of_targets']) > 0:
config.available_features.update(llc_props['set_of_targets'])
else:
- lit.fatal('No Targets Registered with the LLVM Tools!')
+ lit_config.fatal('No Targets Registered with the LLVM Tools!')
if llc_props['enable_assertions']:
config.available_features.add('asserts')
@@ -325,25 +328,26 @@ if (config.llvm_use_sanitizer == "Memory
config.available_features.add("msan")
# Check if we should run long running tests.
-if lit.params.get("run_long_tests", None) == "true":
+if lit_config.params.get("run_long_tests", None) == "true":
config.available_features.add("long_tests")
# Check if we should use gmalloc.
-use_gmalloc_str = lit.params.get('use_gmalloc', None)
+use_gmalloc_str = lit_config.params.get('use_gmalloc', None)
if use_gmalloc_str is not None:
if use_gmalloc_str.lower() in ('1', 'true'):
use_gmalloc = True
elif use_gmalloc_str.lower() in ('', '0', 'false'):
use_gmalloc = False
else:
- lit.fatal('user parameter use_gmalloc should be 0 or 1')
+ lit_config.fatal('user parameter use_gmalloc should be 0 or 1')
else:
# Default to not using gmalloc
use_gmalloc = False
# Allow use of an explicit path for gmalloc library.
# Will default to '/usr/lib/libgmalloc.dylib' if not set.
-gmalloc_path_str = lit.params.get('gmalloc_path', '/usr/lib/libgmalloc.dylib')
+gmalloc_path_str = lit_config.params.get('gmalloc_path',
+ '/usr/lib/libgmalloc.dylib')
if use_gmalloc:
config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})
Modified: cfe/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.in?rev=188072&r1=188071&r2=188072&view=diff
==============================================================================
--- cfe/trunk/test/lit.site.cfg.in (original)
+++ cfe/trunk/test/lit.site.cfg.in Fri Aug 9 09:43:04 2013
@@ -14,12 +14,12 @@ config.llvm_use_sanitizer = "@LLVM_USE_S
# 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 = 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, "@CLANG_SOURCE_DIR@/test/lit.cfg")
+lit_config.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg")
More information about the cfe-commits
mailing list