[Lldb-commits] [lldb] 10f5e08 - [LLDB] Testsuite: Add helper to check for AArch64 target

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 12 02:22:24 PDT 2021


Author: Muhammad Omair Javaid
Date: 2021-07-12T14:21:45+05:00
New Revision: 10f5e08a7124d2efb5b3a58a041363dbe291fefd

URL: https://github.com/llvm/llvm-project/commit/10f5e08a7124d2efb5b3a58a041363dbe291fefd
DIFF: https://github.com/llvm/llvm-project/commit/10f5e08a7124d2efb5b3a58a041363dbe291fefd.diff

LOG: [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

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbtest.py
    lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
    lldb/test/API/functionalities/return-value/TestReturnValue.py
    lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 7c0f01add8f07..7e1fdce36ede6 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1291,14 +1291,18 @@ def getCPUInfo(self):
 
         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."""

diff  --git a/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py b/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
index d2827239caf4a..d6b4169b1bfda 100644
--- a/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
+++ b/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
@@ -33,7 +33,7 @@ def test_memory_tag_read_unsupported(self):
         # 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 
diff erent.
-        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"

diff  --git a/lldb/test/API/functionalities/return-value/TestReturnValue.py b/lldb/test/API/functionalities/return-value/TestReturnValue.py
index 33af565dd9a14..fe79c46c30f01 100644
--- a/lldb/test/API/functionalities/return-value/TestReturnValue.py
+++ b/lldb/test/API/functionalities/return-value/TestReturnValue.py
@@ -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

diff  --git a/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py b/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
index 8a91024898ffa..bfa7babb7dcec 100644
--- a/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
+++ b/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -64,7 +64,7 @@ def test_g_target_xml_returns_correct_data(self):
             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"))


        


More information about the lldb-commits mailing list