[Lldb-commits] [PATCH] D105483: [LLDB] Testsuite: Add helper to check for AArch64 target

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 6 07:47:16 PDT 2021


omjavaid created this revision.
omjavaid added a reviewer: DavidSpickett.
Herald added subscribers: danielkiss, kristof.beyls.
omjavaid requested review of this revision.

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.


https://reviews.llvm.org/D105483

Files:
  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


Index: lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
===================================================================
--- lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
+++ lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -64,7 +64,7 @@
             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"))
Index: lldb/test/API/functionalities/return-value/TestReturnValue.py
===================================================================
--- lldb/test/API/functionalities/return-value/TestReturnValue.py
+++ lldb/test/API/functionalities/return-value/TestReturnValue.py
@@ -15,8 +15,8 @@
     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
Index: lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
===================================================================
--- lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
+++ lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
@@ -33,7 +33,7 @@
         # 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"
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1291,14 +1291,18 @@
 
         return cpuinfo
 
+    def isAArch64(self):
+        """Returns true if the architecture is AArch64."""
+        return self.getArchitecture().lower() in ["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."""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105483.356722.patch
Type: text/x-patch
Size: 3245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210706/5891b4ba/attachment-0001.bin>


More information about the lldb-commits mailing list