Skip to content

Commit 8d508c5

Browse files
committed
[lldb/Test] Disallow using substituted binaries in shell test.
Explicitly disallow using lldb instead of %lldb in the shell tests. This is a clever trick that is used by Swift to achieve the same results. Differential revision: https://reviews.llvm.org/D73289
1 parent e174da4 commit 8d508c5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lldb/test/Shell/helper/toolchain.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ def _get_lldb_init_path(config):
1414
return os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
1515

1616

17+
def _disallow(config, execName):
18+
warning = '''
19+
echo '*** Do not use \'{0}\' in tests; use \'%''{0}\'. ***' &&
20+
exit 1 && echo
21+
'''
22+
config.substitutions.append((' {0} '.format(execName),
23+
warning.format(execName)))
24+
25+
1726
def use_lldb_substitutions(config):
1827
# Set up substitutions for primary tools. These tools must come from config.lldb_tools_dir
1928
# which is basically the build output directory. We do not want to find these in path or
@@ -58,6 +67,10 @@ def use_lldb_substitutions(config):
5867
extra_args=build_script_args)
5968
]
6069

70+
_disallow(config, 'lldb')
71+
_disallow(config, 'debugserver')
72+
_disallow(config, 'platformserver')
73+
6174
llvm_config.add_tool_substitutions(primary_tools,
6275
[config.lldb_tools_dir])
6376

@@ -141,6 +154,7 @@ def use_support_substitutions(config):
141154
additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]
142155
llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
143156

157+
_disallow(config, 'clang')
144158

145159
def use_lldb_repro_substitutions(config, mode):
146160
lldb_init = _get_lldb_init_path(config)

0 commit comments

Comments
 (0)