Author: Pavel Labath Date: 2021-01-02T18:32:25+01:00 New Revision: 54a1c861ca7a9e15d23904e1e702ac7e868882b0
URL: https://github.com/llvm/llvm-project/commit/54a1c861ca7a9e15d23904e1e702ac7e868882b0 DIFF: https://github.com/llvm/llvm-project/commit/54a1c861ca7a9e15d23904e1e702ac7e868882b0.diff LOG: [lldb] Deduplicate more lldb-server tests Use auto-generation of lldb-server&debugserver variants. Added: Modified: lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py Removed: ################################################################################ diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py index e622932e19e0..6f12f8901666 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py @@ -1,10 +1,8 @@ - import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -26,100 +24,34 @@ def vCont_supports_mode(self, mode, inferior_args=None): # Verify we support the given mode. self.assertTrue(mode in supported_vCont_modes) - def vCont_supports_c(self): - self.vCont_supports_mode("c") - - def vCont_supports_C(self): - self.vCont_supports_mode("C") - - def vCont_supports_s(self): - self.vCont_supports_mode("s") - - def vCont_supports_S(self): - self.vCont_supports_mode("S") - - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_vCont_supports_c_debugserver(self): - self.build() - self.vCont_supports_c() - - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @llgs_test - def test_vCont_supports_c_llgs(self): - self.build() - self.vCont_supports_c() - - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_vCont_supports_C_debugserver(self): - self.build() - self.vCont_supports_C() - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @llgs_test - def test_vCont_supports_C_llgs(self): + def test_vCont_supports_c(self): self.build() - self.vCont_supports_C() - - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_vCont_supports_s_debugserver(self): - self.build() - self.vCont_supports_s() - - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @llgs_test - def test_vCont_supports_s_llgs(self): - self.build() - self.vCont_supports_s() + self.vCont_supports_mode("c") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_vCont_supports_S_debugserver(self): + def test_vCont_supports_C(self): self.build() - self.vCont_supports_S() + self.vCont_supports_mode("C") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @llgs_test - def test_vCont_supports_S_llgs(self): + def test_vCont_supports_s(self): self.build() - self.vCont_supports_S() + self.vCont_supports_mode("s") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver( - self): + def test_vCont_supports_S(self): self.build() - self.set_inferior_startup_launch() - self.single_step_only_steps_one_instruction( - use_Hc_packet=True, step_instruction="vCont;s") + self.vCont_supports_mode("S") @skipIfWindows # No pty support to test O* & I* notification packets. - @llgs_test @skipIf(triple='^mips') - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self): + def test_single_step_only_steps_one_instruction_with_Hc_vCont_s(self): self.build() self.set_inferior_startup_launch() self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="vCont;s") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - @debugserver_test - def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver( - self): - self.build() - self.set_inferior_startup_launch() - self.single_step_only_steps_one_instruction( - use_Hc_packet=False, step_instruction="vCont;s:{thread}") - @skipIfWindows # No pty support to test O* & I* notification packets. - @llgs_test @skipIf(triple='^mips') - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") - def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs( - self): + def test_single_step_only_steps_one_instruction_with_vCont_s_thread(self): self.build() self.set_inferior_startup_launch() self.single_step_only_steps_one_instruction( diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py b/lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py index 1fe781039b3f..5278d59fb06a 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py @@ -1,4 +1,3 @@ - import json import re @@ -32,7 +31,12 @@ def start_threads(self, num): self.reset_test_sequence() return threads - def signal_one_thread(self): + @skipUnlessPlatform(["netbsd"]) + @expectedFailureNetBSD + def test_signal_one_thread(self): + self.build() + self.set_inferior_startup_launch() + threads = self.start_threads(1) # try sending a signal to one of the two threads self.test_sequence.add_log_lines([ @@ -44,22 +48,12 @@ def signal_one_thread(self): context = self.expect_gdbremote_sequence() self.assertIsNotNone(context) - @skipUnlessPlatform(["netbsd"]) - @debugserver_test - def test_signal_one_thread_debugserver(self): - self.build() - self.set_inferior_startup_launch() - self.signal_one_thread() - @skipUnlessPlatform(["netbsd"]) @expectedFailureNetBSD - @llgs_test - def test_signal_one_thread_llgs(self): + def test_signal_all_threads(self): self.build() self.set_inferior_startup_launch() - self.signal_one_thread() - def signal_all_threads(self): threads = self.start_threads(1) # try sending a signal to two threads (= the process) self.test_sequence.add_log_lines([ @@ -73,21 +67,10 @@ def signal_all_threads(self): self.assertIsNotNone(context) @skipUnlessPlatform(["netbsd"]) - @debugserver_test - def test_signal_all_threads_debugserver(self): + def test_signal_two_of_three_threads(self): self.build() self.set_inferior_startup_launch() - self.signal_all_threads() - @skipUnlessPlatform(["netbsd"]) - @expectedFailureNetBSD - @llgs_test - def test_signal_all_threads_llgs(self): - self.build() - self.set_inferior_startup_launch() - self.signal_all_threads() - - def signal_two_of_three_threads(self): threads = self.start_threads(2) # try sending a signal to 2 out of 3 threads self.test_sequence.add_log_lines([ @@ -101,20 +84,10 @@ def signal_two_of_three_threads(self): self.assertIsNotNone(context) @skipUnlessPlatform(["netbsd"]) - @debugserver_test - def test_signal_two_of_three_threads_debugserver(self): + def test_signal_two_signals(self): self.build() self.set_inferior_startup_launch() - self.signal_two_of_three_threads() - @skipUnlessPlatform(["netbsd"]) - @llgs_test - def test_signal_two_of_three_threads_llgs(self): - self.build() - self.set_inferior_startup_launch() - self.signal_two_of_three_threads() - - def signal_two_signals(self): threads = self.start_threads(1) # try sending two diff erent signals to two threads self.test_sequence.add_log_lines([ @@ -126,17 +99,3 @@ def signal_two_signals(self): context = self.expect_gdbremote_sequence() self.assertIsNotNone(context) - - @skipUnlessPlatform(["netbsd"]) - @debugserver_test - def test_signal_two_signals_debugserver(self): - self.build() - self.set_inferior_startup_launch() - self.signal_two_signals() - - @skipUnlessPlatform(["netbsd"]) - @llgs_test - def test_signal_two_signals_llgs(self): - self.build() - self.set_inferior_startup_launch() - self.signal_two_signals() diff --git a/lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py b/lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py index 21005b6a6b64..8a001191a391 100644 --- a/lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py +++ b/lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py @@ -1,5 +1,3 @@ - - import gdbremote_testcase import lldbgdbserverutils import os @@ -8,7 +6,6 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -27,53 +24,26 @@ def get_stub_sid(self, extra_stub_args=None): # Get the process id for the stub. return os.getsid(server.pid) - def sid_is_same_without_setsid(self): - stub_sid = self.get_stub_sid() - self.assertEqual(stub_sid, os.getsid(0)) - - def sid_is_ diff erent_with_setsid(self): - stub_sid = self.get_stub_sid(["--setsid"]) - self.assertNotEqual(stub_sid, os.getsid(0)) - - def sid_is_ diff erent_with_S(self): - stub_sid = self.get_stub_sid(["-S"]) - self.assertNotEqual(stub_sid, os.getsid(0)) - - @debugserver_test - @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target - def test_sid_is_same_without_setsid_debugserver(self): - self.set_inferior_startup_launch() - self.sid_is_same_without_setsid() - @skipIfWindows - @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target - def test_sid_is_same_without_setsid_llgs(self): + def test_sid_is_same_without_setsid(self): self.set_inferior_startup_launch() - self.sid_is_same_without_setsid() - @debugserver_test - @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target - def test_sid_is_ diff erent_with_setsid_debugserver(self): - self.set_inferior_startup_launch() - self.sid_is_ diff erent_with_setsid() + stub_sid = self.get_stub_sid() + self.assertEqual(stub_sid, os.getsid(0)) @skipIfWindows - @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target - def test_sid_is_ diff erent_with_setsid_llgs(self): + def test_sid_is_ diff erent_with_setsid(self): self.set_inferior_startup_launch() - self.sid_is_ diff erent_with_setsid() - @debugserver_test - @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target - def test_sid_is_ diff erent_with_S_debugserver(self): - self.set_inferior_startup_launch() - self.sid_is_ diff erent_with_S() + stub_sid = self.get_stub_sid(["--setsid"]) + self.assertNotEqual(stub_sid, os.getsid(0)) @skipIfWindows - @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target def test_sid_is_ diff erent_with_S_llgs(self): self.set_inferior_startup_launch() - self.sid_is_ diff erent_with_S() + + stub_sid = self.get_stub_sid(["-S"]) + self.assertNotEqual(stub_sid, os.getsid(0)) diff --git a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py index 7df73ce4cbce..95f552822dfc 100644 --- a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -1,15 +1,17 @@ - - import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) - def inferior_abort_received(self): + @skipIfWindows # No signal is sent on Windows. + # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 + @expectedFailureAndroid(api_levels=list(range(16 + 1))) + def test_inferior_abort_received_llgs(self): + self.build() + procs = self.prep_debug_monitor_and_inferior(inferior_args=["abort"]) self.assertIsNotNone(procs) @@ -27,16 +29,3 @@ def inferior_abort_received(self): self.assertIsNotNone(hex_exit_code) self.assertEqual(int(hex_exit_code, 16), lldbutil.get_signal_number('SIGABRT')) - - @debugserver_test - def test_inferior_abort_received_debugserver(self): - self.build() - self.inferior_abort_received() - - @skipIfWindows # No signal is sent on Windows. - @llgs_test - # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 - @expectedFailureAndroid(api_levels=list(range(16 + 1))) - def test_inferior_abort_received_llgs(self): - self.build() - self.inferior_abort_received() diff --git a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py index 7a018bfd7f86..6bcf7f0860e5 100644 --- a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py +++ b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py @@ -1,11 +1,8 @@ - - import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -30,13 +27,10 @@ def inferior_seg_fault_received(self, expected_signo): self.assertIsNotNone(hex_exit_code) self.assertEqual(int(hex_exit_code, 16), expected_signo) - @debugserver_test - def test_inferior_seg_fault_received_debugserver(self): - self.build() - self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS) - @skipIfWindows # No signal is sent on Windows. - @llgs_test - def test_inferior_seg_fault_received_llgs(self): + def test_inferior_seg_fault_received(self): self.build() - self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV')) + if self.platformIsDarwin(): + self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS) + else: + self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV')) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits