[Lldb-commits] [lldb] 9e391d4 - [lldb/Test] Cleanup TestSymbolContext.py

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu May 21 17:32:14 PDT 2020


Author: Jonas Devlieghere
Date: 2020-05-21T17:32:05-07:00
New Revision: 9e391d4faa839c6aedf8729bb027adf5e2cd7735

URL: https://github.com/llvm/llvm-project/commit/9e391d4faa839c6aedf8729bb027adf5e2cd7735
DIFF: https://github.com/llvm/llvm-project/commit/9e391d4faa839c6aedf8729bb027adf5e2cd7735.diff

LOG: [lldb/Test] Cleanup TestSymbolContext.py

Remove commented out code, fix the indentation and always use the full
path to the executable. The latter is necessary for the test to pass
from reproducer replay.

Added: 
    

Modified: 
    lldb/test/API/python_api/symbol-context/TestSymbolContext.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/symbol-context/TestSymbolContext.py b/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
index 0c1ad83c84d6..0baf91e4a351 100644
--- a/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
+++ b/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
@@ -4,8 +4,6 @@
 
 from __future__ import print_function
 
-
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -35,23 +33,20 @@ def test(self):
         self.assertTrue(target, VALID_TARGET)
 
         # Now create a breakpoint on main.c by name 'c'.
-        breakpoint = target.BreakpointCreateByName('c', 'a.out')
-        #print("breakpoint:", breakpoint)
-        self.assertTrue(breakpoint and
-                        breakpoint.GetNumLocations() == 1,
+        breakpoint = target.BreakpointCreateByName('c', exe)
+        self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1,
                         VALID_BREAKPOINT)
 
         # Now launch the process, and do not stop at entry point.
-        process = target.LaunchSimple(
-            None, None, self.get_process_working_directory())
+        process = target.LaunchSimple(None, None,
+                                      self.get_process_working_directory())
         self.assertTrue(process, PROCESS_IS_VALID)
 
         # Frame #0 should be on self.line.
-        from lldbsuite.test.lldbutil import get_stopped_thread
-        thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(
-            thread.IsValid(),
-            "There should be a thread stopped due to breakpoint")
+        thread = lldbutil.get_stopped_thread(process,
+                                             lldb.eStopReasonBreakpoint)
+        self.assertTrue(thread.IsValid(),
+                        "There should be a thread stopped due to breakpoint")
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
 
@@ -62,36 +57,29 @@ def test(self):
         # Get the description of this module.
         module = context.GetModule()
         desc = lldbutil.get_description(module)
-        self.expect(desc, "The module should match", exe=False,
-                    substrs=[self.getBuildArtifact("a.out")])
+        self.expect(desc, "The module should match", exe=False, substrs=[exe])
 
         compileUnit = context.GetCompileUnit()
-        self.expect(
-            str(compileUnit),
-            "The compile unit should match",
-            exe=False,
-            substrs=[self.getSourcePath('main.c')])
+        self.expect(str(compileUnit),
+                    "The compile unit should match",
+                    exe=False,
+                    substrs=[self.getSourcePath('main.c')])
 
         function = context.GetFunction()
         self.assertTrue(function)
-        #print("function:", function)
 
         block = context.GetBlock()
         self.assertTrue(block)
-        #print("block:", block)
 
         lineEntry = context.GetLineEntry()
-        #print("line entry:", lineEntry)
-        self.expect(
-            lineEntry.GetFileSpec().GetDirectory(),
-            "The line entry should have the correct directory",
-            exe=False,
-            substrs=[self.mydir])
-        self.expect(
-            lineEntry.GetFileSpec().GetFilename(),
-            "The line entry should have the correct filename",
-            exe=False,
-            substrs=['main.c'])
+        self.expect(lineEntry.GetFileSpec().GetDirectory(),
+                    "The line entry should have the correct directory",
+                    exe=False,
+                    substrs=[self.mydir])
+        self.expect(lineEntry.GetFileSpec().GetFilename(),
+                    "The line entry should have the correct filename",
+                    exe=False,
+                    substrs=['main.c'])
         self.assertTrue(lineEntry.GetLine() == self.line,
                         "The line entry's line number should match ")
 


        


More information about the lldb-commits mailing list