From b48515a44e2e92de4c026cca2881d420b29724ff Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 16 Oct 2018 03:31:33 +0000 Subject: [PATCH] Use assertEqual to improve test failure logging Some tests in test/functionalities/tail_call_frames are failing on non-Darwin platforms. Use assertEqual to improve logging on failure. llvm-svn: 344581 --- .../sbapi_support/TestTailCallFrameSBAPI.py | 10 +++++----- .../TestSteppingOutWithArtificialFrames.py | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py index 0e475a4..be3d972 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py @@ -43,11 +43,11 @@ class TestTailCallFrameSBAPI(TestBase): # Did we hit our breakpoint? threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) - self.assertTrue( - len(threads) == 1, + self.assertEqual( + len(threads), 1, "There should be a thread stopped at our breakpoint") - self.assertTrue(breakpoint.GetHitCount() == 1) + self.assertEqual(breakpoint.GetHitCount(), 1) thread = threads[0] @@ -61,5 +61,5 @@ class TestTailCallFrameSBAPI(TestBase): artificiality = [False, True, False, True, False] for idx, (name, is_artificial) in enumerate(zip(names, artificiality)): frame = thread.GetFrameAtIndex(idx) - self.assertTrue(frame.GetDisplayFunctionName() == name) - self.assertTrue(frame.IsArtificial() == is_artificial) + self.assertEqual(frame.GetDisplayFunctionName(), name) + self.assertEqual(frame.IsArtificial(), is_artificial) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py index c1806f6..1c9d6c7 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py @@ -35,11 +35,11 @@ class TestArtificialFrameThreadStepOut1(TestBase): # Did we hit our breakpoint? threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) - self.assertTrue( - len(threads) == 1, + self.assertEqual( + len(threads), 1, "There should be a thread stopped at our breakpoint") - self.assertTrue(breakpoint.GetHitCount() == 1) + self.assertEqual(breakpoint.GetHitCount(), 1) thread = threads[0] @@ -59,13 +59,13 @@ class TestArtificialFrameThreadStepOut1(TestBase): # frame #2, because we behave as-if artificial frames were not present. thread.StepOut() frame2 = thread.GetSelectedFrame() - self.assertTrue(frame2.GetDisplayFunctionName() == "func2()") + self.assertEqual(frame2.GetDisplayFunctionName(), "func2()") self.assertFalse(frame2.IsArtificial()) # Ditto: stepping out of frame #2 should move to frame #4. thread.StepOut() frame4 = thread.GetSelectedFrame() - self.assertTrue(frame4.GetDisplayFunctionName() == "main") + self.assertEqual(frame4.GetDisplayFunctionName(), "main") self.assertFalse(frame2.IsArtificial()) def test_return_past_artificial_frame(self): @@ -78,13 +78,13 @@ class TestArtificialFrameThreadStepOut1(TestBase): # to frame #2. thread.ReturnFromFrame(thread.GetSelectedFrame(), value) frame2 = thread.GetSelectedFrame() - self.assertTrue(frame2.GetDisplayFunctionName() == "func2()") + self.assertEqual(frame2.GetDisplayFunctionName(), "func2()") self.assertFalse(frame2.IsArtificial()) # Ditto: stepping out of frame #2 should move to frame #4. thread.ReturnFromFrame(thread.GetSelectedFrame(), value) frame4 = thread.GetSelectedFrame() - self.assertTrue(frame4.GetDisplayFunctionName() == "main") + self.assertEqual(frame4.GetDisplayFunctionName(), "main") self.assertFalse(frame2.IsArtificial()) def setUp(self): -- 2.7.4