Files
TheRock/compiler/amd-llvm/lldb/test/API/python_api/sbprogress/TestSBProgress.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

69 lines
2.9 KiB
Python

"""Test the SBProgress API."""
import lldb
from lldbsuite.test.lldbtest import *
class SBProgressTestCase(TestBase):
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()
# Sample JSON we're expecting:
# { id = 2, title = "Test SBProgress", details = "Test progress", type = update, progress = 1 of 3}
# details remains the same as specified in the constructor of the progress
# until we update it in the increment function, so we check for the Null and empty string case
# that details hasn't changed, but progress x of 3 has.
progress.Increment(1, None)
self.assertTrue(listener.GetNextEvent(event))
stream = lldb.SBStream()
event.GetDescription(stream)
self.assertIn("Test progress", stream.GetData())
self.assertIn("1 of 3", stream.GetData())
progress.Increment(1, "")
self.assertTrue(listener.GetNextEvent(event))
event.GetDescription(stream)
self.assertIn("Test progress", stream.GetData())
self.assertIn("2 of 3", stream.GetData())
progress.Increment(1, "Step 3")
self.assertTrue(listener.GetNextEvent(event))
stream = lldb.SBStream()
event.GetDescription(stream)
self.assertIn("Step 3", stream.GetData())
def test_progress_finalize_non_deterministic_progress(self):
"""Test SBProgress finalize sends the progressEnd event"""
progress = lldb.SBProgress("Test SBProgress", "Test finalize", self.dbg)
listener = lldb.SBListener("Test listener")
broadcaster = self.dbg.GetBroadcaster()
broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress)
event = lldb.SBEvent()
progress.Finalize()
self.assertTrue(listener.WaitForEvent(5, event))
stream = lldb.SBStream()
event.GetDescription(stream)
self.assertIn("type = end", stream.GetData())
def test_progress_finalize_deterministic_progress(self):
"""Test SBProgress finalize sends the progressEnd event"""
progress = lldb.SBProgress("Test SBProgress", "Test finalize", 13, self.dbg)
listener = lldb.SBListener("Test listener")
broadcaster = self.dbg.GetBroadcaster()
broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress)
event = lldb.SBEvent()
progress.Finalize()
self.assertTrue(listener.WaitForEvent(5, event))
stream = lldb.SBStream()
event.GetDescription(stream)
# Note even for progresses with a total, the total isn't
# sent in the end message.
self.assertIn("type = end", stream.GetData())