omjavaid created this revision. omjavaid added a reviewer: labath. Herald added a subscriber: tschuett. Herald added a reviewer: rengolin. omjavaid requested review of this revision.
targetHasSVE helper function was added to test for availability of SVE support by connected platform. We now intend to use this function in other testcases and I am moving it to a generic location in lldbtest.py to allow usage by other upcoming testcases. 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()
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()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits