Author: Jonas Devlieghere
Date: 2020-01-23T14:39:27-08:00
New Revision: 8d508c597aaf5b483f4430300eda22f4d235f2ba

URL: 
https://github.com/llvm/llvm-project/commit/8d508c597aaf5b483f4430300eda22f4d235f2ba
DIFF: 
https://github.com/llvm/llvm-project/commit/8d508c597aaf5b483f4430300eda22f4d235f2ba.diff

LOG: [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

Added: 
    

Modified: 
    lldb/test/Shell/helper/toolchain.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/Shell/helper/toolchain.py 
b/lldb/test/Shell/helper/toolchain.py
index 97fdb7e0f188..a5ccfd8b8898 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -14,6 +14,15 @@ def _get_lldb_init_path(config):
     return os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
 
 
+def _disallow(config, execName):
+  warning = '''
+    echo '*** Do not use \'{0}\' in tests; use \'%''{0}\'. ***' &&
+    exit 1 && echo
+  '''
+  config.substitutions.append((' {0} '.format(execName),
+                               warning.format(execName)))
+
+
 def use_lldb_substitutions(config):
     # Set up substitutions for primary tools.  These tools must come from 
config.lldb_tools_dir
     # 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):
                   extra_args=build_script_args)
         ]
 
+    _disallow(config, 'lldb')
+    _disallow(config, 'debugserver')
+    _disallow(config, 'platformserver')
+
     llvm_config.add_tool_substitutions(primary_tools,
                                        [config.lldb_tools_dir])
 
@@ -141,6 +154,7 @@ def use_support_substitutions(config):
     additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]
     llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
 
+    _disallow(config, 'clang')
 
 def use_lldb_repro_substitutions(config, mode):
     lldb_init = _get_lldb_init_path(config)


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to