[Lldb-commits] [lldb] r233907 - Fix test expectation for aarch64 in several test case

Tamas Berghammer tberghammer at google.com
Thu Apr 2 04:07:56 PDT 2015


Author: tberghammer
Date: Thu Apr  2 06:07:55 2015
New Revision: 233907

URL: http://llvm.org/viewvc/llvm-project?rev=233907&view=rev
Log:
Fix test expectation for aarch64 in several test case

These test cases check if they are able to read registers after the
inferior is crashed. Previously they did it with reading the eax
register what is only available on i386 and x86_64. Thic CL add code to
do the check based on the target architecture (currently i386, x86_64
and aarch64 is supported)

Differential revision: http://reviews.llvm.org/D8702

Added:
    lldb/trunk/test/lldbplatformutil.py
Modified:
    lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
    lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
    lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=233907&r1=233906&r2=233907&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Thu Apr  2 06:07:55 2015
@@ -2,7 +2,7 @@
 
 import os, time
 import unittest2
-import lldb, lldbutil
+import lldb, lldbutil, lldbplatformutil
 from lldbtest import *
 
 class AssertingInferiorTestCase(TestBase):
@@ -149,8 +149,7 @@ class AssertingInferiorTestCase(TestBase
         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."""

Modified: lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=233907&r1=233906&r2=233907&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py Thu Apr  2 06:07:55 2015
@@ -2,7 +2,7 @@
 
 import os, time
 import unittest2
-import lldb, lldbutil
+import lldb, lldbutil, lldbplatformutil
 from lldbtest import *
 
 class CrashingInferiorTestCase(TestBase):
@@ -153,8 +153,7 @@ class CrashingInferiorTestCase(TestBase)
         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."""
@@ -193,8 +192,7 @@ class CrashingInferiorTestCase(TestBase)
             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",

Modified: lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py?rev=233907&r1=233906&r2=233907&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py Thu Apr  2 06:07:55 2015
@@ -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 @@ class CrashingRecursiveInferiorTestCase(
         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 @@ class CrashingRecursiveInferiorTestCase(
             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",

Added: lldb/trunk/test/lldbplatformutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbplatformutil.py?rev=233907&view=auto
==============================================================================
--- lldb/trunk/test/lldbplatformutil.py (added)
+++ lldb/trunk/test/lldbplatformutil.py Thu Apr  2 06:07:55 2015
@@ -0,0 +1,11 @@
+""" This module 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(test_case):
+    if test_case.getArchitecture() in ['x86_64', 'i386']:
+        test_case.expect("register read eax", substrs = ['eax = 0x'])
+    elif test_case.getArchitecture() in ['aarch64']:
+        test_case.expect("register read x0", substrs = ['x0 = 0x'])
+    else:
+        # TODO: Add check for other architectures
+        test_case.fail("Unsupported architecture for test case (arch: %s)" % test_case.getArchitecture())





More information about the lldb-commits mailing list