llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Arthur Eubanks (aeubanks)

<details>
<summary>Changes</summary>

http://github.com/llvm/llvm-project/pull/95220 added a test with a very long 
file path, which can fail if run on Windows with a long directory path.

On Windows, there are file path length limits, which can be worked around by 
prefixing the (absolute) path with '\\?\': 
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

---
Full diff: https://github.com/llvm/llvm-project/pull/155318.diff


1 Files Affected:

- (modified) clang-tools-extra/test/clang-tidy/check_clang_tidy.py (+5-1) 


``````````diff
diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py 
b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
index d225258c5d75d..7c77e498f28f8 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -45,6 +45,7 @@
 import argparse
 import os
 import pathlib
+import platform
 import re
 import subprocess
 import sys
@@ -145,7 +146,10 @@ def __init__(self, args: argparse.Namespace, extra_args: 
List[str]) -> None:
             self.clang_extra_args.append("-resource-dir=%s" % 
self.resource_dir)
 
     def read_input(self) -> None:
-        with open(self.input_file_name, "r", encoding="utf-8") as input_file:
+        file_name = self.input_file_name
+        if platform.system() == "Windows":
+            file_name = "\\\\?\\" + os.path.abspath(file_name)
+        with open(file_name, "r", encoding="utf-8") as input_file:
             self.input_text = input_file.read()
 
     def get_prefixes(self) -> None:

``````````

</details>


https://github.com/llvm/llvm-project/pull/155318
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to