aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorGeorgiy Samoylov <g.samoylov@syntacore.com>2025-03-07 12:27:39 +0300
committerGitHub <noreply@github.com>2025-03-07 09:27:39 +0000
commit9c08e650cd83e3e891dd2972ae1852ae1763c7ff (patch)
tree627f17f675960b8e92d6fc832aaef47503e12ba4 /lldb/packages/Python/lldbsuite/test
parenteb4a7052f64ef22c87a402a198f21f30da379af8 (diff)
downloadllvm-9c08e650cd83e3e891dd2972ae1852ae1763c7ff.zip
llvm-9c08e650cd83e3e891dd2972ae1852ae1763c7ff.tar.gz
llvm-9c08e650cd83e3e891dd2972ae1852ae1763c7ff.tar.bz2
[lldb] Adapt llgs tests for RISC-V (#130034)
Some lldb tests from llgs category fail on RISC-V target due to lack of necessary condition checks. This patch adapts these tests by taking into account the peculiarities of the RISC-V architecture
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbplatformutil.py6
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py2
3 files changed, 10 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 3d8c713..a1ab060 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -35,7 +35,7 @@ def check_first_register_readable(test_case):
test_case.expect("register read r0", substrs=["r0 = 0x"])
elif arch in ["powerpc64le"]:
test_case.expect("register read r0", substrs=["r0 = 0x"])
- elif re.match("^rv(32|64)", arch):
+ elif arch in ["riscv64", "riscv32"]:
test_case.expect("register read zero", substrs=["zero = 0x"])
else:
# TODO: Add check for other architectures
@@ -240,6 +240,10 @@ def getArchitecture():
arch = "x86_64"
if arch in ["armv7l", "armv8l"]:
arch = "arm"
+ if re.match("rv64*", arch):
+ arch = "riscv64"
+ if re.match("rv32*", arch):
+ arch = "riscv32"
return arch
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 81b2863..7d0e6e9 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1393,6 +1393,10 @@ class Base(unittest.TestCase):
def isLoongArchLASX(self):
return self.isLoongArch() and "lasx" in self.getCPUInfo()
+ def isRISCV(self):
+ """Returns true if the architecture is RISCV64 or RISCV32."""
+ return self.getArchitecture() in ["riscv64", "riscv32"]
+
def getArchitecture(self):
"""Returns the architecture in effect the test suite is running with."""
return lldbplatformutil.getArchitecture()
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index fb96b3d..3d3ecb9 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -682,7 +682,7 @@ class GdbRemoteTestCaseBase(Base, metaclass=GdbRemoteTestCaseFactory):
self.assertTrue("name" in reg_info)
self.assertTrue("bitsize" in reg_info)
- if not self.getArchitecture() == "aarch64":
+ if not (self.getArchitecture() == "aarch64" or self.isRISCV()):
self.assertTrue("offset" in reg_info)
self.assertTrue("encoding" in reg_info)