[Lldb-commits] [lldb] [LLDB][SBProgress] Fix bad optional in sbprogress (PR #128971)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 26 16:28:20 PST 2025


================
@@ -33,3 +33,22 @@ def test_without_external_bit_set(self):
         expected_string = "Test progress first increment"
         progress.Increment(1, expected_string)
         self.assertFalse(listener.PeekAtNextEvent(event))
+
+    def test_with_external_bit_set(self):
+        """Test SBProgress can handle null events."""
+
+        progress = lldb.SBProgress("Test SBProgress", "Test progress", 3, self.dbg)
+        listener = lldb.SBListener("Test listener")
+        broadcaster = self.dbg.GetBroadcaster()
+        broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress)
+        event = lldb.SBEvent()
+
+        progress.Increment(1, None)
+        self.assertTrue(listener.GetNextEvent(event))
+        progress.Increment(1, "")
+        self.assertTrue(listener.GetNextEvent(event))
+        progress.Increment(1, "Step 3")
+        self.assertTrue(listener.GetNextEvent(event))
+        stream = lldb.SBStream()
+        event.GetDescription(stream)
+        self.assertIn("Step 3", stream.GetData())
----------------
clayborg wrote:

can we test that we receive these events with the correct data here? (get the start event, the 3 increment events with no detail for the first two and then "Step 3" for the 3rd increment, though right now that might come through as an end event?

https://github.com/llvm/llvm-project/pull/128971


More information about the lldb-commits mailing list