[Lldb-commits] [lldb] [lldb] Fix minor runCmd error message formatting (PR #110150)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 26 10:57:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Dave Lee (kastiglione)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/110150.diff
1 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/lldbtest.py (+5-7)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index c6b7ce84109c09..8884ef5933ada8 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -172,9 +172,9 @@
WATCHPOINT_CREATED = "Watchpoint created successfully"
-def CMD_MSG(str):
+def CMD_MSG(command):
"""A generic "Command '%s' did not return successfully" message generator."""
- return "Command '%s' did not return successfully" % str
+ return f"Command '{command}' did not return successfully"
def COMPLETION_MSG(str_before, str_after, completions):
@@ -990,16 +990,14 @@ def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False):
print("Command '" + cmd + "' failed!", file=sbuf)
if check:
+ if not msg:
+ msg = CMD_MSG(cmd)
output = ""
if self.res.GetOutput():
output += "\nCommand output:\n" + self.res.GetOutput()
if self.res.GetError():
output += "\nError output:\n" + self.res.GetError()
- if msg:
- msg += output
- if cmd:
- cmd += output
- self.assertTrue(self.res.Succeeded(), msg if (msg) else CMD_MSG(cmd))
+ self.assertTrue(self.res.Succeeded(), msg + output)
def HideStdout(self):
"""Hide output to stdout from the user.
``````````
</details>
https://github.com/llvm/llvm-project/pull/110150
More information about the lldb-commits
mailing list