[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 17 01:35:18 PST 2025


================
@@ -0,0 +1,35 @@
+"""Test the SBProgress API."""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+
+
+class SBProgressTestCase(TestBase):
+    def test_with_external_bit_set(self):
+        """Test SBProgress events are listened to when the external bit is set."""
+
+        progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg)
+        listener = lldb.SBListener("Test listener")
+        broadcaster = self.dbg.GetBroadcaster()
+        broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress)
+        event = lldb.SBEvent()
+
+        expected_string = "Test progress first increment"
+        progress.Increment(1, expected_string)
+        self.assertTrue(listener.PeekAtNextEvent(event))
+        stream = lldb.SBStream()
+        event.GetDescription(stream)
+        self.assertTrue(expected_string in stream.GetData())
----------------
labath wrote:

```suggestion
        self.assertIn(expected_string, stream.GetData())
```

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


More information about the lldb-commits mailing list