[Lldb-commits] [lldb] r372196 - Clean up this test.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 17 18:53:52 PDT 2019


Author: jingham
Date: Tue Sep 17 18:53:52 2019
New Revision: 372196

URL: http://llvm.org/viewvc/llvm-project?rev=372196&view=rev
Log:
Clean up this test.

I don't know what the intent of parts of this test were.  We set a
bunch of breakpoints and ran from one to the other, doing "self.runCmd("thread backtrace")"
then continuing to the next one.  We didn't actually verify the contents of the backtrace,
nor that we hit the breakpoints we set in any particular order.  The only actual test was
to run sel_getName at two of these stops.

So I reduced the test to just stopping at the places where we were actually going to run
an expression, and tested the expression.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py?rev=372196&r1=372195&r2=372196&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py Tue Sep 17 18:53:52 2019
@@ -16,61 +16,26 @@ class FoundationTestCase2(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
+    NO_DEBUG_INFO_TESTCASE = True
+
     def test_expr_commands(self):
         """More expression commands for objective-c."""
         self.build()
-        exe = self.getBuildArtifact("a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-        lines = []
-        lines.append(
-            line_number(
-                'main.m',
-                '// Break here for selector: tests'))
-        lines.append(
-            line_number(
-                'main.m',
-                '// Break here for NSArray tests'))
-        lines.append(
-            line_number(
-                'main.m',
-                '// Break here for NSString tests'))
-        lines.append(
-            line_number(
-                'main.m',
-                '// Break here for description test'))
-        lines.append(
-            line_number(
-                'main.m',
-                '// Set break point at this line'))
-
-        # Create a bunch of breakpoints.
-        for line in lines:
-            lldbutil.run_break_set_by_file_and_line(
-                self, "main.m", line, num_expected_locations=1, loc_exact=True)
-
-        self.runCmd("run", RUN_SUCCEEDED)
+        main_spec = lldb.SBFileSpec("main.m")
 
+        (target, process, thread, bp) = lldbutil.run_to_source_breakpoint(
+            self, "Break here for selector: tests", main_spec)
+        
         # Test_Selector:
-        self.runCmd("thread backtrace")
         self.expect("expression (char *)sel_getName(sel)",
                     substrs=["(char *)",
                              "length"])
 
-        self.runCmd("process continue")
-
-        # Test_NSArray:
-        self.runCmd("thread backtrace")
-        self.runCmd("process continue")
-
-        # Test_NSString:
-        self.runCmd("thread backtrace")
-        self.runCmd("process continue")
-
-        # Test_MyString:
-        self.runCmd("thread backtrace")
+        desc_bkpt = target.BreakpointCreateBySourceRegex("Break here for description test",
+                                                          main_spec)
+        self.assertEqual(desc_bkpt.GetNumLocations(), 1, "description breakpoint has a location")
+        lldbutil.continue_to_breakpoint(process, desc_bkpt)
+        
         self.expect("expression (char *)sel_getName(_cmd)",
                     substrs=["(char *)",
                              "description"])
-
-        self.runCmd("process continue")




More information about the lldb-commits mailing list