Author: labath Date: Fri Apr 5 00:56:26 2019 New Revision: 357747 URL: http://llvm.org/viewvc/llvm-project?rev=357747&view=rev Log: 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). Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py?rev=357747&r1=357746&r2=357747&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py Fri Apr 5 00:56:26 2019 @@ -32,7 +32,7 @@ class TestVSCode_step(lldbvscode_testcas 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_testcas 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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits