[Lldb-commits] [lldb] r213166 - gdb-remote test noise suppression on MacOSX.

Todd Fiala todd.fiala at gmail.com
Wed Jul 16 09:15:45 PDT 2014


Author: tfiala
Date: Wed Jul 16 11:15:42 2014
New Revision: 213166

URL: http://llvm.org/viewvc/llvm-project?rev=213166&view=rev
Log:
gdb-remote test noise suppression on MacOSX.

This change adds a member to the base test case for gdb-remote that
indicates whether a stub makes two X stop notification reports on kill
commands.  This is set to true for debugserver tests.

The test for killing an attached process after it's first stop notification
has been modified to look at that flag and add an extra X packet matcher
so the "unmatched packet warning" doesn't get emitted for the second X on
MacOSX with debugserver.

I also broke those tests out of the monolithic TestLldbGdbServer mega test
case and put it in its own, new TestGdbRemoteKill.py file and test case.

Tested:
Ubuntu 14.04 x86_64, clang-3.5 built lldb, no test failures.
MacOSX 10.9.4, Xcode 6.0 Beta 3 built lldb, no test failures.

Added:
    lldb/trunk/test/tools/lldb-gdbserver/TestGdbRemoteKill.py
Modified:
    lldb/trunk/test/tools/lldb-gdbserver/TestLldbGdbServer.py
    lldb/trunk/test/tools/lldb-gdbserver/gdbremote_testcase.py

Added: lldb/trunk/test/tools/lldb-gdbserver/TestGdbRemoteKill.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-gdbserver/TestGdbRemoteKill.py?rev=213166&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-gdbserver/TestGdbRemoteKill.py (added)
+++ lldb/trunk/test/tools/lldb-gdbserver/TestGdbRemoteKill.py Wed Jul 16 11:15:42 2014
@@ -0,0 +1,49 @@
+import unittest2
+
+import gdbremote_testcase
+import lldbgdbserverutils
+
+from lldbtest import *
+
+class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
+    def attach_commandline_kill_after_initial_stop(self):
+        procs = self.prep_debug_monitor_and_inferior()
+        self.test_sequence.add_log_lines([
+            "read packet: $k#6b",
+            {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
+            ], True)
+
+        if self.stub_sends_two_stop_notifications_on_kill:
+            # Add an expectation for a second X result for stubs that send two of these.
+            self.test_sequence.add_log_lines([
+                {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
+                ], True)
+
+        self.expect_gdbremote_sequence()
+
+        # Wait a moment for completed and now-detached inferior process to clear.
+        time.sleep(1)
+
+        # Process should be dead now.  Reap results.
+        poll_result = procs["inferior"].poll()
+        self.assertIsNotNone(poll_result)
+
+        # Where possible, verify at the system level that the process is not running.
+        self.assertFalse(lldbgdbserverutils.process_is_running(procs["inferior"].pid, False))
+
+    @debugserver_test
+    @dsym_test
+    def test_attach_commandline_kill_after_initial_stop_debugserver_dsym(self):
+        self.init_debugserver_test()
+        self.buildDsym()
+        self.set_inferior_startup_attach()
+        self.attach_commandline_kill_after_initial_stop()
+
+    @llgs_test
+    @dwarf_test
+    def test_attach_commandline_kill_after_initial_stop_llgs_dwarf(self):
+        self.init_llgs_test()
+        self.buildDwarf()
+        self.set_inferior_startup_attach()
+        self.attach_commandline_kill_after_initial_stop()
+

Modified: lldb/trunk/test/tools/lldb-gdbserver/TestLldbGdbServer.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-gdbserver/TestLldbGdbServer.py?rev=213166&r1=213165&r2=213166&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-gdbserver/TestLldbGdbServer.py (original)
+++ lldb/trunk/test/tools/lldb-gdbserver/TestLldbGdbServer.py Wed Jul 16 11:15:42 2014
@@ -406,40 +406,6 @@ class LldbGdbServerTestCase(gdbremote_te
         self.set_inferior_startup_attach()
         self.attach_commandline_continue_app_exits()
 
-    def attach_commandline_kill_after_initial_stop(self):
-        procs = self.prep_debug_monitor_and_inferior()
-        self.test_sequence.add_log_lines(
-            ["read packet: $k#6b",
-             "send packet: $X09#00"],
-            True)
-        self.expect_gdbremote_sequence()
-
-        # Wait a moment for completed and now-detached inferior process to clear.
-        time.sleep(1)
-
-        # Process should be dead now.  Reap results.
-        poll_result = procs["inferior"].poll()
-        self.assertIsNotNone(poll_result)
-
-        # Where possible, verify at the system level that the process is not running.
-        self.assertFalse(lldbgdbserverutils.process_is_running(procs["inferior"].pid, False))
-
-    @debugserver_test
-    @dsym_test
-    def test_attach_commandline_kill_after_initial_stop_debugserver_dsym(self):
-        self.init_debugserver_test()
-        self.buildDsym()
-        self.set_inferior_startup_attach()
-        self.attach_commandline_kill_after_initial_stop()
-
-    @llgs_test
-    @dwarf_test
-    def test_attach_commandline_kill_after_initial_stop_llgs_dwarf(self):
-        self.init_llgs_test()
-        self.buildDwarf()
-        self.set_inferior_startup_attach()
-        self.attach_commandline_kill_after_initial_stop()
-
     def qRegisterInfo_returns_one_valid_result(self):
         server = self.connect_to_debug_monitor()
         self.assertIsNotNone(server)

Modified: lldb/trunk/test/tools/lldb-gdbserver/gdbremote_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-gdbserver/gdbremote_testcase.py?rev=213166&r1=213165&r2=213166&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-gdbserver/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-gdbserver/gdbremote_testcase.py Wed Jul 16 11:15:42 2014
@@ -55,6 +55,7 @@ class GdbRemoteTestCaseBase(TestBase):
         self.named_pipe_path = None
         self.named_pipe = None
         self.named_pipe_fd = None
+        self.stub_sends_two_stop_notifications_on_kill = False
 
     def get_next_port(self):
         return 12000 + random.randint(0,3999)
@@ -142,6 +143,9 @@ class GdbRemoteTestCaseBase(TestBase):
         self.debug_monitor_extra_args = " --log-file=/tmp/packets-{}.log --log-flags=0x800000".format(self._testMethodName)
         if use_named_pipe:
             (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = self.create_named_pipe()
+        # The debugserver stub has a race on handling the 'k' command, so it sends an X09 right away, then sends the real X notification
+        # when the process truly dies.
+        self.stub_sends_two_stop_notifications_on_kill = True
 
     def create_socket(self):
         sock = socket.socket()





More information about the lldb-commits mailing list