[libcxx-commits] [libcxx] 12f6b02 - Revert "[libc++] NFC: Simplify substitutions by using lit recursive substitutions"

David Zarzycki via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 29 18:09:37 PDT 2020


Author: David Zarzycki
Date: 2020-03-29T21:08:42-04:00
New Revision: 12f6b024f9f58cee72770849a8c86a1436046ff7

URL: https://github.com/llvm/llvm-project/commit/12f6b024f9f58cee72770849a8c86a1436046ff7
DIFF: https://github.com/llvm/llvm-project/commit/12f6b024f9f58cee72770849a8c86a1436046ff7.diff

LOG: Revert "[libc++] NFC: Simplify substitutions by using lit recursive substitutions"

This reverts commit cd7f9751c30092033a5e97591876f972daf61989 which has
unintended breakage to non-libcxx projects when using the documented way
of building LLVM. (See the Getting Started guide. I.e. one big CMake setup.)

Added: 
    

Modified: 
    libcxx/test/lit.cfg
    libcxx/utils/libcxx/test/config.py
    libcxx/utils/libcxx/test/format.py

Removed: 
    


################################################################################
diff  --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg
index e6e0542c2fbe..ed5aa29d9175 100644
--- a/libcxx/test/lit.cfg
+++ b/libcxx/test/lit.cfg
@@ -53,5 +53,3 @@ configuration = config_module.Configuration(lit_config, config)
 configuration.configure()
 configuration.print_config_info()
 config.test_format = configuration.get_test_format()
-
-lit_config.recursiveExpansionLimit = 10

diff  --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index d53bd6cbeb36..7a157bb21689 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -1039,26 +1039,35 @@ def configure_substitutions(self):
         if self.target_info.is_darwin():
             # Do not pass DYLD_LIBRARY_PATH to the compiler, linker, etc. as
             # these tools are not meant to exercise the just-built libraries.
-            tool_env += 'env DYLD_LIBRARY_PATH=""'
+            tool_env += 'env DYLD_LIBRARY_PATH="" '
 
         sub = self.config.substitutions
+        cxx_path = tool_env + pipes.quote(self.cxx.path)
         # Configure compiler substitutions
-        sub.append(('%{cxx}', '{} {}'.format(tool_env, pipes.quote(self.cxx.path))))
+        sub.append(('%{cxx}', cxx_path))
         sub.append(('%{libcxx_src_root}', self.libcxx_src_root))
         # Configure flags substitutions
-        sub.append(('%{flags}',         ' '.join(map(pipes.quote, self.cxx.flags))))
-        sub.append(('%{compile_flags}', ' '.join(map(pipes.quote, self.cxx.compile_flags))))
-        sub.append(('%{link_flags}',    ' '.join(map(pipes.quote, self.cxx.link_flags))))
+        flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags])
+        compile_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.compile_flags])
+        link_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.link_flags])
+        all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
+        sub.append(('%{flags}', flags_str))
+        sub.append(('%{compile_flags}', compile_flags_str))
+        sub.append(('%{link_flags}', link_flags_str))
         if self.cxx.isVerifySupported():
-            sub.append(('%{verify}', ' '.join(self.cxx.verify_flags)))
-        # Add compile and build shortcuts
-        sub.append(('%{compile}', '%{cxx} -o %t.o %s -c %{flags} %{compile_flags}'))
-        sub.append(('%{build}',   '%{cxx} -o %t.exe %s %{flags} %{compile_flags} %{link_flags}'))
+            verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' '
+            sub.append(('%{verify}', verify_str))
+        # Add compile and link shortcuts
+        compile_str = (cxx_path + ' -o %t.o %s -c ' + flags_str
+                       + ' ' + compile_flags_str)
+        build_str = cxx_path + ' -o %t.exe %s ' + all_flags
         if self.cxx.use_modules:
-            sub.append(('%{build_module}', '%{build}'))
+            sub.append(('%{build_module}', build_str))
         elif self.cxx.modules_flags is not None:
-            sub.append(('%{build_module}', '%{{build}} {}'.format(' '.join(self.cxx.modules_flags))))
-
+            modules_str = ' '.join(self.cxx.modules_flags) + ' '
+            sub.append(('%{build_module}', build_str + ' ' + modules_str))
+        sub.append(('%{compile}', compile_str))
+        sub.append(('%{build}', build_str))
         # Configure exec prefix substitutions.
         # Configure run env substitution.
         codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
@@ -1068,11 +1077,13 @@ def configure_substitutions(self):
                    '--dependencies %%{file_dependencies} --env %s -- ' %  \
             (pipes.quote(sys.executable), pipes.quote(run_py),
              codesign_ident, env_vars)
+        run_str = exec_str + '%t.exe'
         sub.append(('%{exec}', exec_str))
-        sub.append(('%{run}', '%{exec} %t.exe'))
+        sub.append(('%{run}', run_str))
         # Configure not program substitutions
         not_py = os.path.join(self.libcxx_src_root, 'utils', 'not.py')
-        sub.append(('%{not}', '{} {}'.format(pipes.quote(sys.executable), pipes.quote(not_py))))
+        not_str = '%s %s ' % (pipes.quote(sys.executable), pipes.quote(not_py))
+        sub.append(('%{not} ', not_str))
         if self.get_lit_conf('libcxx_gdb'):
             sub.append(('%{libcxx_gdb}', self.get_lit_conf('libcxx_gdb')))
 

diff  --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index 0e6ec5d39e19..833159eaabde 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -124,8 +124,7 @@ def _execute(self, test, lit_config):
         substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir,
                                                                tmpBase)
         substitutions.append(('%{file_dependencies}', ' '.join(data_files)))
-        script = lit.TestRunner.applySubstitutions(script, substitutions,
-                                                   recursion_limit=lit_config.recursiveExpansionLimit)
+        script = lit.TestRunner.applySubstitutions(script, substitutions)
 
         test_cxx = copy.deepcopy(self.cxx)
         if is_fail_test:


        


More information about the libcxx-commits mailing list