From b52c761a3c80eceed32c50c2da7f6637889e52eb Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 4 Jul 2014 05:11:55 +0000 Subject: [PATCH] Let test/Unit/lit.cfg add config.shlibdir to $PATH on DLL platforms like cygming. This makes unittests run with BUILD_SHARED_LIBS on DLL platforms. llvm-svn: 212316 --- clang-tools-extra/test/Unit/lit.cfg | 5 +++++ clang-tools-extra/test/Unit/lit.site.cfg.in | 1 + clang/test/Unit/lit.cfg | 5 +++++ llvm/test/Unit/lit.cfg | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/clang-tools-extra/test/Unit/lit.cfg b/clang-tools-extra/test/Unit/lit.cfg index eccb5b3..2c0760d 100644 --- a/clang-tools-extra/test/Unit/lit.cfg +++ b/clang-tools-extra/test/Unit/lit.cfg @@ -12,6 +12,11 @@ if extra_tools_obj_dir is not None: config.test_source_root = extra_tools_obj_dir config.test_exec_root = config.test_source_root +# Win32 seeks DLLs along %PATH%. +if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): + config.environment['PATH'] = os.path.pathsep.join(( + config.shlibdir, config.environment['PATH'])) + # 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 diff --git a/clang-tools-extra/test/Unit/lit.site.cfg.in b/clang-tools-extra/test/Unit/lit.site.cfg.in index 781970d6..0171efc 100644 --- a/clang-tools-extra/test/Unit/lit.site.cfg.in +++ b/clang-tools-extra/test/Unit/lit.site.cfg.in @@ -2,6 +2,7 @@ # Do not edit! config.extra_tools_obj_dir = "@CLANG_TOOLS_BINARY_DIR@/unittests" config.extra_tools_src_dir = "@CLANG_TOOLS_SOURCE_DIR@/unittests" +config.shlibdir = "@SHLIBDIR@" config.target_triple = "@TARGET_TRIPLE@" # Make sure any custom vars defined above that are required in lit.local.cfg diff --git a/clang/test/Unit/lit.cfg b/clang/test/Unit/lit.cfg index d34a01c..4fa6e78 100644 --- a/clang/test/Unit/lit.cfg +++ b/clang/test/Unit/lit.cfg @@ -100,4 +100,9 @@ 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 diff --git a/llvm/test/Unit/lit.cfg b/llvm/test/Unit/lit.cfg index 04e8830..e481dcc 100644 --- a/llvm/test/Unit/lit.cfg +++ b/llvm/test/Unit/lit.cfg @@ -35,6 +35,11 @@ for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: if symbolizer in os.environ: config.environment[symbolizer] = os.environ[symbolizer] +# Win32 seeks DLLs along %PATH%. +if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): + config.environment['PATH'] = os.path.pathsep.join(( + config.shlibdir, config.environment['PATH'])) + ### # Check that the object root is known. -- 2.7.4