[Lldb-commits] [lldb] r340050 - Change the attach test case to use self.assertEqual so we can get more info on what is going wrong on test bots.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 17 10:27:53 PDT 2018


Author: gclayton
Date: Fri Aug 17 10:27:53 2018
New Revision: 340050

URL: http://llvm.org/viewvc/llvm-project?rev=340050&view=rev
Log:
Change the attach test case to use self.assertEqual so we can get more info on what is going wrong on test bots.

Also add a cleanup function to remove the copied binary.


Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py?rev=340050&r1=340049&r2=340050&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py Fri Aug 17 10:27:53 2018
@@ -10,6 +10,7 @@ from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 import lldbvscode_testcase
+import os
 import shutil
 import subprocess
 import tempfile
@@ -37,8 +38,8 @@ class TestVSCode_attach(lldbvscode_testc
         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),
-                        "expect correct number of breakpoints")
+        self.assertEqual(len(breakpoint_ids), len(lines),
+                         "expect correct number of breakpoints")
         self.continue_to_breakpoints(breakpoint_ids)
         if continueToExit:
             self.continue_to_exit()
@@ -76,6 +77,13 @@ class TestVSCode_attach(lldbvscode_testc
         program = tempfile.mktemp()
         shutil.copyfile(orig_program, program)
         shutil.copymode(orig_program, program)
+
+        def cleanup():
+            if os.path.exists(program):
+                os.unlink(program)
+        # Execute the cleanup function during test case tear down.
+        self.addTearDownHook(cleanup)
+
         self.process = subprocess.Popen([program],
                                         stdin=subprocess.PIPE,
                                         stdout=subprocess.PIPE,




More information about the lldb-commits mailing list