[Lldb-commits] [PATCH] D50492: Also display the output and error output of a failed command

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 8 23:22:49 PDT 2018


teemperor created this revision.

Instead of just printing the current "False is not True, ..." message when we
fail to run a certain command, this patch also adds the actual command output or
error output that we received to the assertion message.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D50492

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


Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -2074,8 +2074,13 @@
                     print("Command '" + cmd + "' failed!", file=sbuf)
 
         if check:
+            output = ""
+            if self.res.GetOutput():
+              output += "\nCommand output:\n" + self.res.GetOutput()
+            if self.res.GetError():
+              output += "\nError output:\n" + self.res.GetError()
             self.assertTrue(self.res.Succeeded(),
-                            msg if msg else CMD_MSG(cmd))
+                            msg if (msg + output) else CMD_MSG(cmd + output))
 
     def match(
             self,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50492.159858.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180809/c63318e1/attachment.bin>


More information about the lldb-commits mailing list