[Lldb-commits] [lldb] 869d05f - [lldb-vscode] Fix TestVSCode_module

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 13 18:02:45 PDT 2020


Author: Walter Erquinigo
Date: 2020-07-13T18:02:37-07:00
New Revision: 869d05fb3e449ec7ec835b8a61687f8df41b8651

URL: https://github.com/llvm/llvm-project/commit/869d05fb3e449ec7ec835b8a61687f8df41b8651
DIFF: https://github.com/llvm/llvm-project/commit/869d05fb3e449ec7ec835b8a61687f8df41b8651.diff

LOG: [lldb-vscode] Fix TestVSCode_module
This test was added in https://reviews.llvm.org/D82477 and needs to wait a little bit before fetching some information.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
    lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index 676e08d5a38c..c1b33c220b4b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -2,6 +2,7 @@
 from lldbsuite.test.lldbtest import *
 import os
 import vscode
+import time
 
 
 class VSCodeTestCaseBase(TestBase):
@@ -52,6 +53,12 @@ def set_function_breakpoints(self, functions, condition=None,
             breakpoint_ids.append('%i' % (breakpoint['id']))
         return breakpoint_ids
 
+    def waitUntil(self, condition):
+        while True:
+            if condition():
+                break
+            time.sleep(0.5)
+
     def verify_breakpoint_hit(self, breakpoint_ids):
         '''Wait for the process we are debugging to stop, and verify we hit
            any breakpoint location in the "breakpoint_ids" array.

diff  --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
index 461ac201a73f..40c4145b38e3 100644
--- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -11,7 +11,6 @@
 from lldbsuite.test import lldbutil
 import lldbvscode_testcase
 
-
 class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -40,6 +39,13 @@ def test_modules_event(self):
         self.assertEqual('Symbols not found.', program_module['symbolStatus'])
         symbol_path = self.getBuildArtifact("a.out")
         self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" "%s"' % (program, symbol_path)))
+
+        def checkSymbolsLoaded():
+            active_modules = self.vscode.get_active_modules()
+            program_module = active_modules[program_basename]
+            return 'Symbols loaded.' == program_module['symbolStatus']
+        self.waitUntil(checkSymbolsLoaded)
+
         active_modules = self.vscode.get_active_modules()
         program_module = active_modules[program_basename]
         self.assertEqual(program_basename, program_module['name'])
@@ -63,7 +69,6 @@ def test_compile_units(self):
         self.continue_to_breakpoints(breakpoint_ids)
         moduleId = self.vscode.get_active_modules()['a.out']['id']
         response = self.vscode.request_getCompileUnits(moduleId)
-        print(response['body'])
         self.assertTrue(response['body'])
         self.assertTrue(len(response['body']['compileUnits']) == 1,
                         'Only one source file should exist')


        


More information about the lldb-commits mailing list