[Mlir-commits] [mlir] [mlir][tblgen] Adds support for embedded LIT tests in TableGen records (PR #158017)
    Jeremy Kun 
    llvmlistbot at llvm.org
       
    Thu Sep 11 09:03:37 PDT 2025
    
    
  
================
@@ -0,0 +1,65 @@
+// RUN: mlir-tblgen -gen-lit-tests -I %S/../../include -dialect=test %s | FileCheck %s
+
+include "mlir/Pass/PassBase.td"
+include "mlir/IR/Testable.td"
+
+def TestPassWithEmbeddedLitTests : Pass<"test-pass-with-embedded-lit-tests"> {
+  let summary = "pass summary";
+  let description = [{
+    Pass description
+  }];
+  
+  let tests = [
+    LitTest<
+      "lit_test_file_1.mlir", 
+      [{
+          func.func @test1() {
----------------
j2kun wrote:
Rather than try to reconstruct the list test from separate records, it seems like it would be simpler to have a single text field that contains the entire lit test, and this feature would limit the allowed complexity of the RUN line. (e.g., only one RUN line with one pipe)
Or you could have the entire lit test in one field, except for the RUN line, and autogenerate the run line as `// RUN: mlir-opt %s <pass-flag> | FileCheck %s`, since `<pass-flag>` is already part of the tablegen record and also it would be a good practice to ensure that the behavior tested/documented for a pass is restricted to just what that one pass does.
https://github.com/llvm/llvm-project/pull/158017
    
    
More information about the Mlir-commits
mailing list