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

Junji Watanabe llvmlistbot at llvm.org
Mon Apr 27 21:55:24 PDT 2026


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

>From cbc1e0932ac7ea83d8b8462b30a7e06d35a868b2 Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Wed, 4 Mar 2026 13:22:33 +0900
Subject: [PATCH 1/8] fix llvm tests

---
 llvm/test/tools/llvm-cov/directory_coverage.win.test      | 8 ++++----
 llvm/test/tools/llvm-cov/native_separators.c              | 6 +++---
 .../X86/source-interleave-prefix-windows.test             | 2 +-
 llvm/unittests/Support/CommandLineTest.cpp                | 4 ++--
 llvm/unittests/Support/Path.cpp                           | 7 ++++++-
 5 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/directory_coverage.win.test b/llvm/test/tools/llvm-cov/directory_coverage.win.test
index f948bdcae3a58..739375a037f48 100644
--- a/llvm/test/tools/llvm-cov/directory_coverage.win.test
+++ b/llvm/test/tools/llvm-cov/directory_coverage.win.test
@@ -23,13 +23,13 @@
 
 
 
-# HTML-TOP: coverage\index.html
+# HTML-TOP: coverage{{[/\\]}}index.html
 
-# ROOT: a0\a1\a2.cc
-# ROOT: b0\
+# ROOT: a0{{[/\\]}}a1{{[/\\]}}a2.cc
+# ROOT: b0{{[/\\]}}
 # ROOT-NOT: b1_1.cc
 # ROOT-NOT: b1_2.cc
-# ROOT: c0\c1\
+# ROOT: c0{{[/\\]}}c1{{[/\\]}}
 # ROOT-NOT: c2_1.cc
 # ROOT-NOT: b2_2.cc
 # ROOT: main.cc
diff --git a/llvm/test/tools/llvm-cov/native_separators.c b/llvm/test/tools/llvm-cov/native_separators.c
index 3c768e1014b92..b6ad175aa8f33 100644
--- a/llvm/test/tools/llvm-cov/native_separators.c
+++ b/llvm/test/tools/llvm-cov/native_separators.c
@@ -13,8 +13,8 @@
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
 // RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s
 
-// TEXT-INDEX: \tmp\native_separators.c
-// HTML-INDEX: >tmp\native_separators.c</a>
-// HTML: <pre>\tmp\native_separators.c</pre>
+// TEXT-INDEX: {{[/\\]}}tmp{{[/\\]}}native_separators.c
+// HTML-INDEX: >tmp{{[/\\]}}native_separators.c</a>
+// HTML: <pre>{{[/\\]}}tmp{{[/\\]}}native_separators.c</pre>
 
 int main() {}
diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
index 0f8952daec42e..db5265b26d5a3 100644
--- a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
+++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
@@ -7,5 +7,5 @@
 ; RUN: sed -e "s,SRC_COMPDIR,/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll
 ; RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
 ; RUN: llvm-objdump --prefix 'myprefix/\' --source %t.o 2>&1 | FileCheck %s -DFILE=%t.o -DPREFIX='myprefix'
-; CHECK: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs\source-interleave-x86_64.c
+; CHECK: warning: '[[FILE]]': failed to find source [[PREFIX]]{{[/\\]}}Inputs{{[/\\]}}source-interleave-x86_64.c
 
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 9e8a165fe136f..2f91c2ac8c1f0 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -950,7 +950,7 @@ TEST(CommandLineTest, ResponseFiles) {
 TEST(CommandLineTest, RecursiveResponseFiles) {
   vfs::InMemoryFileSystem FS;
 #ifdef _WIN32
-  const char *TestRoot = "C:\\";
+  const char *TestRoot = LLVM_WINDOWS_PREFER_FORWARD_SLASH ? "C:/" : "C:\\";
 #else
   const char *TestRoot = "/";
 #endif
@@ -1020,7 +1020,7 @@ TEST(CommandLineTest, RecursiveResponseFiles) {
 TEST(CommandLineTest, ResponseFilesAtArguments) {
   vfs::InMemoryFileSystem FS;
 #ifdef _WIN32
-  const char *TestRoot = "C:\\";
+  const char *TestRoot = LLVM_WINDOWS_PREFER_FORWARD_SLASH ? "C:/" : "C:\\";
 #else
   const char *TestRoot = "/";
 #endif
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 9fb3ac155c7fe..4ec6b712c0255 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -11,6 +11,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/Magic.h"
+#include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"
@@ -2584,7 +2585,9 @@ TEST_F(FileSystemTest, makeLongFormPath) {
 
   // Setup: A test directory longer than 8 characters for which a distinct
   // short 8.3 form name will be created on Windows. Typically, 123456~1.
-  constexpr const char *OneDir = "\\123456789"; // >8 chars
+  const char *OneDir = LLVM_WINDOWS_PREFER_FORWARD_SLASH
+                           ? "/123456789"
+                           : "\\123456789"; // >8 chars
 
   // Setup: Create a path where even if all components were reduced to short 8.3
   // form names, the total length would exceed MAX_PATH.
@@ -2617,6 +2620,8 @@ TEST_F(FileSystemTest, makeLongFormPath) {
   ASSERT_FALSE(DotAndDotDot.empty())
       << "Expected short 8.3 form path for test directory.";
   auto ContainsDotAndDotDot = [](llvm::StringRef S) {
+    if (LLVM_WINDOWS_PREFER_FORWARD_SLASH)
+      return S.contains("/./") && S.contains("/../");
     return S.contains("\\.\\") && S.contains("\\..\\");
   };
   ASSERT_TRUE(ContainsDotAndDotDot(DotAndDotDot))

>From cee09545540aa04a37c5495686f4864d516176a5 Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Fri, 6 Mar 2026 11:11:53 +0900
Subject: [PATCH 2/8] Disable llvm-cov/native_separators test

---
 llvm/test/lit.site.cfg.py.in                 | 3 +++
 llvm/test/tools/llvm-cov/native_separators.c | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in
index 6fe48f21cc685..88ca6f0dad3f0 100644
--- a/llvm/test/lit.site.cfg.py.in
+++ b/llvm/test/lit.site.cfg.py.in
@@ -70,6 +70,9 @@ config.has_logf128 = @LLVM_HAS_LOGF128@
 config.have_ondisk_cas = @LLVM_ENABLE_ONDISK_CAS@
 
 import lit.llvm
+if lit.util.pythonize_bool("@LLVM_WINDOWS_PREFER_FORWARD_SLASH@"):
+    config.available_features.add("windows-prefer-forward-slash")
+
 lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
diff --git a/llvm/test/tools/llvm-cov/native_separators.c b/llvm/test/tools/llvm-cov/native_separators.c
index b6ad175aa8f33..0f81b8bdcb5fb 100644
--- a/llvm/test/tools/llvm-cov/native_separators.c
+++ b/llvm/test/tools/llvm-cov/native_separators.c
@@ -3,7 +3,7 @@
 // This test is Windows-only. It checks that all paths, which are generated
 // in the index and source coverage reports, are native path. For example,
 // on Windows all '/' are converted to '\'.
-// REQUIRES: system-windows
+// REQUIRES: system-windows, !windows-prefer-forward-slash
 
 // RUN: llvm-profdata merge %S/Inputs/double_dots.proftext -o %t.profdata
 // RUN: llvm-cov show %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -o %t.dir
@@ -13,8 +13,8 @@
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
 // RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s
 
-// TEXT-INDEX: {{[/\\]}}tmp{{[/\\]}}native_separators.c
-// HTML-INDEX: >tmp{{[/\\]}}native_separators.c</a>
-// HTML: <pre>{{[/\\]}}tmp{{[/\\]}}native_separators.c</pre>
+// TEXT-INDEX: \tmp\native_separators.c
+// HTML-INDEX: >tmp\native_separators.c</a>
+// HTML: <pre>\tmp\native_separators.c</pre>
 
 int main() {}

>From b47928366d0861273b6f279baac9e7a498b3b53a Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Fri, 6 Mar 2026 14:33:19 +0900
Subject: [PATCH 3/8] skip directory_coverage.win.test

---
 llvm/test/tools/llvm-cov/directory_coverage.win.test | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/directory_coverage.win.test b/llvm/test/tools/llvm-cov/directory_coverage.win.test
index 739375a037f48..5551cac0270cb 100644
--- a/llvm/test/tools/llvm-cov/directory_coverage.win.test
+++ b/llvm/test/tools/llvm-cov/directory_coverage.win.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-windows
+# REQUIRES: system-windows, !windows-prefer-forward-slash
 # RUN: mkdir -p %t
 
 # RUN: llvm-cov show %S/Inputs/directory_coverage/main.covmapping \
@@ -23,13 +23,13 @@
 
 
 
-# HTML-TOP: coverage{{[/\\]}}index.html
+# HTML-TOP: coverage\index.html
 
-# ROOT: a0{{[/\\]}}a1{{[/\\]}}a2.cc
-# ROOT: b0{{[/\\]}}
+# ROOT: a0\a1\a2.cc
+# ROOT: b0\
 # ROOT-NOT: b1_1.cc
 # ROOT-NOT: b1_2.cc
-# ROOT: c0{{[/\\]}}c1{{[/\\]}}
+# ROOT: c0\c1\
 # ROOT-NOT: c2_1.cc
 # ROOT-NOT: b2_2.cc
 # ROOT: main.cc

>From c448116b9e9741a861523da52958eacd455c5788 Mon Sep 17 00:00:00 2001
From: Jeongseok Son <jeongseok.son at gmail.com>
Date: Thu, 5 Mar 2026 21:31:01 -0800
Subject: [PATCH 4/8] [mlir] Improve dialect conversion failure diagnostics
 (#182729)

This PR improves MLIR dialect conversion failure diagnostics when
legalization fails.

Previously, the diagnostic mostly included the operation name (and in
partial conversion, whether it was explicitly marked illegal). This
change keeps that prefix and appends the printed failing operation. This
provides immediate operand/result/type context directly in the same
error line.

### Example

Before:
```
failed to legalize operation 'test.type_consumer' that was explicitly marked illegal
```

After:
```
failed to legalize operation 'test.type_consumer' that was explicitly marked illegal: "test.type_consumer"(%arg0) : (f32) -> ()
```

### Tests
- Updated `mlir/test/Transforms/test-legalizer.mlir` expectations for
the richer emitted diagnostic.
---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 14 ++++++++++----
 mlir/test/Transforms/test-legalizer.mlir        |  4 ++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index c5facc32e4461..1dfa2103f57a7 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -3304,6 +3304,14 @@ struct OperationConverter {
 LogicalResult OperationConverter::convert(Operation *op,
                                           bool isRecursiveLegalization) {
   const ConversionConfig &config = rewriter.getConfig();
+  auto emitFailedToLegalizeDiag = [&](bool wasExplicitlyIllegal) {
+    InFlightDiagnostic diag = op->emitError()
+                              << "failed to legalize operation '"
+                              << op->getName() << "'";
+    if (wasExplicitlyIllegal)
+      diag << " that was explicitly marked illegal";
+    diag << ": " << OpWithFlags(op, OpPrintingFlags().skipRegions());
+  };
 
   // Legalize the given operation.
   if (failed(opLegalizer.legalize(op))) {
@@ -3311,8 +3319,7 @@ LogicalResult OperationConverter::convert(Operation *op,
     // Full conversions expect all operations to be converted.
     if (mode == OpConversionMode::Full) {
       if (!isRecursiveLegalization)
-        op->emitError() << "failed to legalize operation '" << op->getName()
-                        << "'";
+        emitFailedToLegalizeDiag(/*wasExplicitlyIllegal=*/false);
       return failure();
     }
     // Partial conversions allow conversions to fail iff the operation was not
@@ -3321,8 +3328,7 @@ LogicalResult OperationConverter::convert(Operation *op,
     if (mode == OpConversionMode::Partial) {
       if (opLegalizer.isIllegal(op)) {
         if (!isRecursiveLegalization)
-          op->emitError() << "failed to legalize operation '" << op->getName()
-                          << "' that was explicitly marked illegal";
+          emitFailedToLegalizeDiag(/*wasExplicitlyIllegal=*/true);
         return failure();
       }
       if (config.unlegalizedOps && !isRecursiveLegalization)
diff --git a/mlir/test/Transforms/test-legalizer.mlir b/mlir/test/Transforms/test-legalizer.mlir
index 842d9cfb4a471..c074d6b80484b 100644
--- a/mlir/test/Transforms/test-legalizer.mlir
+++ b/mlir/test/Transforms/test-legalizer.mlir
@@ -226,7 +226,7 @@ func.func @bounded_recursion() {
 builtin.module {
 
   func.func @fail_to_convert_illegal_op() -> i32 {
-    // expected-error at +1 {{failed to legalize operation 'test.illegal_op_f'}}
+    // expected-error at +1 {{failed to legalize operation 'test.illegal_op_f' that was explicitly marked illegal: %0 = "test.illegal_op_f"() : () -> i32}}
     %result = "test.illegal_op_f"() : () -> (i32)
     return %result : i32
   }
@@ -434,7 +434,7 @@ func.func @test_lookup_without_converter() {
 // expected-remark at -1 {{applyPartialConversion failed}}
 
 func.func @test_skip_1to1_pattern(%arg0: f32) {
-  // expected-error at +1 {{failed to legalize operation 'test.type_consumer'}}
+  // expected-error at +1 {{failed to legalize operation 'test.type_consumer' that was explicitly marked illegal}}
   "test.type_consumer"(%arg0) : (f32) -> ()
   return
 }

>From 2da44ac71331703c38a8069d2b963dec2ab8d99c Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Wed, 4 Mar 2026 13:22:33 +0900
Subject: [PATCH 5/8] fix llvm tests

---
 llvm/test/tools/llvm-cov/directory_coverage.win.test | 8 ++++----
 llvm/test/tools/llvm-cov/native_separators.c         | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/directory_coverage.win.test b/llvm/test/tools/llvm-cov/directory_coverage.win.test
index 5551cac0270cb..b2953ab70417b 100644
--- a/llvm/test/tools/llvm-cov/directory_coverage.win.test
+++ b/llvm/test/tools/llvm-cov/directory_coverage.win.test
@@ -23,13 +23,13 @@
 
 
 
-# HTML-TOP: coverage\index.html
+# HTML-TOP: coverage{{[/\\]}}index.html
 
-# ROOT: a0\a1\a2.cc
-# ROOT: b0\
+# ROOT: a0{{[/\\]}}a1{{[/\\]}}a2.cc
+# ROOT: b0{{[/\\]}}
 # ROOT-NOT: b1_1.cc
 # ROOT-NOT: b1_2.cc
-# ROOT: c0\c1\
+# ROOT: c0{{[/\\]}}c1{{[/\\]}}
 # ROOT-NOT: c2_1.cc
 # ROOT-NOT: b2_2.cc
 # ROOT: main.cc
diff --git a/llvm/test/tools/llvm-cov/native_separators.c b/llvm/test/tools/llvm-cov/native_separators.c
index 0f81b8bdcb5fb..f55a28b586e14 100644
--- a/llvm/test/tools/llvm-cov/native_separators.c
+++ b/llvm/test/tools/llvm-cov/native_separators.c
@@ -13,8 +13,8 @@
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
 // RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s
 
-// TEXT-INDEX: \tmp\native_separators.c
-// HTML-INDEX: >tmp\native_separators.c</a>
-// HTML: <pre>\tmp\native_separators.c</pre>
+// TEXT-INDEX: {{[/\\]}}tmp{{[/\\]}}native_separators.c
+// HTML-INDEX: >tmp{{[/\\]}}native_separators.c</a>
+// HTML: <pre>{{[/\\]}}tmp{{[/\\]}}native_separators.c</pre>
 
 int main() {}

>From f8fbc88b2ebbcd2765fa0ec98ed7db4c37859b13 Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Fri, 6 Mar 2026 11:11:53 +0900
Subject: [PATCH 6/8] Disable llvm-cov/native_separators test

---
 llvm/test/tools/llvm-cov/native_separators.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/native_separators.c b/llvm/test/tools/llvm-cov/native_separators.c
index f55a28b586e14..0f81b8bdcb5fb 100644
--- a/llvm/test/tools/llvm-cov/native_separators.c
+++ b/llvm/test/tools/llvm-cov/native_separators.c
@@ -13,8 +13,8 @@
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
 // RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s
 
-// TEXT-INDEX: {{[/\\]}}tmp{{[/\\]}}native_separators.c
-// HTML-INDEX: >tmp{{[/\\]}}native_separators.c</a>
-// HTML: <pre>{{[/\\]}}tmp{{[/\\]}}native_separators.c</pre>
+// TEXT-INDEX: \tmp\native_separators.c
+// HTML-INDEX: >tmp\native_separators.c</a>
+// HTML: <pre>\tmp\native_separators.c</pre>
 
 int main() {}

>From ddcaf37c810a0d50e13fc8f7bab3d4a99dd5148d Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Fri, 6 Mar 2026 14:33:19 +0900
Subject: [PATCH 7/8] skip directory_coverage.win.test

---
 llvm/test/tools/llvm-cov/directory_coverage.win.test | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/directory_coverage.win.test b/llvm/test/tools/llvm-cov/directory_coverage.win.test
index b2953ab70417b..5551cac0270cb 100644
--- a/llvm/test/tools/llvm-cov/directory_coverage.win.test
+++ b/llvm/test/tools/llvm-cov/directory_coverage.win.test
@@ -23,13 +23,13 @@
 
 
 
-# HTML-TOP: coverage{{[/\\]}}index.html
+# HTML-TOP: coverage\index.html
 
-# ROOT: a0{{[/\\]}}a1{{[/\\]}}a2.cc
-# ROOT: b0{{[/\\]}}
+# ROOT: a0\a1\a2.cc
+# ROOT: b0\
 # ROOT-NOT: b1_1.cc
 # ROOT-NOT: b1_2.cc
-# ROOT: c0{{[/\\]}}c1{{[/\\]}}
+# ROOT: c0\c1\
 # ROOT-NOT: c2_1.cc
 # ROOT-NOT: b2_2.cc
 # ROOT: main.cc

>From a8b6ee529c6e616951104da0009468fe6f8d58b1 Mon Sep 17 00:00:00 2001
From: Junji Watanabe <jwata at google.com>
Date: Tue, 28 Apr 2026 13:54:39 +0900
Subject: [PATCH 8/8] [llvm-cov] Fix Windows path separator issues in tests

---
 .../llvm-cov/directory_coverage.win.test      | 26 +++++++++----------
 llvm/test/tools/llvm-cov/native_separators.c  | 14 +++++-----
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/directory_coverage.win.test b/llvm/test/tools/llvm-cov/directory_coverage.win.test
index 5551cac0270cb..572836cdb6033 100644
--- a/llvm/test/tools/llvm-cov/directory_coverage.win.test
+++ b/llvm/test/tools/llvm-cov/directory_coverage.win.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-windows, !windows-prefer-forward-slash
+# REQUIRES: system-windows
 # RUN: mkdir -p %t
 
 # RUN: llvm-cov show %S/Inputs/directory_coverage/main.covmapping \
@@ -11,25 +11,25 @@
 # RUN:   --path-equivalence=/tmp/directory_coverage,%S/Inputs/directory_coverage \
 # RUN:   --format=html --show-directory-coverage -o %t/report-html
 
-# RUN: FileCheck --input-file %t/report-text/index.txt %s --check-prefix=ROOT
-# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/index.txt %s --check-prefix=ROOT
-# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/b0/index.txt %s --check-prefix=B0
-# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/c0/c1/index.txt %s --check-prefix=C1
+# RUN: FileCheck --input-file %t/report-text/index.txt %s --check-prefix=ROOT -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/index.txt %s --check-prefix=ROOT -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/b0/index.txt %s --check-prefix=B0 -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/c0/c1/index.txt %s --check-prefix=C1 -DSEP=%{fs-sep}
 
-# RUN: FileCheck --input-file %t/report-html/index.html %s --check-prefix=HTML-TOP --allow-empty
-# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/index.html %s --check-prefix=ROOT
-# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/b0/index.html %s --check-prefix=B0
-# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/c0/c1/index.html %s --check-prefix=C1
+# RUN: FileCheck --input-file %t/report-html/index.html %s --check-prefix=HTML-TOP --allow-empty -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/index.html %s --check-prefix=ROOT -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/b0/index.html %s --check-prefix=B0 -DSEP=%{fs-sep}
+# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/c0/c1/index.html %s --check-prefix=C1 -DSEP=%{fs-sep}
 
 
 
-# HTML-TOP: coverage\index.html
+# HTML-TOP: coverage[[SEP]]index.html
 
-# ROOT: a0\a1\a2.cc
-# ROOT: b0\
+# ROOT: a0[[SEP]]a1[[SEP]]a2.cc
+# ROOT: b0[[SEP]]
 # ROOT-NOT: b1_1.cc
 # ROOT-NOT: b1_2.cc
-# ROOT: c0\c1\
+# ROOT: c0[[SEP]]c1[[SEP]]
 # ROOT-NOT: c2_1.cc
 # ROOT-NOT: b2_2.cc
 # ROOT: main.cc
diff --git a/llvm/test/tools/llvm-cov/native_separators.c b/llvm/test/tools/llvm-cov/native_separators.c
index 0f81b8bdcb5fb..018cf0a66fe44 100644
--- a/llvm/test/tools/llvm-cov/native_separators.c
+++ b/llvm/test/tools/llvm-cov/native_separators.c
@@ -3,18 +3,18 @@
 // This test is Windows-only. It checks that all paths, which are generated
 // in the index and source coverage reports, are native path. For example,
 // on Windows all '/' are converted to '\'.
-// REQUIRES: system-windows, !windows-prefer-forward-slash
+// REQUIRES: system-windows
 
 // RUN: llvm-profdata merge %S/Inputs/double_dots.proftext -o %t.profdata
 // RUN: llvm-cov show %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -o %t.dir
-// RUN: FileCheck -check-prefixes=TEXT-INDEX -input-file=%t.dir/index.txt %s
+// RUN: FileCheck -check-prefixes=TEXT-INDEX -input-file=%t.dir/index.txt -DSEP=%{fs-sep} %s
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %S/../llvm-"config"/../llvm-"cov"/native_separators.c -o %t.dir
-// RUN: FileCheck -check-prefixes=HTML-INDEX -input-file=%t.dir/index.html %s
+// RUN: FileCheck -check-prefixes=HTML-INDEX -input-file=%t.dir/index.html -DSEP=%{fs-sep} %s
 // RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
-// RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s
+// RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html -DSEP=%{fs-sep} %s
 
-// TEXT-INDEX: \tmp\native_separators.c
-// HTML-INDEX: >tmp\native_separators.c</a>
-// HTML: <pre>\tmp\native_separators.c</pre>
+// TEXT-INDEX: [[SEP]]tmp[[SEP]]native_separators.c
+// HTML-INDEX: >tmp[[SEP]]native_separators.c</a>
+// HTML: <pre>[[SEP]]tmp[[SEP]]native_separators.c</pre>
 
 int main() {}



More information about the Mlir-commits mailing list