[LLDB] Testsuite: Add helper to check for AArch64 target

This patch adds a helper function to test target architecture is
AArch64 or not. This also tightens isAArch64* helpers by adding an
extra architecture check.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D105483
This commit is contained in:
Muhammad Omair Javaid 2021-07-12 14:18:18 +05:00
parent 26e59cc19f
commit 10f5e08a71
4 changed files with 11 additions and 7 deletions

View File

@ -1291,14 +1291,18 @@ class Base(unittest2.TestCase):
return cpuinfo
def isAArch64(self):
"""Returns true if the architecture is AArch64."""
return self.getArchitecture().lower() == "aarch64"
def isAArch64SVE(self):
return "sve" in self.getCPUInfo()
return self.isAArch64() and "sve" in self.getCPUInfo()
def isAArch64MTE(self):
return "mte" in self.getCPUInfo()
return self.isAArch64() and "mte" in self.getCPUInfo()
def isAArch64PAuth(self):
return "paca" in self.getCPUInfo()
return self.isAArch64() and "paca" in self.getCPUInfo()
def getArchitecture(self):
"""Returns the architecture in effect the test suite is running with."""

View File

@ -33,7 +33,7 @@ class MemoryTagTestCase(TestBase):
# If you're on AArch64 you could have MTE but the remote process
# must also support it. If you're on any other arhcitecture you
# won't have any tagging at all. So the error message is different.
if self.getArchitecture() == "aarch64":
if self.isAArch64():
expected = "error: Process does not support memory tagging"
else:
expected = "error: This architecture does not support memory tagging"

View File

@ -15,8 +15,8 @@ class ReturnValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def affected_by_pr33042(self):
return ("clang" in self.getCompiler() and self.getArchitecture() ==
"aarch64" and self.getPlatform() == "linux")
return ("clang" in self.getCompiler() and self.isAArch64() and
self.getPlatform() == "linux")
def affected_by_pr44132(self):
return (self.getArchitecture() in ["aarch64", "arm"] and

View File

@ -64,7 +64,7 @@ class TestGdbRemoteTargetXmlPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
self.assertEqual(q_info_reg["format"], xml_info_reg.get("format"))
self.assertEqual(q_info_reg["bitsize"], xml_info_reg.get("bitsize"))
if not self.getArchitecture() == 'aarch64':
if not self.isAArch64():
self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
self.assertEqual(q_info_reg["encoding"], xml_info_reg.get("encoding"))