[llvm-branch-commits] [mlir] 906efee - [mlir] don't match the text produced only in debug mode in Python tests

Alex Zinenko via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 7 11:02:12 PST 2021


Author: Alex Zinenko
Date: 2021-01-07T19:57:28+01:00
New Revision: 906efeec0a471be522588bd7cbb7f61459b2b437

URL: https://github.com/llvm/llvm-project/commit/906efeec0a471be522588bd7cbb7f61459b2b437
DIFF: https://github.com/llvm/llvm-project/commit/906efeec0a471be522588bd7cbb7f61459b2b437.diff

LOG: [mlir] don't match the text produced only in debug mode in Python tests

Some Python bindings tests were using FileCheck to match parts of the
error description produced only in the debug compilation mode. Remove
these parts (but keep the main message) to ensure tests also pass when
running them in the release compilation mode.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94221

Added: 
    

Modified: 
    mlir/test/Bindings/Python/ir_attributes.py
    mlir/test/Bindings/Python/ir_operation.py

Removed: 
    


################################################################################
diff  --git a/mlir/test/Bindings/Python/ir_attributes.py b/mlir/test/Bindings/Python/ir_attributes.py
index ce85dc3cf87a..91b0a92e989f 100644
--- a/mlir/test/Bindings/Python/ir_attributes.py
+++ b/mlir/test/Bindings/Python/ir_attributes.py
@@ -371,7 +371,7 @@ def testArrayAttr():
     try:
       ArrayAttr.get([42])
     except RuntimeError as e:
-      # CHECK: Error: Invalid attribute when attempting to create an ArrayAttribute (Unable to cast Python instance of type <class 'int'> to C++ type 'mlir::python::PyAttribute')
+      # CHECK: Error: Invalid attribute when attempting to create an ArrayAttribute
       print("Error: ", e)
 run(testArrayAttr)
 

diff  --git a/mlir/test/Bindings/Python/ir_operation.py b/mlir/test/Bindings/Python/ir_operation.py
index ba54e83f65e8..034b28ec25bf 100644
--- a/mlir/test/Bindings/Python/ir_operation.py
+++ b/mlir/test/Bindings/Python/ir_operation.py
@@ -566,17 +566,17 @@ def testCreateWithInvalidAttributes():
     try:
       Operation.create("module", attributes={None:StringAttr.get("name")})
     except Exception as e:
-      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" (Unable to cast Python instance of type <class 'NoneType'> to C++ type
+      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={42:StringAttr.get("name")})
     except Exception as e:
-      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" (Unable to cast Python instance of type <class 'int'> to C++ type
+      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={"some_key":ctx})
     except Exception as e:
-      # CHECK: Invalid attribute value for the key "some_key" when attempting to create the operation "module" (Unable to cast Python instance of type <class '_mlir.ir.Context'> to C++ type 'mlir::python::PyAttribute')
+      # CHECK: Invalid attribute value for the key "some_key" when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={"some_key":None})


        


More information about the llvm-branch-commits mailing list