shafik created this revision.
shafik added reviewers: teemperor, labath, aprantl.
shafik added a comment.

I am open to suggestions on alternative approaches, for some context I ran into 
this trying to add a failing test to D75761 <https://reviews.llvm.org/D75761> 
as was suggested.


I was trying to use the `error_msg` argument for `expect_expr` (looks like I am 
the first one) and the assumption that `eval_result.IsValid()` is false does 
not look correct, so I removed it.

I also changed the way we check of the error messages matches from an exact 
match to just looking for the string withing the error message. Matching the 
whole error message does not feel necessary.


https://reviews.llvm.org/D76080

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2421,8 +2421,7 @@
         eval_result = frame.EvaluateExpression(expr, options)
 
         if error_msg:
-            self.assertFalse(eval_result.IsValid(), "Unexpected success with 
result: '" + str(eval_result) + "'")
-            self.assertEqual(error_msg, eval_result.GetError().GetCString())
+            
self.assertTrue(eval_result.GetError().GetCString().find(error_msg) != -1)
             return
 
         if not eval_result.GetError().Success():


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2421,8 +2421,7 @@
         eval_result = frame.EvaluateExpression(expr, options)
 
         if error_msg:
-            self.assertFalse(eval_result.IsValid(), "Unexpected success with result: '" + str(eval_result) + "'")
-            self.assertEqual(error_msg, eval_result.GetError().GetCString())
+            self.assertTrue(eval_result.GetError().GetCString().find(error_msg) != -1)
             return
 
         if not eval_result.GetError().Success():
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to