diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/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() diff --git a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py b/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py --- a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py +++ b/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(