[Lldb-commits] [PATCH] D86872: [LLDB] Move targetHasSVE function to lldbtest.py

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 6 20:38:08 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9bee13f89085: Move targetHasSVE function to lldbtest.py (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86872/new/

https://reviews.llvm.org/D86872

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py


Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
===================================================================
--- lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
@@ -10,29 +10,6 @@
 
 class RegisterCommandsTestCase(TestBase):
 
-    def targetHasSVE(self):
-        triple = self.dbg.GetSelectedPlatform().GetTriple()
-
-        # TODO other platforms, please implement this function
-        if not re.match(".*-.*-linux", triple):
-            return False
-
-        # Need to do something different for non-Linux/Android targets
-        cpuinfo_path = self.getBuildArtifact("cpuinfo")
-        if configuration.lldb_platform_name:
-            self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path)
-        else:
-            cpuinfo_path = "/proc/cpuinfo"
-
-        try:
-            f = open(cpuinfo_path, 'r')
-            cpuinfo = f.read()
-            f.close()
-        except:
-            return False
-
-        return " sve " in cpuinfo
-
     def check_sve_register_size(self, set, name, expected):
         reg_value = set.GetChildMemberWithName(name)
         self.assertTrue(reg_value.IsValid(),
@@ -53,7 +30,7 @@
         exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        if not self.targetHasSVE():
+        if not self.isAArch64SVE():
             self.skipTest('SVE registers must be supported.')
 
         lldbutil.run_break_set_by_file_and_line(
@@ -108,7 +85,7 @@
         exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        if not self.targetHasSVE():
+        if not self.isAArch64SVE():
             self.skipTest('SVE registers must be supported.')
 
         lldbutil.run_break_set_by_file_and_line(
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1293,6 +1293,29 @@
             return True
         return False
 
+    def isAArch64SVE(self):
+        triple = self.dbg.GetSelectedPlatform().GetTriple()
+
+        # TODO other platforms, please implement this function
+        if not re.match(".*-.*-linux", triple):
+            return False
+
+        # Need to do something different for non-Linux/Android targets
+        cpuinfo_path = self.getBuildArtifact("cpuinfo")
+        if configuration.lldb_platform_name:
+            self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path)
+        else:
+            cpuinfo_path = "/proc/cpuinfo"
+
+        try:
+            f = open(cpuinfo_path, 'r')
+            cpuinfo = f.read()
+            f.close()
+        except:
+            return False
+
+        return " sve " in cpuinfo
+
     def getArchitecture(self):
         """Returns the architecture in effect the test suite is running with."""
         module = builder_module()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86872.290171.patch
Type: text/x-patch
Size: 3188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200907/5cdf2fb7/attachment.bin>


More information about the lldb-commits mailing list