[Lldb-commits] [lldb] r339351 - Also display the output and error output of a failed command

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 9 08:29:32 PDT 2018


Author: teemperor
Date: Thu Aug  9 08:29:32 2018
New Revision: 339351

URL: http://llvm.org/viewvc/llvm-project?rev=339351&view=rev
Log:
Also display the output and error output of a failed command

Summary:
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.

Reviewers: davide

Reviewed By: davide

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D50492

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=339351&r1=339350&r2=339351&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Thu Aug  9 08:29:32 2018
@@ -2074,8 +2074,13 @@ class TestBase(Base):
                     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,




More information about the lldb-commits mailing list