[Lldb-commits] [PATCH] D76080: Adjust error_msg handling for expect_expr in lldbtest.py
Shafik Yaghmour via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 12 10:51:20 PDT 2020
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():
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76080.249982.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200312/f09b77ad/attachment-0001.bin>
More information about the lldb-commits
mailing list