summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-02-17 23:08:46 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-02-17 23:08:46 +0000
commit958d196f22c5ba074faf1e01bf66308d17323af1 (patch)
tree5b51f0c44fa8dcb0f5049d3af5a2febea90e22ba
parent29a83004609da2a6d5395b0576cf12219b206a8f (diff)
downloadexternal_libcxx-958d196f22c5ba074faf1e01bf66308d17323af1.tar.gz
external_libcxx-958d196f22c5ba074faf1e01bf66308d17323af1.tar.bz2
external_libcxx-958d196f22c5ba074faf1e01bf66308d17323af1.zip
test: prevent incorrect quoting of paths
The path would previously get an extra leading space as the arguments would be parsed when generating the final command to run. Pretokenise the arguments to permit proper quoting of the paths. This avoids a number of ignoring non-existent path warnings from clang. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295511 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/libcxx/test/config.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 397cfdb8f..3373dd100 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -229,21 +229,19 @@ class Configuration(object):
self.cxx.compile_env['CCACHE_CPP2'] = '1'
def _configure_clang_cl(self, clang_path):
+ def _split_env_var(var):
+ return [p.strip() for p in os.environ.get(var, '').split(';') if p.strip()]
+
+ def _prefixed_env_list(var, prefix):
+ from itertools import chain
+ return list(chain.from_iterable((prefix, path) for path in _split_env_var(var)))
+
assert self.cxx_is_clang_cl
flags = []
- compile_flags = []
- link_flags = []
- if 'INCLUDE' in os.environ:
- compile_flags += ['-isystem %s' % p.strip()
- for p in os.environ['INCLUDE'].split(';')
- if p.strip()]
- if 'LIB' in os.environ:
- for p in os.environ['LIB'].split(';'):
- p = p.strip()
- if not p:
- continue
- link_flags += ['-L%s' % p]
- self.add_path(self.exec_env, p)
+ compile_flags = _prefixed_env_list('INCLUDE', '-isystem')
+ link_flags = _prefixed_env_list('LIB', '-L')
+ for path in _list_env_var('LIB'):
+ self.add_path(self.exec_env, path)
return CXXCompiler(clang_path, flags=flags,
compile_flags=compile_flags,
link_flags=link_flags)