[PATCH] D42139: Allow passing additional compiler/linker flags for the tests

2018-02-23 Thread Alexander Richardson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325914: Allow passing additional compiler/linker flags for 
the tests (authored by arichardson, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D42139

Files:
  libcxx/trunk/test/CMakeLists.txt
  libcxx/trunk/test/lit.site.cfg.in
  libcxx/trunk/utils/libcxx/test/config.py


Index: libcxx/trunk/utils/libcxx/test/config.py
===
--- libcxx/trunk/utils/libcxx/test/config.py
+++ libcxx/trunk/utils/libcxx/test/config.py
@@ -510,6 +510,9 @@
 # and so that those tests don't have to be changed to tolerate
 # this insanity.
 self.cxx.compile_flags += ['-DNOMINMAX']
+additional_flags = self.get_lit_conf('test_compiler_flags')
+if additional_flags:
+self.cxx.compile_flags += shlex.split(additional_flags)
 
 def configure_default_compile_flags(self):
 # Try and get the std version from the command line. Fall back to
@@ -794,6 +797,9 @@
 self.use_system_cxx_lib]
 if self.is_windows and self.link_shared:
 self.add_path(self.cxx.compile_env, self.use_system_cxx_lib)
+additional_flags = self.get_lit_conf('test_linker_flags')
+if additional_flags:
+self.cxx.link_flags += shlex.split(additional_flags)
 
 def configure_link_flags_abi_library_path(self):
 # Configure ABI library paths.
Index: libcxx/trunk/test/lit.site.cfg.in
===
--- libcxx/trunk/test/lit.site.cfg.in
+++ libcxx/trunk/test/lit.site.cfg.in
@@ -22,6 +22,9 @@
 config.gcc_toolchain= "@LIBCXX_GCC_TOOLCHAIN@"
 config.generate_coverage= "@LIBCXX_GENERATE_COVERAGE@"
 config.target_info  = "@LIBCXX_TARGET_INFO@"
+config.test_linker_flags= "@LIBCXX_TEST_LINKER_FLAGS@"
+config.test_compiler_flags  = "@LIBCXX_TEST_COMPILER_FLAGS@"
+
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.compiler_rt  = "@LIBCXX_USE_COMPILER_RT@"
Index: libcxx/trunk/test/CMakeLists.txt
===
--- libcxx/trunk/test/CMakeLists.txt
+++ libcxx/trunk/test/CMakeLists.txt
@@ -9,6 +9,11 @@
 set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
 "Configuration variant to use for LIT.")
 
+set(LIBCXX_TEST_LINKER_FLAGS "" CACHE STRING
+"Additonal linker flags to pass when compiling the tests")
+set(LIBCXX_TEST_COMPILER_FLAGS "" CACHE STRING
+"Additonal linker flags to pass when compiling the tests")
+
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
 if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)


Index: libcxx/trunk/utils/libcxx/test/config.py
===
--- libcxx/trunk/utils/libcxx/test/config.py
+++ libcxx/trunk/utils/libcxx/test/config.py
@@ -510,6 +510,9 @@
 # and so that those tests don't have to be changed to tolerate
 # this insanity.
 self.cxx.compile_flags += ['-DNOMINMAX']
+additional_flags = self.get_lit_conf('test_compiler_flags')
+if additional_flags:
+self.cxx.compile_flags += shlex.split(additional_flags)
 
 def configure_default_compile_flags(self):
 # Try and get the std version from the command line. Fall back to
@@ -794,6 +797,9 @@
 self.use_system_cxx_lib]
 if self.is_windows and self.link_shared:
 self.add_path(self.cxx.compile_env, self.use_system_cxx_lib)
+additional_flags = self.get_lit_conf('test_linker_flags')
+if additional_flags:
+self.cxx.link_flags += shlex.split(additional_flags)
 
 def configure_link_flags_abi_library_path(self):
 # Configure ABI library paths.
Index: libcxx/trunk/test/lit.site.cfg.in
===
--- libcxx/trunk/test/lit.site.cfg.in
+++ libcxx/trunk/test/lit.site.cfg.in
@@ -22,6 +22,9 @@
 config.gcc_toolchain= "@LIBCXX_GCC_TOOLCHAIN@"
 config.generate_coverage= "@LIBCXX_GENERATE_COVERAGE@"
 config.target_info  = "@LIBCXX_TARGET_INFO@"
+config.test_linker_flags= "@LIBCXX_TEST_LINKER_FLAGS@"
+config.test_compiler_flags  = "@LIBCXX_TEST_COMPILER_FLAGS@"
+
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.compiler_rt  = "@LIBCXX_USE_COMPILER_RT@"
Index: libcxx/trunk/test/CMakeLists.txt
===
--- libcxx/trunk/test/CMakeLists.txt

[PATCH] D42139: Allow passing additional compiler/linker flags for the tests

2018-02-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

I'm fine with this, but I don't really think it's a good solution (but none of 
our LIT config is ideal). In particular for the link flags might not work well, 
because the order of linker flags matters a lot and this doesn't really deal 
with that. But if it works for your case.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42139



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42139: Allow passing additional compiler/linker flags for the tests

2018-02-19 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added a comment.
Herald added a subscriber: christof.

ping


Repository:
  rCXX libc++

https://reviews.llvm.org/D42139



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits