Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / debug_stub / debug_stub_test.py
index 6ab2b6e..54b70c0 100644 (file)
@@ -18,6 +18,7 @@ else:
   RETURNCODE_KILL = -9 & 0xff
 
 
+NACL_SIGILL = 4
 NACL_SIGTRAP = 5
 NACL_SIGSEGV = 11
 
@@ -176,6 +177,10 @@ ARM_USER_CPSR_FLAGS_MASK = (
     (1<<19) | (1<<18) | (1<<17) | (1<<16)) # GE bits
 
 
+def UsingQemu():
+  return SEL_LDR_COMMAND[0].endswith('/run_under_qemu_arm')
+
+
 def DecodeRegs(reply):
   defs = REG_DEFS[ARCH]
   names = [reg_name for reg_name, reg_fmt in defs]
@@ -459,7 +464,9 @@ class DebugStubTest(unittest.TestCase):
       # Tell the process to continue, because it starts at the
       # breakpoint set at its start address.
       reply = connection.RspRequest('c')
-      if ARCH == 'arm' or ARCH == 'mips32':
+      if ARCH == 'arm':
+        AssertReplySignal(reply, NACL_SIGILL)
+      elif ARCH == 'mips32':
         # The process should have stopped on a BKPT instruction.
         AssertReplySignal(reply, NACL_SIGTRAP)
       else:
@@ -472,6 +479,9 @@ class DebugStubTest(unittest.TestCase):
       self.CheckReadOnlyRegisters(connection)
 
   def test_jump_to_address_zero(self):
+    if UsingQemu():
+      # This test hangs under qemu-arm.
+      return
     with LaunchDebugStub('test_jump_to_address_zero') as connection:
       # Continue from initial breakpoint.
       reply = connection.RspRequest('c')
@@ -772,7 +782,7 @@ class DebugStubThreadSuspensionTest(unittest.TestCase):
       # Skip past the single-byte HLT instruction.
       regs[IP_REG[ARCH]] += 1
     elif ARCH == 'arm':
-      AssertReplySignal(stop_reply, NACL_SIGTRAP)
+      AssertReplySignal(stop_reply, NACL_SIGILL)
       bundle_size = 16
       assert regs['r15'] % bundle_size == 0, regs['r15']
       regs['r15'] += bundle_size
@@ -799,6 +809,10 @@ class DebugStubThreadSuspensionTest(unittest.TestCase):
     return child_thread_id
 
   def test_continuing_thread_with_others_suspended(self):
+    if UsingQemu():
+      # Suspending a running thread doesn't work under qemu-arm, so
+      # disable this test there.
+      return
     with LaunchDebugStub('test_suspending_threads') as connection:
       symbols = GetSymbols()
       child_thread_id = self.WaitForTestThreadsToStart(connection, symbols)
@@ -824,6 +838,10 @@ class DebugStubThreadSuspensionTest(unittest.TestCase):
             child_thread_val)
 
   def test_single_stepping_thread_with_others_suspended(self):
+    if UsingQemu():
+      # Suspending a running thread doesn't work under qemu-arm, so
+      # disable this test there.
+      return
     with LaunchDebugStub('test_suspending_threads') as connection:
       symbols = GetSymbols()
       child_thread_id = self.WaitForTestThreadsToStart(connection, symbols)