Skip to content

Commit 12f6b02

Browse files
committed
Revert "[libc++] NFC: Simplify substitutions by using lit recursive substitutions"
This reverts commit cd7f975 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.)
1 parent d74533a commit 12f6b02

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

libcxx/test/lit.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,3 @@ configuration = config_module.Configuration(lit_config, config)
5353
configuration.configure()
5454
configuration.print_config_info()
5555
config.test_format = configuration.get_test_format()
56-
57-
lit_config.recursiveExpansionLimit = 10

libcxx/utils/libcxx/test/config.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,26 +1039,35 @@ def configure_substitutions(self):
10391039
if self.target_info.is_darwin():
10401040
# Do not pass DYLD_LIBRARY_PATH to the compiler, linker, etc. as
10411041
# these tools are not meant to exercise the just-built libraries.
1042-
tool_env += 'env DYLD_LIBRARY_PATH=""'
1042+
tool_env += 'env DYLD_LIBRARY_PATH="" '
10431043

10441044
sub = self.config.substitutions
1045+
cxx_path = tool_env + pipes.quote(self.cxx.path)
10451046
# Configure compiler substitutions
1046-
sub.append(('%{cxx}', '{} {}'.format(tool_env, pipes.quote(self.cxx.path))))
1047+
sub.append(('%{cxx}', cxx_path))
10471048
sub.append(('%{libcxx_src_root}', self.libcxx_src_root))
10481049
# Configure flags substitutions
1049-
sub.append(('%{flags}', ' '.join(map(pipes.quote, self.cxx.flags))))
1050-
sub.append(('%{compile_flags}', ' '.join(map(pipes.quote, self.cxx.compile_flags))))
1051-
sub.append(('%{link_flags}', ' '.join(map(pipes.quote, self.cxx.link_flags))))
1050+
flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags])
1051+
compile_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.compile_flags])
1052+
link_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.link_flags])
1053+
all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
1054+
sub.append(('%{flags}', flags_str))
1055+
sub.append(('%{compile_flags}', compile_flags_str))
1056+
sub.append(('%{link_flags}', link_flags_str))
10521057
if self.cxx.isVerifySupported():
1053-
sub.append(('%{verify}', ' '.join(self.cxx.verify_flags)))
1054-
# Add compile and build shortcuts
1055-
sub.append(('%{compile}', '%{cxx} -o %t.o %s -c %{flags} %{compile_flags}'))
1056-
sub.append(('%{build}', '%{cxx} -o %t.exe %s %{flags} %{compile_flags} %{link_flags}'))
1058+
verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' '
1059+
sub.append(('%{verify}', verify_str))
1060+
# Add compile and link shortcuts
1061+
compile_str = (cxx_path + ' -o %t.o %s -c ' + flags_str
1062+
+ ' ' + compile_flags_str)
1063+
build_str = cxx_path + ' -o %t.exe %s ' + all_flags
10571064
if self.cxx.use_modules:
1058-
sub.append(('%{build_module}', '%{build}'))
1065+
sub.append(('%{build_module}', build_str))
10591066
elif self.cxx.modules_flags is not None:
1060-
sub.append(('%{build_module}', '%{{build}} {}'.format(' '.join(self.cxx.modules_flags))))
1061-
1067+
modules_str = ' '.join(self.cxx.modules_flags) + ' '
1068+
sub.append(('%{build_module}', build_str + ' ' + modules_str))
1069+
sub.append(('%{compile}', compile_str))
1070+
sub.append(('%{build}', build_str))
10621071
# Configure exec prefix substitutions.
10631072
# Configure run env substitution.
10641073
codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
@@ -1068,11 +1077,13 @@ def configure_substitutions(self):
10681077
'--dependencies %%{file_dependencies} --env %s -- ' % \
10691078
(pipes.quote(sys.executable), pipes.quote(run_py),
10701079
codesign_ident, env_vars)
1080+
run_str = exec_str + '%t.exe'
10711081
sub.append(('%{exec}', exec_str))
1072-
sub.append(('%{run}', '%{exec} %t.exe'))
1082+
sub.append(('%{run}', run_str))
10731083
# Configure not program substitutions
10741084
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not.py')
1075-
sub.append(('%{not}', '{} {}'.format(pipes.quote(sys.executable), pipes.quote(not_py))))
1085+
not_str = '%s %s ' % (pipes.quote(sys.executable), pipes.quote(not_py))
1086+
sub.append(('%{not} ', not_str))
10761087
if self.get_lit_conf('libcxx_gdb'):
10771088
sub.append(('%{libcxx_gdb}', self.get_lit_conf('libcxx_gdb')))
10781089

libcxx/utils/libcxx/test/format.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ def _execute(self, test, lit_config):
124124
substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir,
125125
tmpBase)
126126
substitutions.append(('%{file_dependencies}', ' '.join(data_files)))
127-
script = lit.TestRunner.applySubstitutions(script, substitutions,
128-
recursion_limit=lit_config.recursiveExpansionLimit)
127+
script = lit.TestRunner.applySubstitutions(script, substitutions)
129128

130129
test_cxx = copy.deepcopy(self.cxx)
131130
if is_fail_test:

0 commit comments

Comments
 (0)