Skip to content

Commit 83da7b6

Browse files
[mlir] Extend split marker tests of mlir-opt and mlir-pdll. (#85620)
Recently #84765 made the split markers of various tools configurable but did not test *not* using the split markers for two of them. This PR adds those tests.
1 parent e1f50fd commit 83da7b6

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

mlir/test/mlir-opt/split-markers.mlir

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
// Check near-miss mechanics:
22
// RUN: mlir-opt --split-input-file --verify-diagnostics %s 2> %t \
3-
// RUN: && FileCheck --input-file %t %s
3+
// RUN: && FileCheck --input-file %t --check-prefix=CHECK-DEFAULT %s
44
// RUN: cat %t
55

66
// Check that (1) custom input splitter and (2) custom output splitters work.
7-
// RUN: mlir-opt %s -split-input-file="// CHECK: ""----" \
7+
// RUN: mlir-opt %s -split-input-file="// CHECK-DEFAULT: ""----" \
88
// RUN: -output-split-marker="// ---- next split ----" \
9-
// RUN: | FileCheck --check-prefix=CHECK-SPLITTERS %s
9+
// RUN: | FileCheck --check-prefix=CHECK-CUSTOM %s
10+
11+
// Check that (3) the input is not split if `-split-input-file` is not given.
12+
// RUN: mlir-opt %s 2> %t \
13+
// RUN: || FileCheck --input-file %t --check-prefix=CHECK-NOSPLIT %s
14+
// RUN: cat %t
1015

1116
func.func @main() {return}
1217

1318
// -----
1419

1520
// expected-note @+1 {{see existing symbol definition here}}
1621
func.func @foo() { return }
17-
// CHECK: warning: near miss with file split marker
18-
// CHECK: ----
22+
// CHECK-DEFAULT: warning: near miss with file split marker
23+
// CHECK-DEFAULT: ----
1924
// ----
2025

26+
// CHECK-NOSPLIT: error: redefinition of symbol named 'main'
27+
func.func @main() {return}
28+
2129
// expected-error @+1 {{redefinition of symbol named 'foo'}}
2230
func.func @foo() { return }
23-
// CHECK: warning: near miss with file split marker
24-
// CHECK: ----
31+
// CHECK-DEFAULT: warning: near miss with file split marker
32+
// CHECK-DEFAULT: ----
2533
// ----
2634
func.func @bar2() {return }
2735

2836
// No error flagged at the end for a near miss.
2937
// ----
3038

31-
// CHECK-SPLITTERS: module
32-
// CHECK-SPLITTERS: ---- next split ----
33-
// CHECK-SPLITTERS: module
34-
// CHECK-SPLITTERS: ---- next split ----
35-
// CHECK-SPLITTERS: module
39+
// CHECK-CUSTOM: module
40+
// CHECK-CUSTOM: ---- next split ----
41+
// CHECK-CUSTOM: module
42+
// CHECK-CUSTOM: ---- next split ----
43+
// CHECK-CUSTOM: module

mlir/test/mlir-pdll/split-markers.pdll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// RUN: -split-input-file="// ""=====" -output-split-marker "// #####" \
1010
// RUN: | FileCheck -check-prefix=CHECK-CUSTOM %s
1111

12+
// Check that (5) the input is not split if `-split-input-file` is not given.
13+
// RUN: mlir-pdll %s \
14+
// RUN: | FileCheck -check-prefix=CHECK-NOSPLIT %s
15+
1216
// CHECK-DEFAULT: Module
1317
// CHECK-DEFAULT-NEXT: PatternDecl
1418
// CHECK-DEFAULT-NOT: PatternDecl
@@ -25,6 +29,14 @@
2529
// CHECK-CUSTOM-NEXT: PatternDecl
2630
// CHECK-CUSTOM-NOT: PatternDecl
2731

32+
// CHECK-NOSPLIT: Module
33+
// CHECK-NOSPLIT-NEXT: PatternDecl
34+
// CHECK-NOSPLIT-NOT: Module
35+
// CHECK-NOSPLIT: PatternDecl
36+
// CHECK-NOSPLIT-NOT: Module
37+
// CHECK-NOSPLIT: PatternDecl
38+
// CHECK-NOSPLIT-NOT: Module
39+
2840
Pattern => erase op<test.op>;
2941

3042
// -----

0 commit comments

Comments
 (0)