Index: test/functionalities/inferior-assert/TestInferiorAssert.py =================================================================== --- test/functionalities/inferior-assert/TestInferiorAssert.py +++ test/functionalities/inferior-assert/TestInferiorAssert.py @@ -2,7 +2,7 @@ import os, time import unittest2 -import lldb, lldbutil +import lldb, lldbutil, lldbplatformutil from lldbtest import * class AssertingInferiorTestCase(TestBase): @@ -150,8 +150,7 @@ self.check_stop_reason() # lldb should be able to read from registers from the inferior after asserting. - self.expect("register read eax", - substrs = ['eax = 0x']) + lldbplatformutil.check_first_register_readable(self) def inferior_asserting_disassemble(self): """Test that lldb can disassemble frames after asserting.""" Index: test/functionalities/inferior-crashing/TestInferiorCrashing.py =================================================================== --- test/functionalities/inferior-crashing/TestInferiorCrashing.py +++ test/functionalities/inferior-crashing/TestInferiorCrashing.py @@ -2,7 +2,7 @@ import os, time import unittest2 -import lldb, lldbutil +import lldb, lldbutil, lldbplatformutil from lldbtest import * class CrashingInferiorTestCase(TestBase): @@ -155,8 +155,7 @@ self.check_stop_reason() # lldb should be able to read from registers from the inferior after crashing. - self.expect("register read eax", - substrs = ['eax = 0x']) + lldbplatformutil.check_first_register_readable(self) def inferior_crashing_expr(self): """Test that the lldb expression interpreter can read symbols after crashing.""" @@ -195,8 +194,7 @@ substrs = ['= 0x0']) # lldb should be able to read from registers from the inferior after crashing. - self.expect("register read eax", - substrs = ['eax = 0x']) + lldbplatformutil.check_first_register_readable(self) # And it should report the correct line number. self.expect("thread backtrace all", Index: test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py =================================================================== --- test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py +++ test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py @@ -2,7 +2,7 @@ import os, time import unittest2 -import lldb, lldbutil +import lldb, lldbutil, lldbplatformutil import sys from lldbtest import * @@ -157,8 +157,7 @@ self.check_stop_reason() # lldb should be able to read from registers from the inferior after crashing. - self.expect("register read eax", - substrs = ['eax = 0x']) + lldbplatformutil.check_first_register_readable(self) def recursive_inferior_crashing_expr(self): """Test that the lldb expression interpreter can read symbols after crashing.""" @@ -192,8 +191,7 @@ substrs = ['(int) $0 =']) # lldb should be able to read from registers from the inferior after crashing. - self.expect("register read eax", - substrs = ['eax = 0x']) + lldbplatformutil.check_first_register_readable(self) # And it should report the correct line number. self.expect("thread backtrace all", Index: test/lldbplatformutil.py =================================================================== --- /dev/null +++ test/lldbplatformutil.py @@ -0,0 +1,11 @@ +""" This modul contains functions used by the test cases to hide the +architecture and/or the platform dependent nature of the tests. """ + +def check_first_register_readable(self): + if self.getArchitecture() in ['x86_64', 'i386']: + self.expect("register read eax", substrs = ['eax = 0x']) + elif self.getArchitecture() in ['aarch64']: + self.expect("register read x0", substrs = ['x0 = 0x']) + else: + # TODO: Add check for other architectures + self.fail("Unsupported architecture for test case (arch: %s)" % self.getArchitecture())