[llvm] [Windows][test] Fix "LLVM" test failures when LLVM_WINDOWS_PREFER_FORWARD_SLASH is ON (PR #184556)

Junji Watanabe via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 23:04:42 PST 2026


https://github.com/Jwata created https://github.com/llvm/llvm-project/pull/184556

This patch fixes several LLVM test failures on Windows that occur when the LLVM_WINDOWS_PREFER_FORWARD_SLASH CMake option is enabled.

The failures were caused by tests either hardcoding backslash expectations in FileCheck or constructing paths with strict backslashes in C++ unit tests, both of which break when the environment is configured to prefer forward slashes.

Specific changes:
- `llvm-cov` and `llvm-objdump` lit tests: Relaxed FileCheck patterns (in directory_coverage.win.test, native_separators.c, and source-interleave-prefix-windows.test) to accept either forward or backward slashes using the {{[/\\]}} regex. This makes the path matching resilient to the underlying separator preference without losing precision.
- CommandLineTest.cpp: Conditionalized the TestRoot variable to use C:/ instead of C:\ when LLVM_WINDOWS_PREFER_FORWARD_SLASH is true.
- Path.cpp (makeLongFormPath test):
  - Included `llvm/Config/config.h` to access the `LLVM_WINDOWS_PREFER_FORWARD_SLASH` macro.
  - Updated the OneDir string literal to conditionally use `/` or `\`.
  - Updated the ContainsDotAndDotDot lambda to check for `.` and `..` components with the correct separator style based on the build configuration.

upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: Connection refused


More information about the llvm-commits mailing list