-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb][test] StepUntil disable test for unsupported linkers. #157474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changes
Full diff: https://github.com/llvm/llvm-project/pull/157474.diff 2 Files Affected:
diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
index 965da02ed0f98..90f207b5d4660 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
@@ -1,11 +1,50 @@
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
+from typing import Optional
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+import tempfile
+
+
+def linker_script_syntax_unsupported() -> Optional[str]:
+ """Current versions of mold and gold linker does not support some syntax of
+ linker scripts, this maybe supported in future versions. check if it compiles,
+ if not it is not supported.
+ """
+ with tempfile.TemporaryDirectory() as tmpdir:
+ output_path = os.path.join(tmpdir, "linker_support.out")
+ linker_script_path = os.path.join(tmpdir, "test.ld")
+
+ with open(linker_script_path, "w") as linker_script:
+ linker_script.write(
+ "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } INSERT BEFORE .text;"
+ )
+
+ compiler_cmd = subprocess.Popen(
+ [
+ lldbplatformutil.getCompiler(),
+ f"-o {output_path}",
+ "-ffunction-sections",
+ f"-Wl,--script={linker_script_path}",
+ "-xc",
+ "-",
+ ],
+ shell=True,
+ universal_newlines=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ )
+ _, comp_err = compiler_cmd.communicate(
+ "int foo() { return 1; } int main() { return 0; }"
+ )
+ if len(comp_err) != 0:
+ return str(tmpdir) + " " + comp_err
+ return None
class StepUntilTestCase(TestBase):
def setUp(self):
@@ -112,6 +151,7 @@ def test_bad_line(self):
@no_debug_info_test
@skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
@skipIf(archs=no_match(["x86_64", "aarch64"]))
+ @skipTestIfFn(linker_script_syntax_unsupported)
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"""
diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
index 59e028acf014c..44e764c43cd20 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
@@ -1,8 +1,48 @@
+from typing import Optional
+
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+import tempfile
+
+
+def linker_script_syntax_unsupported() -> Optional[str]:
+ """Current versions of mold and gold linker does not support some syntax of
+ linker scripts, this maybe supported in future versions. check if it compiles,
+ if not it is not supported.
+ """
+ with tempfile.TemporaryDirectory() as tmpdir:
+ output_path = os.path.join(tmpdir, "linker_support.out")
+ linker_script_path = os.path.join(tmpdir, "test.ld")
+
+ with open(linker_script_path, "w") as linker_script:
+ linker_script.write(
+ "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } INSERT BEFORE .text;"
+ )
+
+ compiler_cmd = subprocess.Popen(
+ [
+ lldbplatformutil.getCompiler(),
+ f"-o {output_path}",
+ "-ffunction-sections",
+ f"-Wl,--script={linker_script_path}",
+ "-xc",
+ "-",
+ ],
+ shell=True,
+ universal_newlines=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ )
+ _, comp_err = compiler_cmd.communicate(
+ "int foo() { return 1; } int main() { return 0; }"
+ )
+ if len(comp_err) != 0:
+ return comp_err
+ return None
class TestStepUntilAPI(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@@ -74,6 +114,7 @@ def test_hitting(self):
@skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
@skipIf(archs=no_match(["x86_64", "aarch64"]))
+ @skipTestIfFn(linker_script_syntax_unsupported)
def test_hitting_discontinuous(self):
"""Test SBThread.StepOverUntil - targeting a line and hitting it -- with
discontinuous functions"""
@@ -93,6 +134,7 @@ def test_missing(self):
@skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
@skipIf(archs=no_match(["x86_64", "aarch64"]))
+ @skipTestIfFn(linker_script_syntax_unsupported)
def test_missing_discontinuous(self):
"""Test SBThread.StepOverUntil - targeting a line and missing it by
stepping out to call site -- with discontinuous functions"""
@@ -120,6 +162,7 @@ def test_bad_line(self):
@skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
@skipIf(archs=no_match(["x86_64", "aarch64"]))
+ @skipTestIfFn(linker_script_syntax_unsupported)
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"""
|
lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
Outdated
Show resolved
Hide resolved
✅ With the latest revision this PR passed the Python code formatter. |
lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
Outdated
Show resolved
Hide resolved
`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.
663f8f7
to
d315648
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if this works for your use-case, thanks! I'd give @JDevlieghere some time to look at this before merging
…7474) `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 a65aca6)
…7474) (#11528) `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 a65aca6)
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.