[lldb] Deduplicate more lldb-server tests

Use auto-generation of lldb-server&debugserver variants.
This commit is contained in:
Pavel Labath 2020-12-27 15:01:37 +01:00
parent d9ba8142c9
commit 54a1c861ca
5 changed files with 46 additions and 202 deletions

View File

@ -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 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
# Verify we support the given mode.
self.assertTrue(mode in supported_vCont_modes)
def vCont_supports_c(self):
def test_vCont_supports_c(self):
self.build()
self.vCont_supports_mode("c")
def vCont_supports_C(self):
def test_vCont_supports_C(self):
self.build()
self.vCont_supports_mode("C")
def vCont_supports_s(self):
def test_vCont_supports_s(self):
self.build()
self.vCont_supports_mode("s")
def vCont_supports_S(self):
def test_vCont_supports_S(self):
self.build()
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):
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()
@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()
@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):
@skipIfWindows # No pty support to test O* & I* notification packets.
@skipIf(triple='^mips')
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")
@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):
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(

View File

@ -1,4 +1,3 @@
import json
import re
@ -32,7 +31,12 @@ class TestGdbRemote_vContThreads(gdbremote_testcase.GdbRemoteTestCaseBase):
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 @@ class TestGdbRemote_vContThreads(gdbremote_testcase.GdbRemoteTestCaseBase):
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 @@ class TestGdbRemote_vContThreads(gdbremote_testcase.GdbRemoteTestCaseBase):
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 @@ class TestGdbRemote_vContThreads(gdbremote_testcase.GdbRemoteTestCaseBase):
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 different signals to two threads
self.test_sequence.add_log_lines([
@ -126,17 +99,3 @@ class TestGdbRemote_vContThreads(gdbremote_testcase.GdbRemoteTestCaseBase):
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()

View File

@ -1,5 +1,3 @@
import gdbremote_testcase
import lldbgdbserverutils
import os
@ -8,7 +6,6 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@ -27,53 +24,26 @@ class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
# Get the process id for the stub.
return os.getsid(server.pid)
def sid_is_same_without_setsid(self):
@skipIfWindows
@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(self):
self.set_inferior_startup_launch()
stub_sid = self.get_stub_sid()
self.assertEqual(stub_sid, os.getsid(0))
def sid_is_different_with_setsid(self):
@skipIfWindows
@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_different_with_setsid(self):
self.set_inferior_startup_launch()
stub_sid = self.get_stub_sid(["--setsid"])
self.assertNotEqual(stub_sid, os.getsid(0))
def sid_is_different_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):
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_different_with_setsid_debugserver(self):
self.set_inferior_startup_launch()
self.sid_is_different_with_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_different_with_setsid_llgs(self):
self.set_inferior_startup_launch()
self.sid_is_different_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_different_with_S_debugserver(self):
self.set_inferior_startup_launch()
self.sid_is_different_with_S()
@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_different_with_S_llgs(self):
self.set_inferior_startup_launch()
self.sid_is_different_with_S()
stub_sid = self.get_stub_sid(["-S"])
self.assertNotEqual(stub_sid, os.getsid(0))

View File

@ -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 @@ class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase):
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()

View File

@ -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 @@ class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):
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'))