[llvm] d3d790f - Revert [lit] Support running tests on Windows without GnuWin32

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 12:38:32 PDT 2020


Author: Alexandre Ganea
Date: 2020-10-06T15:38:18-04:00
New Revision: d3d790fc9827301a49c7bbab3c1eb22da48085c6

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

LOG: Revert [lit] Support running tests on Windows without GnuWin32

This reverts b3418cb4eb1456c41606f4621dcfa362fe54183c and d12ae042e17b27ebc8d2b5ae3d8dd5f88384d093

This breaks some external bots, see discussion in https://reviews.llvm.org/D84380

In the meanwhile, please use `cmake -DLLVM_LIT_TOOLS_DIR="C:/Program Files/Git/usr/bin"` or add it to %PATH%.

Added: 
    

Modified: 
    llvm/utils/lit/lit/llvm/config.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index c8013945e3f9..e9fd75e0a5fa 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -1,4 +1,3 @@
-import itertools
 import os
 import platform
 import re
@@ -21,16 +20,13 @@ def __init__(self, lit_config, config):
         self.use_lit_shell = False
         # Tweak PATH for Win32 to decide to use bash.exe or not.
         if sys.platform == 'win32':
-            # Seek necessary tools in directories and set to $PATH.
-            path = None
-            lit_tools_dir = getattr(config, 'lit_tools_dir', None)
-            required_tools = ['cmp.exe', 'grep.exe', 'sed.exe', '
diff .exe', 'echo.exe']
-            if lit_tools_dir:
-                path = self.lit_config.getToolsPath(lit_tools_dir,
-                                                    config.environment['PATH'],
-                                                    required_tools)
-            if path is None:
-                path = self._find_git_windows_unix_tools(required_tools)
+            # For tests that require Windows to run.
+            features.add('system-windows')
+
+            # Seek sane tools in directories and set to $PATH.
+            path = self.lit_config.getToolsPath(config.lit_tools_dir,
+                                                config.environment['PATH'],
+                                                ['cmp.exe', 'grep.exe', 'sed.exe'])
             if path is not None:
                 self.with_environment('PATH', path, append_path=True)
             # Many tools behave strangely if these environment variables aren't set.
@@ -121,35 +117,6 @@ def __init__(self, lit_config, config):
                 self.with_environment(
                     'DYLD_INSERT_LIBRARIES', gmalloc_path_str)
 
-    def _find_git_windows_unix_tools(self, tools_needed):
-        assert(sys.platform == 'win32')
-        if sys.version_info.major >= 3:
-            import winreg
-        else:
-            import _winreg as winreg
-
-        # Search both the 64 and 32-bit hives, as well as HKLM + HKCU
-        masks = [0, winreg.KEY_WOW64_64KEY]
-        hives = [winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER]
-        for mask, hive in itertools.product(masks, hives):
-            try:
-                with winreg.OpenKey(hive, r"SOFTWARE\GitForWindows", 0,
-                                    winreg.KEY_READ | mask) as key:
-                    install_root, _ = winreg.QueryValueEx(key, 'InstallPath')
-
-                    if not install_root:
-                        continue
-                    candidate_path = os.path.join(install_root, 'usr', 'bin')
-                    if not lit.util.checkToolsPath(candidate_path, tools_needed):
-                        continue
-
-                    # We found it, stop enumerating.
-                    return lit.util.to_string(candidate_path)
-            except:
-                continue
-
-        return None
-
     def with_environment(self, variable, value, append_path=False):
         if append_path:
             # For paths, we should be able to take a list of them and process all
@@ -169,7 +136,7 @@ def norm(x):
                 paths = []
 
             # If we are passed a list [a b c], then iterating this list forwards
-            # and adding each to the beginning would result in c b a.  So we
+            # and adding each to the beginning would result in b c a.  So we
             # need to iterate in reverse to end up with the original ordering.
             for p in reversed(paths_to_add):
                 # Move it to the front if it already exists, otherwise insert it at the


        


More information about the llvm-commits mailing list