Skip to content

Commit c3b471d

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 (cherry picked from commit 8d508c5)
1 parent 5e17daf commit c3b471d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lldb/test/Shell/helper/toolchain.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
from lit.llvm.subst import FindTool
1010
from lit.llvm.subst import ToolSubst
1111

12+
def _disallow(config, execName):
13+
warning = '''
14+
echo '*** Do not use \'{0}\' in tests; use \'%''{0}\'. ***' &&
15+
exit 1 && echo
16+
'''
17+
config.substitutions.append((' {0} '.format(execName),
18+
warning.format(execName)))
19+
20+
1221
def use_lldb_substitutions(config):
1322
# Set up substitutions for primary tools. These tools must come from config.lldb_tools_dir
1423
# which is basically the build output directory. We do not want to find these in path or
@@ -53,6 +62,10 @@ def use_lldb_substitutions(config):
5362
extra_args=build_script_args)
5463
]
5564

65+
_disallow(config, 'lldb')
66+
_disallow(config, 'debugserver')
67+
_disallow(config, 'platformserver')
68+
5669
llvm_config.add_tool_substitutions(primary_tools,
5770
[config.lldb_tools_dir])
5871

@@ -135,3 +148,5 @@ def use_support_substitutions(config):
135148
'llvm-objcopy', 'lli']
136149
additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]
137150
llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
151+
152+
_disallow(config, 'clang')

0 commit comments

Comments
 (0)