summaryrefslogtreecommitdiffstats
path: root/clang/test/Unit/lit.cfg.py
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2017-10-24 03:11:02 +0000
committerTim Shen <timshen91@gmail.com>2017-10-24 03:11:02 +0000
commitcc5bf00f1deef51a358a2326efd70743641ce911 (patch)
treeb1ecd093fc97e9cb9b7ed342bf30911ec2d6aa96 /clang/test/Unit/lit.cfg.py
parent23e54d85be311b12131d89a1e2b7be6dcae19db9 (diff)
downloadbcm5719-llvm-cc5bf00f1deef51a358a2326efd70743641ce911.tar.gz
bcm5719-llvm-cc5bf00f1deef51a358a2326efd70743641ce911.zip
[test] Fix clang-test for FreeBSD and NetBSD
Lit tries to inject the shared library paths, but no action is taken when platform.system() is not recognized, results in an environment variable with an empty name, which is illegal. The patch fixes this mechanism for FreeBSD and NetBSD, and gives an warning on other platforms, so that the latecomers don't have to spend time on debugging lit. Thanks Zhihao Yuan for the patch! Differential Revision: https://reviews.llvm.org/D39162 llvm-svn: 316411
Diffstat (limited to 'clang/test/Unit/lit.cfg.py')
-rw-r--r--clang/test/Unit/lit.cfg.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/clang/test/Unit/lit.cfg.py b/clang/test/Unit/lit.cfg.py
index c4794ccbe58..f4bcdd76d17 100644
--- a/clang/test/Unit/lit.cfg.py
+++ b/clang/test/Unit/lit.cfg.py
@@ -35,17 +35,23 @@ for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
if symbolizer in os.environ:
config.environment[symbolizer] = os.environ[symbolizer]
-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'
-
-# in stand-alone builds, shlibdir is clang's build tree
-# while llvm_libs_dir is installed LLVM (and possibly older clang)
-shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
- config.environment.get(shlibpath_var,'')))
-
-config.environment[shlibpath_var] = shlibpath
+def find_shlibpath_var():
+ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
+ yield 'LD_LIBRARY_PATH'
+ elif platform.system() == 'Darwin':
+ yield 'DYLD_LIBRARY_PATH'
+ elif platform.system() == 'Windows':
+ yield 'PATH'
+
+for shlibpath_var in find_shlibpath_var():
+ # in stand-alone builds, shlibdir is clang's build tree
+ # while llvm_libs_dir is installed LLVM (and possibly older clang)
+ shlibpath = os.path.pathsep.join(
+ (config.shlibdir,
+ config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
+ config.environment[shlibpath_var] = shlibpath
+ break
+else:
+ lit_config.warning("unable to inject shared library path on '{}'"
+ .format(platform.system()))
OpenPOWER on IntegriCloud