From 546bccf61c620893c0f94c84adf542b0bbad24bb Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 5 Apr 2019 07:56:26 +0000 Subject: TestVCCode_step: replace assertTrue with more specific assertions When this test fails (flakes) all we get is an error message like "False is not True". This replaces patterns like assertTrue(a == b) with assertEqual(a, b), so we get a better error message (and hopefully a hint as to why the test is flaky). llvm-svn: 357747 --- .../test/tools/lldb-vscode/step/TestVSCode_step.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/tools/lldb-vscode') diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py index 87ec71a513f..b671d956acf 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py @@ -32,7 +32,7 @@ class TestVSCode_step(lldbvscode_testcase.VSCodeTestCaseBase): lines = [breakpoint1_line] # Set breakoint in the thread function so we can step the threads breakpoint_ids = self.set_source_breakpoints(source, lines) - self.assertTrue(len(breakpoint_ids) == len(lines), + self.assertEqual(len(breakpoint_ids), len(lines), "expect correct number of breakpoints") self.continue_to_breakpoints(breakpoint_ids) threads = self.vscode.get_threads() @@ -56,24 +56,24 @@ class TestVSCode_step(lldbvscode_testcase.VSCodeTestCaseBase): self.stepIn(threadId=tid, waitForStop=True) x2 = self.get_local_as_int('x', threadId=tid) (src2, line2) = self.get_source_and_line(threadId=tid) - self.assertTrue(x1 == x2 + 1, 'verify step in variable') - self.assertTrue(line2 < line1, 'verify step in line') - self.assertTrue(src1 == src2, 'verify step in source') + self.assertEqual(x1, x2 + 1, 'verify step in variable') + self.assertLess(line2, line1, 'verify step in line') + self.assertEqual(src1, src2, 'verify step in source') # Now step out and verify self.stepOut(threadId=tid, waitForStop=True) x3 = self.get_local_as_int('x', threadId=tid) (src3, line3) = self.get_source_and_line(threadId=tid) - self.assertTrue(x1 == x3, 'verify step out variable') - self.assertTrue(line3 >= line1, 'verify step out line') - self.assertTrue(src1 == src3, 'verify step in source') + self.assertEqual(x1, x3, 'verify step out variable') + self.assertGreaterEqual(line3, line1, 'verify step out line') + self.assertEqual(src1, src3, 'verify step in source') # Step over and verify self.stepOver(threadId=tid, waitForStop=True) x4 = self.get_local_as_int('x', threadId=tid) (src4, line4) = self.get_source_and_line(threadId=tid) - self.assertTrue(x4 == x3, 'verify step over variable') - self.assertTrue(line4 > line3, 'verify step over line') - self.assertTrue(src1 == src4, 'verify step over source') + self.assertEqual(x4, x3, 'verify step over variable') + self.assertGreater(line4, line3, 'verify step over line') + self.assertEqual(src1, src4, 'verify step over source') # only step one thread that is at the breakpoint and stop break -- cgit v1.2.3