[llvm] Introduce a new CMake option to test LLVM_WINDOWS_PREFER_FORWARD_SLASH behaviors (PR #207194)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 07:28:01 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD llvm/test/Unit/lit.cfg.py llvm/test/lit.cfg.py llvm/utils/lit/lit/TestRunner.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- test/lit.cfg.py	2026-07-02 14:19:49.000000 +0000
+++ test/lit.cfg.py	2026-07-02 14:27:23.819160 +0000
@@ -110,16 +110,18 @@
     config.test_exec_root = os.path.join(config.llvm_obj_root, "test")
 
 # Tweak the PATH to include the tools dir.
 llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
 
-llvm_config.with_system_environment(["HOME", "INCLUDE", "LIB", "TMP", "TEMP", "LLVM_WINDOWS_PREFER_FORWARD_SLASH"])
+llvm_config.with_system_environment(
+    ["HOME", "INCLUDE", "LIB", "TMP", "TEMP", "LLVM_WINDOWS_PREFER_FORWARD_SLASH"]
+)
 
 prefer_forward_slash = getattr(config, "llvm_windows_prefer_forward_slash", "")
 if prefer_forward_slash in ("1", "ON", "True"):
     config.environment["LLVM_WINDOWS_PREFER_FORWARD_SLASH"] = "1"
-    
+
     # Restrict forward-slash testing to a reasonable subset
     # by excluding directories that don't deal with file paths or formatting
     forward_slash_subsets = {"DebugInfo", "MC", "Support", "tools", "Unit"}
     for subdir in os.listdir(config.test_source_root):
         subdir_path = os.path.join(config.test_source_root, subdir)
--- utils/lit/lit/TestRunner.py	2026-07-02 14:26:16.000000 +0000
+++ utils/lit/lit/TestRunner.py	2026-07-02 14:27:24.313288 +0000
@@ -710,11 +710,13 @@
     cmd = make_tree(cmds)
 
     results = []
     timeoutInfo = None
     prefer_fs = getattr(test.config, "llvm_windows_prefer_forward_slash", "")
-    normalize_slashes = (prefer_fs in ("1", "ON", "True")) or litConfig.params.get("use_normalized_slashes", False)
+    normalize_slashes = (prefer_fs in ("1", "ON", "True")) or litConfig.params.get(
+        "use_normalized_slashes", False
+    )
     shenv = ShellEnvironment(
         cwd, test.config.environment, normalize_slashes=normalize_slashes
     )
     shenv.env["LIT_CURRENT_TESTCASE"] = test.getFullName()
 
@@ -1942,11 +1944,14 @@
     substitutions += getDefaultSubstitutions(
         test,
         tmpDir,
         tmpBase,
         normalize_slashes=useExternalSh
-        or (getattr(test.config, "llvm_windows_prefer_forward_slash", "") in ("1", "ON", "True"))
+        or (
+            getattr(test.config, "llvm_windows_prefer_forward_slash", "")
+            in ("1", "ON", "True")
+        )
         or litConfig.params.get("use_normalized_slashes", False),
     )
     conditions = {feature: True for feature in test.config.available_features}
     script = applySubstitutions(
         script,

``````````

</details>


https://github.com/llvm/llvm-project/pull/207194


More information about the llvm-commits mailing list