forked from OSchip/llvm-project
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
# -*- Python -*-
|
|
|
|
import platform
|
|
|
|
import lit.formats
|
|
|
|
config.name = "Extra Tools Unit Tests"
|
|
config.suffixes = [] # Seems not to matter for google tests?
|
|
|
|
# Test Source and Exec root dirs both point to the same directory where google
|
|
# test binaries are built.
|
|
extra_tools_obj_dir = getattr(config, 'extra_tools_obj_dir', None)
|
|
if extra_tools_obj_dir is not None:
|
|
config.test_source_root = extra_tools_obj_dir
|
|
config.test_exec_root = config.test_source_root
|
|
|
|
# All GoogleTests are named to have 'Tests' as their suffix. The '.' option is
|
|
# a special value for GoogleTest indicating that it should look through the
|
|
# entire testsuite recursively for tests (alternatively, one could provide a
|
|
# ;-separated list of subdirectories).
|
|
config.test_format = lit.formats.GoogleTest('.', 'Tests')
|
|
|
|
# If the site-specific configuration wasn't loaded (e.g. the build system failed
|
|
# to create it or the user is running a test file directly) try to come up with
|
|
# sane config options.
|
|
if config.test_exec_root is None:
|
|
# Look for a --param=extra_tools_unit_site_config option.
|
|
site_cfg = lit_config.params.get('extra_tools_unit_site_config', None)
|
|
if site_cfg and os.path.exists(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.
|
|
|
|
shlibpath_var = ''
|
|
if platform.system() == 'Linux':
|
|
shlibpath_var = 'LD_LIBRARY_PATH'
|
|
elif platform.system() == 'Darwin':
|
|
shlibpath_var = 'DYLD_LIBRARY_PATH'
|
|
elif platform.system() == 'Windows':
|
|
shlibpath_var = 'PATH'
|
|
|
|
# Point the dynamic loader at dynamic libraries in 'lib'.
|
|
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
|
|
if not llvm_libs_dir:
|
|
lit_config.fatal('No LLVM libs dir set!')
|
|
shlibpath = os.path.pathsep.join((llvm_libs_dir,
|
|
config.environment.get(shlibpath_var,'')))
|
|
|
|
# Win32 seeks DLLs along %PATH%.
|
|
if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir):
|
|
shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath))
|
|
|
|
config.environment[shlibpath_var] = shlibpath
|