[Lldb-commits] [lldb] r238852 - Use new get_signal_number utility function for tests.

Chaoren Lin chaorenl at google.com
Tue Jun 2 10:01:13 PDT 2015


Author: chaoren
Date: Tue Jun  2 12:01:13 2015
New Revision: 238852

URL: http://llvm.org/viewvc/llvm-project?rev=238852&view=rev
Log:
Use new get_signal_number utility function for tests.

Summary:
This fixes TestLldbGdbServer and TestSendSignal from Windows to Android.
This change depends on D10171.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10172

Modified:
    lldb/trunk/test/functionalities/signal/TestSendSignal.py
    lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
    lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py

Modified: lldb/trunk/test/functionalities/signal/TestSendSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/signal/TestSendSignal.py?rev=238852&r1=238851&r2=238852&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/signal/TestSendSignal.py (original)
+++ lldb/trunk/test/functionalities/signal/TestSendSignal.py Tue Jun  2 12:01:13 2015
@@ -100,7 +100,7 @@ class SendSignalTestCase(TestBase):
         self.match_state(process_listener, lldb.eStateRunning)
 
         # Now signal the process, and make sure it stops:
-        process.Signal(signal.SIGUSR1)
+        process.Signal(lldbutil.get_signal_number('SIGUSR1'))
 
         self.match_state(process_listener, lldb.eStateStopped)
 
@@ -110,7 +110,8 @@ class SendSignalTestCase(TestBase):
         thread = threads[0]
 
         self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
-        self.assertTrue(thread.GetStopReasonDataAtIndex(0) == signal.SIGUSR1, "The stop signal was SIGUSR1")
+        self.assertTrue(thread.GetStopReasonDataAtIndex(0) == lldbutil.get_signal_number('SIGUSR1'),
+                "The stop signal was SIGUSR1")
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py?rev=238852&r1=238851&r2=238852&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py Tue Jun  2 12:01:13 2015
@@ -825,8 +825,8 @@ class LldbGdbServerTestCase(gdbremote_te
                  # Continue sending the signal number to the continue thread.
                  # The commented out packet is a way to do this same operation without using
                  # a $Hc (but this test is testing $Hc, so we'll stick with the former).
-                 "read packet: $C{0:x}#00".format(signal.SIGUSR1),
-                 # "read packet: $vCont;C{0:x}:{1:x};c#00".format(signal.SIGUSR1, thread_id),
+                 "read packet: $C{0:x}#00".format(lldbutil.get_signal_number('SIGUSR1')),
+                 # "read packet: $vCont;C{0:x}:{1:x};c#00".format(lldbutil.get_signal_number('SIGUSR1'), thread_id),
 
                  # FIXME: Linux does not report the thread stop on the delivered signal (SIGUSR1 here).  MacOSX debugserver does.
                  # But MacOSX debugserver isn't guaranteeing the thread the signal handler runs on, so currently its an XFAIL.
@@ -845,8 +845,8 @@ class LldbGdbServerTestCase(gdbremote_te
             # Ensure the stop signal is the signal we delivered.
             # stop_signo = context.get("stop_signo")
             # self.assertIsNotNone(stop_signo)
-            # self.assertEquals(int(stop_signo,16), signal.SIGUSR1)
-            
+            # self.assertEquals(int(stop_signo,16), lldbutil.get_signal_number('SIGUSR1'))
+
             # Ensure the stop thread is the thread to which we delivered the signal.
             # stop_thread_id = context.get("stop_thread_id")
             # self.assertIsNotNone(stop_thread_id)
@@ -883,7 +883,7 @@ class LldbGdbServerTestCase(gdbremote_te
         self.init_llgs_test()
         self.buildDwarf()
         self.set_inferior_startup_launch()
-        self.Hc_then_Csignal_signals_correct_thread(signal.SIGSEGV)
+        self.Hc_then_Csignal_signals_correct_thread(lldbutil.get_signal_number('SIGSEGV'))
 
     def m_packet_reads_memory(self):
         # This is the memory we will write into the inferior and then ensure we can read back with $m.
@@ -1219,7 +1219,7 @@ class LldbGdbServerTestCase(gdbremote_te
         # Verify the stop signal reported was the breakpoint signal number.
         stop_signo = context.get("stop_signo")
         self.assertIsNotNone(stop_signo)
-        self.assertEquals(int(stop_signo,16), signal.SIGTRAP)
+        self.assertEquals(int(stop_signo,16), lldbutil.get_signal_number('SIGTRAP'))
 
         # Ensure we did not receive any output.  If the breakpoint was not set, we would
         # see output (from a launched process with captured stdio) printing a hello, world message.

Modified: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py?rev=238852&r1=238851&r2=238852&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py Tue Jun  2 12:01:13 2015
@@ -1147,7 +1147,8 @@ class GdbRemoteTestCaseBase(TestBase):
             context = self.expect_gdbremote_sequence()
             self.assertIsNotNone(context)
             self.assertIsNotNone(context.get("stop_signo"))
-            self.assertEquals(int(context.get("stop_signo"), 16), signal.SIGTRAP)
+            self.assertEquals(int(context.get("stop_signo"), 16),
+                    lldbutil.get_signal_number('SIGTRAP'))
 
             single_step_count += 1
 





More information about the lldb-commits mailing list