[Lldb-commits] [lldb] 99ece01 - [lldb/win] Fix TestIRMemoryMapWindows.test when running tests in git bash

Nico Weber via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 16 04:41:52 PDT 2021


Author: Nico Weber
Date: 2021-09-16T07:40:54-04:00
New Revision: 99ece01a0f571f0df129a55bf679f7fbd0b01b75

URL: https://github.com/llvm/llvm-project/commit/99ece01a0f571f0df129a55bf679f7fbd0b01b75
DIFF: https://github.com/llvm/llvm-project/commit/99ece01a0f571f0df129a55bf679f7fbd0b01b75.diff

LOG: [lldb/win] Fix TestIRMemoryMapWindows.test when running tests in git bash

lit.util.which('link') picks up the wrong link.exe in git bash, leading
to this error:

  # command stderr:
  /usr/bin/link: extra operand '/LIBPATH:C:\\Progra....'
  Try '/usr/bin/link --help' for more information.

Instead, assume that link.exe is next to cl.exe.

Differential Revision: https://reviews.llvm.org/D109832

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 6ccb529e8985..4303b2583e7b 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -90,11 +90,14 @@ def _use_msvc_substitutions(config):
     # detect the include and lib paths, and find cl.exe and link.exe and create
     # substitutions for each of them that explicitly specify /I and /L paths
     cl = lit.util.which('cl')
-    link = lit.util.which('link')
 
-    if not cl or not link:
+    if not cl:
         return
 
+    # Don't use lit.util.which() for link.exe: In `git bash`, it will pick
+    # up /usr/bin/link (another name for ln).
+    link = os.path.join(os.path.dirname(cl), 'link.exe')
+
     cl = '"' + cl + '"'
     link = '"' + link + '"'
     includes = os.getenv('INCLUDE', '').split(';')


        


More information about the lldb-commits mailing list