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
74 lines
3.0 KiB
Python
74 lines
3.0 KiB
Python
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
class AlwaysRunThreadNamesTestCase(TestBase):
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
@skipIfWindows
|
|
def test_always_run_thread_resumes_during_step(self):
|
|
"""Test that a thread named in always-run-thread-names continues
|
|
running when another thread single-steps."""
|
|
self.build()
|
|
(target, _, thread, _) = lldbutil.run_to_source_breakpoint(
|
|
self, "// break here", lldb.SBFileSpec("main.cpp")
|
|
)
|
|
|
|
# Configure the setting to keep our helper thread running.
|
|
self.runCmd("settings set target.process.always-run-thread-names always-run")
|
|
|
|
# Tell step_over_me() to block until the helper thread advances.
|
|
self.runCmd("expression g_sync_with_helper = true")
|
|
|
|
# Record the helper thread's counter before stepping.
|
|
counter_before = target.FindFirstGlobalVariable("g_helper_count")
|
|
self.assertTrue(counter_before.IsValid())
|
|
val_before = counter_before.GetValueAsUnsigned()
|
|
|
|
# The step over normally suspends all other threads, but the
|
|
# always-run-thread-names setting keeps the helper thread running.
|
|
# Because g_sync_with_helper is true, step_over_me() will spin until
|
|
# the helper thread increments the counter.
|
|
thread.StepOver(lldb.eOnlyThisThread)
|
|
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
|
|
|
|
counter_after = target.FindFirstGlobalVariable("g_helper_count")
|
|
val_after = counter_after.GetValueAsUnsigned()
|
|
self.assertGreater(
|
|
val_after,
|
|
val_before,
|
|
"Helper thread counter did not advance during step-over "
|
|
"(expected it to run because of always-run-thread-names).",
|
|
)
|
|
|
|
@skipIfWindows
|
|
def test_without_setting_thread_is_suspended(self):
|
|
"""Test that without the setting, the helper thread is suspended
|
|
during single-stepping (baseline)."""
|
|
self.build()
|
|
(target, _, thread, _) = lldbutil.run_to_source_breakpoint(
|
|
self, "// break here", lldb.SBFileSpec("main.cpp")
|
|
)
|
|
|
|
# Do NOT set always-run-thread-names.
|
|
counter_before = target.FindFirstGlobalVariable("g_helper_count")
|
|
self.assertTrue(counter_before.IsValid())
|
|
val_before = counter_before.GetValueAsUnsigned()
|
|
|
|
# Step over with only-this-thread mode.
|
|
thread.StepOver(lldb.eOnlyThisThread)
|
|
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
|
|
|
|
# The helper thread should have been suspended, so its counter should
|
|
# not have changed.
|
|
counter_after = target.FindFirstGlobalVariable("g_helper_count")
|
|
val_after = counter_after.GetValueAsUnsigned()
|
|
self.assertEqual(
|
|
val_after,
|
|
val_before,
|
|
"Helper thread counter advanced during step-over "
|
|
"(expected it to be suspended without always-run-thread-names).",
|
|
)
|