[lldb] Improve test failure messages in vscode tests
authorPavel Labath <pavel@labath.sk>
Tue, 10 Mar 2020 13:31:03 +0000 (14:31 +0100)
committerPavel Labath <pavel@labath.sk>
Tue, 10 Mar 2020 13:32:45 +0000 (14:32 +0100)
A couple of tests sporadically fail on these assertions, but the error
messages do not give a clue as to what has actually happened.

Improve them so that we can better understand what is going wrong.

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py

index 1eb23ce..54f09e2 100644 (file)
@@ -230,11 +230,11 @@ class VSCodeTestCaseBase(TestBase):
     def continue_to_exit(self, exitCode=0):
         self.vscode.request_continue()
         stopped_events = self.vscode.wait_for_stopped()
-        self.assertTrue(len(stopped_events) == 1,
-                        "expecting single 'exited' event")
-        self.assertTrue(stopped_events[0]['event'] == 'exited',
+        self.assertEquals(len(stopped_events), 1,
+                        "stopped_events = {}".format(stopped_events))
+        self.assertEquals(stopped_events[0]['event'], 'exited',
                         'make sure program ran to completion')
-        self.assertTrue(stopped_events[0]['body']['exitCode'] == exitCode,
+        self.assertEquals(stopped_events[0]['body']['exitCode'], exitCode,
                         'exitCode == %i' % (exitCode))
 
     def attach(self, program=None, pid=None, waitFor=None, trace=None,