diff options
| author | Michael Buch <michaelbuch12@gmail.com> | 2026-02-04 21:27:52 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-04 21:27:52 +0000 |
| commit | c51a758d7fe4d2168e62dfca5e1ef66a20d60d65 (patch) | |
| tree | ce50f0c5fc95cabaa5e1c99f0ff7ff335b6189cf /lldb/packages/Python/lldbsuite | |
| parent | 00e2649f030fe7841d97eca0c7166d7828664e68 (diff) | |
| download | llvm-c51a758d7fe4d2168e62dfca5e1ef66a20d60d65.tar.gz llvm-c51a758d7fe4d2168e62dfca5e1ef66a20d60d65.tar.bz2 llvm-c51a758d7fe4d2168e62dfca5e1ef66a20d60d65.zip | |
[lldb][test] Add SBExpressionOptions parameter to expect_expr (#177920)
Allows API tests to pass `SBExpressionOptions` when testing a successful
expression evaluation with `expect_expr`. Currently one would have to
use `SBFrame::EvaluateExpression` or pass the option as an argument to
the raw command (via `expect()` or `HandleCommand()`).
Chose not to do the `SetIgnoreBreakpoints`/`SetAutoApplyFixIts` with the
assumption that most expression evaluation tests don't actually need to
care about these. If the options are passed explicitly, lets use them
as-is. Otherwise default to the old options.
First usage of this new parameter would be in
https://github.com/llvm/llvm-project/pull/177926
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 6bb4516948da..6034eca3b93f 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -2575,6 +2575,7 @@ FileCheck output: result_value=None, result_type=None, result_children=None, + options=None, ): """ Evaluates the given expression and verifies the result. @@ -2584,6 +2585,7 @@ FileCheck output: :param result_type: The type that the expression result should have. None if the type should not be checked. :param result_children: The expected children of the expression result as a list of ValueChecks. None if the children shouldn't be checked. + :param options: Expression evaluation options. None if a default set of options should be used. """ self.assertTrue( expr.strip() == expr, @@ -2591,13 +2593,15 @@ FileCheck output: ) frame = self.frame() - options = lldb.SBExpressionOptions() - # Disable fix-its that tests don't pass by accident. - options.SetAutoApplyFixIts(False) + if not options: + options = lldb.SBExpressionOptions() - # Set the usual default options for normal expressions. - options.SetIgnoreBreakpoints(True) + # Disable fix-its that tests don't pass by accident. + options.SetAutoApplyFixIts(False) + + # Set the usual default options for normal expressions. + options.SetIgnoreBreakpoints(True) if self.frame().IsValid(): options.SetLanguage(frame.GuessLanguage()) |
