Change the attach test case to use self.assertEqual so we can get more info on what...
authorGreg Clayton <gclayton@apple.com>
Fri, 17 Aug 2018 17:27:53 +0000 (17:27 +0000)
committerGreg Clayton <gclayton@apple.com>
Fri, 17 Aug 2018 17:27:53 +0000 (17:27 +0000)
Also add a cleanup function to remove the copied binary.

llvm-svn: 340050

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

index 939025d..6e03886 100644 (file)
@@ -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_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),
-                        "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_testcase.VSCodeTestCaseBase):
         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,