[llvm-branch-commits] [lldb] 76a718e - [lldb] Deduplicate some lldb-server tests

Pavel Labath via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 28 11:24:27 PST 2020


Author: Pavel Labath
Date: 2020-12-28T20:16:08+01:00
New Revision: 76a718ee939ed84d95b005f36cfbd103a702522f

URL: https://github.com/llvm/llvm-project/commit/76a718ee939ed84d95b005f36cfbd103a702522f
DIFF: https://github.com/llvm/llvm-project/commit/76a718ee939ed84d95b005f36cfbd103a702522f.diff

LOG: [lldb] Deduplicate some lldb-server tests

Merge llgs and debugserver flavours

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-server/TestGdbRemoteAttach.py
    lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
    lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
    lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py
    lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
    lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
    lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteAttach.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteAttach.py
index 9ffa7e26fab7..dd427b66ca89 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteAttach.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteAttach.py
@@ -1,17 +1,17 @@
-
-
 import gdbremote_testcase
 import lldbgdbserverutils
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
 class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def attach_with_vAttach(self):
+    def test_attach_with_vAttach(self):
+        self.build()
+        self.set_inferior_startup_attach_manually()
+
         # Start the inferior, start the debug monitor, nothing is attached yet.
         procs = self.prep_debug_monitor_and_inferior(
             inferior_args=["sleep:60"])
@@ -49,15 +49,3 @@ def attach_with_vAttach(self):
         self.assertIsNotNone(pid_text)
         reported_pid = int(pid_text, base=16)
         self.assertEqual(reported_pid, inferior.pid)
-
-    @debugserver_test
-    def test_attach_with_vAttach_debugserver(self):
-        self.build()
-        self.set_inferior_startup_attach_manually()
-        self.attach_with_vAttach()
-
-    @llgs_test
-    def test_attach_with_vAttach_llgs(self):
-        self.build()
-        self.set_inferior_startup_attach_manually()
-        self.attach_with_vAttach()

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
index e9eaab322821..22af21d132da 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
@@ -34,7 +34,7 @@ def init_lldb_server(self):
     def generate_hex_path(self, target):
         return str(os.path.join(self.getBuildDir(), target)).encode().hex()
 
-    @llgs_test
+    @add_test_categories(["llgs"])
     def test_autocomplete_path(self):
         self.build()
         self.init_lldb_server()

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
index 103ecfd292cd..fcf115647801 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
@@ -57,45 +57,21 @@ def stop_notification_contains_generic_register(
         self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
         self.trace("{} reg_info:{}".format(generic_register_name, reg_info))
 
-    def stop_notification_contains_aarch64_vg_register(self):
-        # Generate a stop reply, parse out expedited registers from stop
-        # notification.
-        expedited_registers = self.gather_expedited_registers()
-        self.assertIsNotNone(expedited_registers)
-        self.assertTrue(len(expedited_registers) > 0)
-
-        # Gather target register infos.
-        reg_infos = self.gather_register_infos()
-
-        # Find the vg register.
-        reg_info = self.find_register_with_name_and_dwarf_regnum(
-            reg_infos, 'vg', '46')
-        self.assertIsNotNone(reg_info)
-
-        # Ensure the expedited registers contained it.
-        self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
-        self.trace("{} reg_info:{}".format('vg', reg_info))
+    def test_stop_notification_contains_any_registers(self):
+        self.build()
+        self.set_inferior_startup_launch()
 
-    def stop_notification_contains_any_registers(self):
         # Generate a stop reply, parse out expedited registers from stop
         # notification.
         expedited_registers = self.gather_expedited_registers()
         # Verify we have at least one expedited register.
         self.assertTrue(len(expedited_registers) > 0)
 
-    @debugserver_test
-    def test_stop_notification_contains_any_registers_debugserver(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_any_registers()
 
-    @llgs_test
-    def test_stop_notification_contains_any_registers_llgs(self):
+    def test_stop_notification_contains_no_duplicate_registers(self):
         self.build()
         self.set_inferior_startup_launch()
-        self.stop_notification_contains_any_registers()
 
-    def stop_notification_contains_no_duplicate_registers(self):
         # Generate a stop reply, parse out expedited registers from stop
         # notification.
         expedited_registers = self.gather_expedited_registers()
@@ -106,72 +82,44 @@ def stop_notification_contains_no_duplicate_registers(self):
                     "expedited register number {} specified more than once ({} times)".format(
                         reg_num, len(value)))
 
-    @debugserver_test
-    def test_stop_notification_contains_no_duplicate_registers_debugserver(
-            self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_no_duplicate_registers()
-
-    @llgs_test
-    def test_stop_notification_contains_no_duplicate_registers_llgs(self):
+    def test_stop_notification_contains_pc_register(self):
         self.build()
         self.set_inferior_startup_launch()
-        self.stop_notification_contains_no_duplicate_registers()
-
-    def stop_notification_contains_pc_register(self):
         self.stop_notification_contains_generic_register("pc")
 
-    @debugserver_test
-    def test_stop_notification_contains_pc_register_debugserver(self):
+    @skipIf(triple='^powerpc64') # powerpc64 has no FP register
+    def test_stop_notification_contains_fp_register(self):
         self.build()
         self.set_inferior_startup_launch()
-        self.stop_notification_contains_pc_register()
-
-    @llgs_test
-    def test_stop_notification_contains_pc_register_llgs(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_pc_register()
-
-    # powerpc64 has no FP register
-    @skipIf(triple='^powerpc64')
-    def stop_notification_contains_fp_register(self):
         self.stop_notification_contains_generic_register("fp")
 
-    @debugserver_test
-    def test_stop_notification_contains_fp_register_debugserver(self):
+    def test_stop_notification_contains_sp_register(self):
         self.build()
         self.set_inferior_startup_launch()
-        self.stop_notification_contains_fp_register()
-
-    @llgs_test
-    def test_stop_notification_contains_fp_register_llgs(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_fp_register()
-
-    def stop_notification_contains_sp_register(self):
         self.stop_notification_contains_generic_register("sp")
 
-    @debugserver_test
-    def test_stop_notification_contains_sp_register_debugserver(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_sp_register()
-
-    @llgs_test
-    def test_stop_notification_contains_sp_register_llgs(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.stop_notification_contains_sp_register()
-
-    @llgs_test
     @skipIf(archs=no_match(["aarch64"]))
     @skipIf(oslist=no_match(['linux']))
-    def test_stop_notification_contains_vg_register_llgs(self):
+    def test_stop_notification_contains_vg_register(self):
         if not self.isAArch64SVE():
             self.skipTest('SVE registers must be supported.')
         self.build()
         self.set_inferior_startup_launch()
-        self.stop_notification_contains_aarch64_vg_register()
+
+        # Generate a stop reply, parse out expedited registers from stop
+        # notification.
+        expedited_registers = self.gather_expedited_registers()
+        self.assertIsNotNone(expedited_registers)
+        self.assertTrue(len(expedited_registers) > 0)
+
+        # Gather target register infos.
+        reg_infos = self.gather_register_infos()
+
+        # Find the vg register.
+        reg_info = self.find_register_with_name_and_dwarf_regnum(
+            reg_infos, 'vg', '46')
+        self.assertIsNotNone(reg_info)
+
+        # Ensure the expedited registers contained it.
+        self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
+        self.trace("{} reg_info:{}".format('vg', reg_info))

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py
index 945f9d5ecf1f..63126c15d471 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py
@@ -99,26 +99,12 @@ def validate_darwin_minimum_host_info_keys(self, host_info_dict):
                           "qHostInfo is missing the following required "
                           "keys: " + str(missing_keys))
 
-    @debugserver_test
-    def test_qHostInfo_returns_at_least_one_key_val_pair_debugserver(self):
+    def test_qHostInfo_returns_at_least_one_key_val_pair(self):
         self.build()
         self.get_qHostInfo_response()
 
-    @llgs_test
-    def test_qHostInfo_returns_at_least_one_key_val_pair_llgs(self):
-        self.build()
-        self.get_qHostInfo_response()
-
-    @skipUnlessDarwin
-    @debugserver_test
-    def test_qHostInfo_contains_darwin_required_keys_debugserver(self):
-        self.build()
-        host_info_dict = self.get_qHostInfo_response()
-        self.validate_darwin_minimum_host_info_keys(host_info_dict)
-
     @skipUnlessDarwin
-    @llgs_test
-    def test_qHostInfo_contains_darwin_required_keys_llgs(self):
+    def test_qHostInfo_contains_darwin_required_keys(self):
         self.build()
         host_info_dict = self.get_qHostInfo_response()
         self.validate_darwin_minimum_host_info_keys(host_info_dict)

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py b/lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
index e76ccec067ab..c2b944475fad 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -1,13 +1,9 @@
-
-
-
 import unittest2
 import gdbremote_testcase
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
 class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -104,31 +100,25 @@ def gather_stop_replies_via_qThreadStopInfo(self, thread_count):
 
         return (stop_replies, thread_dicts)
 
-    def qThreadStopInfo_works_for_multiple_threads(self, thread_count):
-        (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
+    @skipIfNetBSD
+    def test_qThreadStopInfo_works_for_multiple_threads(self):
+        self.build()
+        self.set_inferior_startup_launch()
+        (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(self.THREAD_COUNT)
         triple = self.dbg.GetSelectedPlatform().GetTriple()
         # Consider one more thread created by calling DebugBreakProcess.
         if re.match(".*-.*-windows", triple):
-            self.assertGreaterEqual(len(stop_replies), thread_count)
+            self.assertGreaterEqual(len(stop_replies), self.THREAD_COUNT)
         else:
-            self.assertEqual(len(stop_replies), thread_count)
+            self.assertEqual(len(stop_replies), self.THREAD_COUNT)
 
-    @debugserver_test
-    def test_qThreadStopInfo_works_for_multiple_threads_debugserver(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
-
-    @llgs_test
-    @skipIfNetBSD
-    def test_qThreadStopInfo_works_for_multiple_threads_llgs(self):
+    @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48418")
+    @expectedFailureNetBSD
+    def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self):
         self.build()
         self.set_inferior_startup_launch()
-        self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
 
-    def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
-            self, thread_count):
-        (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
+        (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(self.THREAD_COUNT)
         self.assertIsNotNone(stop_replies)
 
         no_stop_reason_count = sum(
@@ -143,53 +133,9 @@ def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
 
         # Consider one more thread created by calling DebugBreakProcess.
         if re.match(".*-.*-windows", triple):
-            self.assertGreaterEqual(no_stop_reason_count, thread_count - 1)
+            self.assertGreaterEqual(no_stop_reason_count, self.THREAD_COUNT - 1)
         else:
-            self.assertEqual(no_stop_reason_count, thread_count - 1)
+            self.assertEqual(no_stop_reason_count, self.THREAD_COUNT - 1)
 
         # Only one thread should should indicate a stop reason.
         self.assertEqual(with_stop_reason_count, 1)
-
-    @debugserver_test
-    def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver(
-            self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
-            self.THREAD_COUNT)
-
-    @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48418")
-    @expectedFailureNetBSD
-    @llgs_test
-    def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(
-            self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
-            self.THREAD_COUNT)
-
-    def qThreadStopInfo_has_valid_thread_names(
-            self, thread_count, expected_thread_name):
-        (_, thread_dicts) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
-        self.assertIsNotNone(thread_dicts)
-
-        for thread_dict in list(thread_dicts.values()):
-            name = thread_dict.get("name")
-            self.assertIsNotNone(name)
-            self.assertEqual(name, expected_thread_name)
-
-    @unittest2.skip("MacOSX doesn't have a default thread name")
-    @debugserver_test
-    def test_qThreadStopInfo_has_valid_thread_names_debugserver(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out")
-
-    # test requires OS with set, equal thread names by default.
-    # Windows thread does not have name property, equal names as the process's by default.
-    @skipUnlessPlatform(["linux", "windows"])
-    @llgs_test
-    def test_qThreadStopInfo_has_valid_thread_names_llgs(self):
-        self.build()
-        self.set_inferior_startup_launch()
-        self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out")

diff  --git a/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py b/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
index 44815019d1ab..5a7220f76fe0 100644
--- a/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
+++ b/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
@@ -11,33 +11,16 @@ class TestGdbRemoteConnection(gdbremote_testcase.GdbRemoteTestCaseBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @debugserver_test
-    def test_reverse_connect_debugserver(self):
-        self._reverse_connect()
-
-    @llgs_test
     @skipIfRemote  # reverse connect is not a supported use case for now
     def test_reverse_connect_llgs(self):
-        self._reverse_connect()
-
-    def _reverse_connect(self):
         # Reverse connect is the default connection method.
         self.connect_to_debug_monitor()
         # Verify we can do the handshake.  If that works, we'll call it good.
         self.do_handshake(self.sock)
 
-    @debugserver_test
-    @skipIfRemote
-    def test_named_pipe_debugserver(self):
-        self._named_pipe()
-
-    @llgs_test
     @skipIfRemote
     @skipIfWindows
     def test_named_pipe_llgs(self):
-        self._named_pipe()
-
-    def _named_pipe(self):
         family, type, proto, _, addr = socket.getaddrinfo(
             self.stub_hostname, 0, proto=socket.IPPROTO_TCP)[0]
         self.sock = socket.socket(family, type, proto)

diff  --git a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
index 946d53341bef..8d4f464b8dee 100644
--- a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
+++ b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
@@ -46,7 +46,6 @@ def signal_name_to_hex(signame):
         context = self.expect_gdbremote_sequence()
         self.assertIsNotNone(context)
 
-    @llgs_test
     @skipUnlessPlatform(["linux", "android"])
     def test_q_pass_signals(self):
         self.build()
@@ -61,7 +60,6 @@ def test_q_pass_signals(self):
             self.expect_signal(signo)
         self.expect_exit_code(len(signals_to_ignore))
 
-    @llgs_test
     @skipUnlessPlatform(["linux", "android"])
     def test_change_signals_at_runtime(self):
         self.build()
@@ -80,7 +78,6 @@ def test_change_signals_at_runtime(self):
 
     @skipIfWindows # no signal support
     @expectedFailureNetBSD
-    @llgs_test
     def test_default_signals_behavior(self):
         self.build()
         self.set_inferior_startup_launch()
@@ -93,7 +90,6 @@ def test_default_signals_behavior(self):
         self.expect_exit_code(0)
 
 
-    @llgs_test
     @skipUnlessPlatform(["linux", "android"])
     def test_support_q_pass_signals(self):
         self.build()


        


More information about the llvm-branch-commits mailing list