1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
From f3ff810e81c35133f6a7e463d860bcd4ca30be84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 19 Feb 2017 12:13:04 +0100
Subject: [PATCH 2/2] [test] Fix clang library dir in LD_LIBRARY_PATH For
stand-alone build
Prepend the clang library directory (determined using SHLIBDIR, alike
in clang) to the LD_LIBRARY_PATH to ensure that just-built clang
libraries will be used instead of a previous installed version.
When a stand-alone build is performed, LLVM_LIBS_DIR contains the path
to installed LLVM library directory. The same directory frequently
contains a previously installed version of clang. SHLIBDIR, on the other
hand, is always the build-tree directory, and therefore contains
the freshly built clang libraries.
In a non-stand-alone build, both paths will be the same and therefore
including them both will not cause any issues.
---
test/Unit/lit.cfg | 9 ++++++---
test/lit.cfg | 5 ++++-
test/lit.site.cfg.in | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
index ff70123c..3a1da187 100644
--- a/test/Unit/lit.cfg
+++ b/test/Unit/lit.cfg
@@ -41,14 +41,17 @@ elif platform.system() == 'Windows':
shlibpath_var = 'PATH'
# Point the dynamic loader at dynamic libraries in 'lib'.
+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((llvm_libs_dir,
+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
diff --git a/test/lit.cfg b/test/lit.cfg
index bb592936..0e7de849 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -99,10 +99,13 @@ if clang_tools_binary_dir is not None:
clang_tools_dir, llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
+ clang_libs_dir = getattr(config, 'clang_libs_dir', None)
+ if not clang_libs_dir:
+ lit_config.fatal('No Clang libs dir set!')
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
if not llvm_libs_dir:
lit_config.fatal('No LLVM libs dir set!')
- path = os.path.pathsep.join((llvm_libs_dir,
+ path = os.path.pathsep.join((clang_libs_dir, llvm_libs_dir,
config.environment.get('LD_LIBRARY_PATH','')))
config.environment['LD_LIBRARY_PATH'] = path
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index dfd0164c..f310b59a 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -7,6 +7,7 @@ config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
+config.clang_libs_dir = "@SHLIBDIR@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.target_triple = "@TARGET_TRIPLE@"
--
2.12.0
|