Files
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

87 lines
3.0 KiB
Python

"""
Test whether a process started by lldb has no extra file descriptors open.
"""
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
class AvoidsFdLeakTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
# The check for descriptor leakage needs to be implemented differently
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
@skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_basic(self):
self.do_test([])
# The check for descriptor leakage needs to be implemented differently
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
@skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_log(self):
self.do_test(["log enable -f '{}' lldb commands".format(os.devnull)])
def do_test(self, commands):
self.build()
exe = self.getBuildArtifact("a.out")
for c in commands:
self.runCmd(c)
target = self.dbg.CreateTarget(exe)
process = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(
process.GetState(), lldb.eStateExited, "Process should have exited."
)
self.assertEqual(
process.GetExitStatus(),
0,
"Process returned non-zero status. Were incorrect file descriptors passed?",
)
# The check for descriptor leakage needs to be implemented differently
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
@skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_multitarget(self):
self.build()
exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
breakpoint = target.BreakpointCreateBySourceRegex(
"Set breakpoint here", lldb.SBFileSpec("main.c", False)
)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
process1 = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process1, PROCESS_IS_VALID)
self.assertEqual(
process1.GetState(), lldb.eStateStopped, "Process should have been stopped."
)
target2 = self.dbg.CreateTarget(exe)
process2 = target2.LaunchSimple(
None, None, self.get_process_working_directory()
)
self.assertTrue(process2, PROCESS_IS_VALID)
self.assertEqual(
process2.GetState(), lldb.eStateExited, "Process should have exited."
)
self.assertEqual(
process2.GetExitStatus(),
0,
"Process returned non-zero status. Were incorrect file descriptors passed?",
)