diff options
Diffstat (limited to 'clang-tools-extra/test/Unit/lit.cfg')
-rw-r--r-- | clang-tools-extra/test/Unit/lit.cfg | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/clang-tools-extra/test/Unit/lit.cfg b/clang-tools-extra/test/Unit/lit.cfg index fc63afdbe86..3a1da187eb4 100644 --- a/clang-tools-extra/test/Unit/lit.cfg +++ b/clang-tools-extra/test/Unit/lit.cfg @@ -9,9 +9,10 @@ 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. - -config.test_source_root = config.extra_tools_obj_dir -config.test_exec_root = config.test_source_root +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 @@ -19,6 +20,18 @@ config.test_exec_root = config.test_source_root # ;-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' @@ -28,11 +41,17 @@ elif platform.system() == 'Windows': shlibpath_var = 'PATH' # Point the dynamic loader at dynamic libraries in 'lib'. -shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir, +shlibdir = getattr(config, 'shlibdir', None) +if not shlibdir: + lit_config.fatal('No shlibdir set!') +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((shlibdir, 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)) +if sys.platform in ['win32', 'cygwin'] and os.path.isdir(shlibdir): + shlibpath = os.path.pathsep.join((shlibdir, shlibpath)) config.environment[shlibpath_var] = shlibpath |