Files
TheRock/compiler/amd-llvm/lldb/test/API/macosx/dsym_modules/TestdSYMModuleInit.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

66 lines
2.5 KiB
Python

"""
Test that we read in the Python module from a dSYM, and run the
init in debugger and the init in target routines.
"""
import os, shutil
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
@skipUnlessDarwin
class TestdSYMModuleInit(TestBase):
SHARED_BUILD_TESTCASE = False
@no_debug_info_test
def test_add_module(self):
"""This loads a file into a target and ensures that the python module was
correctly added and the two initialization functions are called."""
self.exe_name = "has_dsym"
self.py_name = self.exe_name + ".py"
# Now load the target the first time into the debugger:
self.runCmd("settings set target.load-script-from-symbol-file true")
self.interp = self.dbg.GetCommandInterpreter()
executable = self.build_dsym(self.exe_name + "_1")
target = self.createTestTarget(file_path=executable)
self.check_answers(executable, ["1", "1", "has_dsym_1"])
# Now make a second target and make sure both get called:
executable_2 = self.build_dsym(self.exe_name + "_2")
target_2 = self.createTestTarget(file_path=executable_2)
self.check_answers(executable_2, ["2", "2", "has_dsym_2"])
def check_answers(self, name, answers):
result = lldb.SBCommandReturnObject()
self.interp.HandleCommand("report_command", result)
self.assertTrue(
result.Succeeded(), f"report_command succeeded {result.GetError()}"
)
cmd_results = result.GetOutput().split()
self.assertEqual(answers[0], cmd_results[0], "Right number of module imports")
self.assertEqual(answers[1], cmd_results[1], "Right number of target notices")
self.assertIn(answers[2], name, "Right target name")
def build_dsym(self, name):
self.build(debug_info="dsym", dictionary={"EXE": name})
executable = self.getBuildArtifact(name)
dsym_path = self.getBuildArtifact(name + ".dSYM")
python_dir_path = dsym_path
python_dir_path = os.path.join(dsym_path, "Contents", "Resources", "Python")
if not os.path.exists(python_dir_path):
os.mkdir(python_dir_path)
python_file_name = name + ".py"
module_dest_path = os.path.join(python_dir_path, python_file_name)
module_origin_path = os.path.join(self.getSourceDir(), self.py_name)
shutil.copy(module_origin_path, module_dest_path)
return executable