[Lldb-commits] [PATCH] D10954: [LLDB][MIPS] Added test case support for MIPS

Nitesh Jain nitesh.jain at imgtec.com
Mon Jul 6 04:02:37 PDT 2015


nitesh.jain added reviewers: clayborg, ovyalov.
nitesh.jain added subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, lldb-commits.

Repository:
  rL LLVM

http://reviews.llvm.org/D10954

Files:
  test/python_api/value/change_values/TestChangeValueAPI.py
  test/tools/lldb-server/gdbremote_testcase.py

Index: test/tools/lldb-server/gdbremote_testcase.py
===================================================================
--- test/tools/lldb-server/gdbremote_testcase.py
+++ test/tools/lldb-server/gdbremote_testcase.py
@@ -1258,25 +1258,31 @@
         args["expected_g_c2"] = "1"
         (state_reached, step_count) = self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, args, max_step_count=25, use_Hc_packet=use_Hc_packet, step_instruction=step_instruction)
         self.assertTrue(state_reached)
+        expected_step_count = 1
+        arch = self.getArchitecture()
+
+        #MIPS required "3" (ADDIU, SB, LD) machine instructions for updation of variable value
+        if arch == "mips" or arch == "mips64" or arch == "mips32el" or arch == "mips64el":
+           expected_step_count = 3
 
         # Verify we hit the next state.
         args["expected_g_c1"] = "1"
         args["expected_g_c2"] = "0"
         (state_reached, step_count) = self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, args, max_step_count=5, use_Hc_packet=use_Hc_packet, step_instruction=step_instruction)
         self.assertTrue(state_reached)
-        self.assertEquals(step_count, 1)
+        self.assertEquals(step_count, expected_step_count)
 
         # Verify we hit the next state.
         args["expected_g_c1"] = "0"
         args["expected_g_c2"] = "0"
         (state_reached, step_count) = self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, args, max_step_count=5, use_Hc_packet=use_Hc_packet, step_instruction=step_instruction)
         self.assertTrue(state_reached)
-        self.assertEquals(step_count, 1)
+        self.assertEquals(step_count, expected_step_count)
 
         # Verify we hit the next state.
         args["expected_g_c1"] = "0"
         args["expected_g_c2"] = "1"
         (state_reached, step_count) = self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, args, max_step_count=5, use_Hc_packet=use_Hc_packet, step_instruction=step_instruction)
         self.assertTrue(state_reached)
-        self.assertEquals(step_count, 1)
+        self.assertEquals(step_count, expected_step_count)
 
Index: test/python_api/value/change_values/TestChangeValueAPI.py
===================================================================
--- test/python_api/value/change_values/TestChangeValueAPI.py
+++ test/python_api/value/change_values/TestChangeValueAPI.py
@@ -138,13 +138,22 @@
         # Finally, change the stack pointer to 0, and we should not make it to our end breakpoint.
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue (frame0.IsValid(), "Second time: got a valid frame.")
-        sp_value = frame0.FindValue ("sp", lldb.eValueTypeRegister);
+        sp_value = frame0.FindValue ("sp", lldb.eValueTypeRegister)
         self.assertTrue (sp_value.IsValid(), "Got a stack pointer value")
-        result = sp_value.SetValueFromCString("1")
+        arch = self.getArchitecture()
+
+        #To get invalid  address in case of MIPS Architecture when sp value is changed. 
+        if arch == "mips" or arch == "mips64" or arch == "mips32el" or arch == "mips64el":
+           result = sp_value.SetValueFromCString("100")
+        else:
+           result = sp_value.SetValueFromCString("1")
         self.assertTrue (result, "Setting sp returned true.")
         actual_value = sp_value.GetValueAsUnsigned (error, 0)
         self.assertTrue (error.Success(), "Got a changed value for sp")
-        self.assertTrue (actual_value == 1, "Got the right changed value for sp.")
+        if arch == "mips" or arch == "mips64" or arch == "mips32el" or arch == "mips64el":
+           self.assertTrue (actual_value == 100, "Got the right changed value for sp.")
+        else:
+            self.assertTrue (actual_value == 1, "Got the right changed value for sp.")
         
         # Boundary condition test the SBValue.CreateValueFromExpression() API.
         # LLDB should not crash!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10954.29073.patch
Type: text/x-patch
Size: 4026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150706/93593d59/attachment.bin>


More information about the lldb-commits mailing list