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
133 lines
4.5 KiB
Python
133 lines
4.5 KiB
Python
"""Test that the 'add-dsym', aka 'target symbols add', command informs the user about success or failure."""
|
|
|
|
|
|
import os
|
|
import time
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
@skipUnlessDarwin
|
|
class AddDsymCommandCase(TestBase):
|
|
SHARED_BUILD_TESTCASE = False
|
|
|
|
def setUp(self):
|
|
TestBase.setUp(self)
|
|
self.template = "main.cpp.template"
|
|
self.source = "main.cpp"
|
|
self.teardown_hook_added = False
|
|
|
|
@no_debug_info_test
|
|
def test_add_dsym_command_with_error(self):
|
|
"""Test that the 'add-dsym' command informs the user about failures."""
|
|
|
|
# Call the program generator to produce main.cpp, version 1.
|
|
self.generate_main_cpp(version=1)
|
|
self.build(debug_info="dsym")
|
|
|
|
# Insert some delay and then call the program generator to produce
|
|
# main.cpp, version 2.
|
|
time.sleep(5)
|
|
self.generate_main_cpp(version=101)
|
|
# Now call make again, but this time don't generate the dSYM.
|
|
self.build(debug_info="dwarf")
|
|
|
|
self.exe_name = "a.out"
|
|
self.do_add_dsym_with_error(self.exe_name)
|
|
|
|
@no_debug_info_test
|
|
def test_add_dsym_command_with_success(self):
|
|
"""Test that the 'add-dsym' command informs the user about success."""
|
|
|
|
# Call the program generator to produce main.cpp, version 1.
|
|
self.generate_main_cpp(version=1)
|
|
self.build(debug_info="dsym")
|
|
|
|
self.exe_name = "a.out"
|
|
self.do_add_dsym_with_success(self.exe_name)
|
|
|
|
@no_debug_info_test
|
|
def test_add_dsym_with_dSYM_bundle(self):
|
|
"""Test that the 'add-dsym' command informs the user about success."""
|
|
|
|
# Call the program generator to produce main.cpp, version 1.
|
|
self.generate_main_cpp(version=1)
|
|
self.build(debug_info="dsym")
|
|
|
|
self.exe_name = "a.out"
|
|
self.do_add_dsym_with_dSYM_bundle(self.exe_name)
|
|
|
|
def generate_main_cpp(self, version=0):
|
|
"""Generate main.cpp from main.cpp.template."""
|
|
temp = os.path.join(self.getSourceDir(), self.template)
|
|
with open(temp, "r") as f:
|
|
content = f.read()
|
|
|
|
new_content = content.replace(
|
|
"%ADD_EXTRA_CODE%", 'printf("This is version %d\\n");' % version
|
|
)
|
|
src = os.path.join(self.getBuildDir(), self.source)
|
|
with open(src, "w") as f:
|
|
f.write(new_content)
|
|
|
|
# The main.cpp has been generated, add a teardown hook to remove it.
|
|
if not self.teardown_hook_added:
|
|
self.addTearDownHook(lambda: os.remove(src))
|
|
self.teardown_hook_added = True
|
|
|
|
def do_add_dsym_with_error(self, exe_name):
|
|
"""Test that the 'add-dsym' command informs the user about failures."""
|
|
exe_path = self.getBuildArtifact(exe_name)
|
|
self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET)
|
|
|
|
wrong_path = os.path.join(self.getBuildDir(), "%s.dSYM" % exe_name, "Contents")
|
|
self.expect(
|
|
"add-dsym " + wrong_path, error=True, substrs=["invalid module path"]
|
|
)
|
|
|
|
right_path = os.path.join(
|
|
self.getBuildDir(),
|
|
"%s.dSYM" % exe_path,
|
|
"Contents",
|
|
"Resources",
|
|
"DWARF",
|
|
exe_name,
|
|
)
|
|
self.expect(
|
|
"add-dsym " + right_path,
|
|
error=True,
|
|
substrs=["symbol file", "does not match"],
|
|
)
|
|
|
|
def do_add_dsym_with_success(self, exe_name):
|
|
"""Test that the 'add-dsym' command informs the user about success."""
|
|
exe_path = self.getBuildArtifact(exe_name)
|
|
self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET)
|
|
|
|
# This time, the UUID should match and we expect some feedback from
|
|
# lldb.
|
|
right_path = os.path.join(
|
|
self.getBuildDir(),
|
|
"%s.dSYM" % exe_path,
|
|
"Contents",
|
|
"Resources",
|
|
"DWARF",
|
|
exe_name,
|
|
)
|
|
self.expect(
|
|
"add-dsym " + right_path, substrs=["symbol file", "has been added to"]
|
|
)
|
|
|
|
def do_add_dsym_with_dSYM_bundle(self, exe_name):
|
|
"""Test that the 'add-dsym' command informs the user about success when loading files in bundles."""
|
|
exe_path = self.getBuildArtifact(exe_name)
|
|
self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET)
|
|
|
|
# This time, the UUID should be found inside the bundle
|
|
right_path = "%s.dSYM" % exe_path
|
|
self.expect(
|
|
"add-dsym " + right_path, substrs=["symbol file", "has been added to"]
|
|
)
|