From 8f4710db7e930547858512f78f3d4055e3a9c78e Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Wed, 10 Sep 2025 17:18:43 +0100 Subject: [PATCH] [lldb][test] StepUntil disable test for unsupported linkers. (#157474) `INSERT BEFORE` keyword is not supported in current versions gold and mold linkers. Since we cannot confirm accurately what linker and version is available on the system and when it will be supported. We test it with a sample program using the script keywords. (cherry picked from commit a65aca6201e2455f7627732f5b378028fe651dec) --- .../thread/step_until/TestStepUntil.py | 10 ++-- .../thread/step_until/TestStepUntilAPI.py | 50 ++++++++++++------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py index 965da02ed0f98..afdc92dd40001 100644 --- a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py +++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py @@ -1,10 +1,9 @@ """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - -import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil +from lldbsuite.test_event.build_exception import BuildError class StepUntilTestCase(TestBase): @@ -112,10 +111,15 @@ def test_bad_line(self): @no_debug_info_test @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"]) @skipIf(archs=no_match(["x86_64", "aarch64"])) + @skipIf(compiler=no_match(["clang"])) def test_bad_line_discontinuous(self): """Test that we get an error if attempting to step outside the current function -- and the function is discontinuous""" - self.build(dictionary=self._build_dict_for_discontinuity()) + try: + self.build(dictionary=self._build_dict_for_discontinuity()) + except BuildError as ex: + self.skipTest(f"failed to build with linker script.") + _, _, thread, _ = lldbutil.run_to_source_breakpoint( self, "At the start", lldb.SBFileSpec(self.main_source) ) diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py index 59e028acf014c..08d78fb996c75 100644 --- a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py +++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py @@ -1,7 +1,7 @@ -import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil +from lldbsuite.test_event.build_exception import BuildError class TestStepUntilAPI(TestBase): @@ -74,15 +74,20 @@ def test_hitting(self): @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"]) @skipIf(archs=no_match(["x86_64", "aarch64"])) + @skipIf(compiler=no_match(["clang"])) def test_hitting_discontinuous(self): """Test SBThread.StepOverUntil - targeting a line and hitting it -- with discontinuous functions""" - self._do_until( - self._build_dict_for_discontinuity(), - None, - self.less_than_two, - self.less_than_two, - ) + try: + self._do_until( + self._build_dict_for_discontinuity(), + None, + self.less_than_two, + self.less_than_two, + ) + except BuildError as ex: + self.skipTest(f"failed to build with linker script.") + self._assertDiscontinuity() def test_missing(self): @@ -93,15 +98,20 @@ def test_missing(self): @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"]) @skipIf(archs=no_match(["x86_64", "aarch64"])) + @skipIf(compiler=no_match(["clang"])) def test_missing_discontinuous(self): """Test SBThread.StepOverUntil - targeting a line and missing it by stepping out to call site -- with discontinuous functions""" - self._do_until( - self._build_dict_for_discontinuity(), - ["foo", "bar", "baz"], - self.less_than_two, - self.back_out_in_main, - ) + try: + self._do_until( + self._build_dict_for_discontinuity(), + ["foo", "bar", "baz"], + self.less_than_two, + self.back_out_in_main, + ) + except BuildError as ex: + self.skipTest(f"failed to build with linker script.") + self._assertDiscontinuity() def test_bad_line(self): @@ -120,13 +130,19 @@ def test_bad_line(self): @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"]) @skipIf(archs=no_match(["x86_64", "aarch64"])) + @skipIf(compiler=no_match(["clang"])) def test_bad_line_discontinuous(self): """Test that we get an error if attempting to step outside the current function -- and the function is discontinuous""" - self.build(dictionary=self._build_dict_for_discontinuity()) - _, _, thread, _ = lldbutil.run_to_source_breakpoint( - self, "At the start", self.main_spec - ) + + try: + self.build(dictionary=self._build_dict_for_discontinuity()) + _, _, thread, _ = lldbutil.run_to_source_breakpoint( + self, "At the start", self.main_spec + ) + except BuildError as ex: + self.skipTest(f"failed to build with linker script.") + self.assertIn( "step until target not in current function", thread.StepOverUntil(