[Lldb-commits] [PATCH] D70314: [lldb] Add better test commands for expression evaluation
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 15 07:33:46 PST 2019
teemperor created this revision.
teemperor added reviewers: JDevlieghere, shafik, labath.
Herald added subscribers: lldb-commits, abidh, christof.
Herald added a project: LLDB.
This patch adds two new commands to lldbtest: `expect_expr` and `expect_simple_expr`. These commands
are supposed to replace the current approach of calling `expect`/`runCmd` with `frame var`, `expr`, `p`
(and `SBFrame.EvaluateExpression` in the future).
`expect_expr` allows evaluating expressions and matching their result/type/error message. It allows checking
the type/error message/result of both `frame var` and `expr` without having to parse the output of these
commands each time (or using hacks like `substrs=[" = 1\n"]` to match the value). It no longer allows unintended weak
type/value checks like we currently have with calling `self.expect` (e.g. this can semi-randomly pass when
the result variable was assigned `$1`: `self.expect("expr 3+4", substrs=["1"])`).
`expect_simple_expr` allows evaluating simple expressions like printing variables but is testing them more thoroughly
than we currently do (by for example running the expression multiple times and with both `frame var` and `expr`).
If we used this method we would have caught major regressions like the one fixed in D67803 <https://reviews.llvm.org/D67803>.
Currently I just added the method to a few tests to demonstrate them. I'll migrate the rest of the test
suit over the next weeks because it's quite time intensive to rewrite all of this (and also because I already had some
tests that discovered bugs after I migrated them to `expect_simple_expr`).
Repository:
rLLDB LLDB
https://reviews.llvm.org/D70314
Files:
lldb/packages/Python/lldbsuite/test/commands/expression/call-function/TestCallBuiltinFunction.py
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70314.229540.patch
Type: text/x-patch
Size: 10941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191115/77d2ce2c/attachment-0001.bin>
More information about the lldb-commits
mailing list