Skip to content

Commit 54a1c86

Browse files
committed
[lldb] Deduplicate more lldb-server tests
Use auto-generation of lldb-server&debugserver variants.
1 parent d9ba814 commit 54a1c86

File tree

5 files changed

+39
-195
lines changed

5 files changed

+39
-195
lines changed

lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
21
import gdbremote_testcase
32
from lldbsuite.test.decorators import *
43
from lldbsuite.test.lldbtest import *
54
from lldbsuite.test import lldbutil
65

7-
86
class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
97

108
mydir = TestBase.compute_mydir(__file__)
@@ -26,100 +24,34 @@ def vCont_supports_mode(self, mode, inferior_args=None):
2624
# Verify we support the given mode.
2725
self.assertTrue(mode in supported_vCont_modes)
2826

29-
def vCont_supports_c(self):
30-
self.vCont_supports_mode("c")
31-
32-
def vCont_supports_C(self):
33-
self.vCont_supports_mode("C")
34-
35-
def vCont_supports_s(self):
36-
self.vCont_supports_mode("s")
37-
38-
def vCont_supports_S(self):
39-
self.vCont_supports_mode("S")
40-
41-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
42-
@debugserver_test
43-
def test_vCont_supports_c_debugserver(self):
44-
self.build()
45-
self.vCont_supports_c()
46-
47-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
48-
@llgs_test
49-
def test_vCont_supports_c_llgs(self):
50-
self.build()
51-
self.vCont_supports_c()
52-
53-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
54-
@debugserver_test
55-
def test_vCont_supports_C_debugserver(self):
56-
self.build()
57-
self.vCont_supports_C()
5827

59-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
60-
@llgs_test
61-
def test_vCont_supports_C_llgs(self):
28+
def test_vCont_supports_c(self):
6229
self.build()
63-
self.vCont_supports_C()
64-
65-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
66-
@debugserver_test
67-
def test_vCont_supports_s_debugserver(self):
68-
self.build()
69-
self.vCont_supports_s()
70-
71-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
72-
@llgs_test
73-
def test_vCont_supports_s_llgs(self):
74-
self.build()
75-
self.vCont_supports_s()
30+
self.vCont_supports_mode("c")
7631

77-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
78-
@debugserver_test
79-
def test_vCont_supports_S_debugserver(self):
32+
def test_vCont_supports_C(self):
8033
self.build()
81-
self.vCont_supports_S()
34+
self.vCont_supports_mode("C")
8235

83-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
84-
@llgs_test
85-
def test_vCont_supports_S_llgs(self):
36+
def test_vCont_supports_s(self):
8637
self.build()
87-
self.vCont_supports_S()
38+
self.vCont_supports_mode("s")
8839

89-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
90-
@debugserver_test
91-
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver(
92-
self):
40+
def test_vCont_supports_S(self):
9341
self.build()
94-
self.set_inferior_startup_launch()
95-
self.single_step_only_steps_one_instruction(
96-
use_Hc_packet=True, step_instruction="vCont;s")
42+
self.vCont_supports_mode("S")
9743

9844
@skipIfWindows # No pty support to test O* & I* notification packets.
99-
@llgs_test
10045
@skipIf(triple='^mips')
101-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
102-
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self):
46+
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s(self):
10347
self.build()
10448
self.set_inferior_startup_launch()
10549
self.single_step_only_steps_one_instruction(
10650
use_Hc_packet=True, step_instruction="vCont;s")
10751

108-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
109-
@debugserver_test
110-
def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver(
111-
self):
112-
self.build()
113-
self.set_inferior_startup_launch()
114-
self.single_step_only_steps_one_instruction(
115-
use_Hc_packet=False, step_instruction="vCont;s:{thread}")
116-
11752
@skipIfWindows # No pty support to test O* & I* notification packets.
118-
@llgs_test
11953
@skipIf(triple='^mips')
120-
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
121-
def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs(
122-
self):
54+
def test_single_step_only_steps_one_instruction_with_vCont_s_thread(self):
12355
self.build()
12456
self.set_inferior_startup_launch()
12557
self.single_step_only_steps_one_instruction(
Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import json
32
import re
43

@@ -32,7 +31,12 @@ def start_threads(self, num):
3231
self.reset_test_sequence()
3332
return threads
3433

35-
def signal_one_thread(self):
34+
@skipUnlessPlatform(["netbsd"])
35+
@expectedFailureNetBSD
36+
def test_signal_one_thread(self):
37+
self.build()
38+
self.set_inferior_startup_launch()
39+
3640
threads = self.start_threads(1)
3741
# try sending a signal to one of the two threads
3842
self.test_sequence.add_log_lines([
@@ -44,22 +48,12 @@ def signal_one_thread(self):
4448
context = self.expect_gdbremote_sequence()
4549
self.assertIsNotNone(context)
4650

47-
@skipUnlessPlatform(["netbsd"])
48-
@debugserver_test
49-
def test_signal_one_thread_debugserver(self):
50-
self.build()
51-
self.set_inferior_startup_launch()
52-
self.signal_one_thread()
53-
5451
@skipUnlessPlatform(["netbsd"])
5552
@expectedFailureNetBSD
56-
@llgs_test
57-
def test_signal_one_thread_llgs(self):
53+
def test_signal_all_threads(self):
5854
self.build()
5955
self.set_inferior_startup_launch()
60-
self.signal_one_thread()
6156

62-
def signal_all_threads(self):
6357
threads = self.start_threads(1)
6458
# try sending a signal to two threads (= the process)
6559
self.test_sequence.add_log_lines([
@@ -73,21 +67,10 @@ def signal_all_threads(self):
7367
self.assertIsNotNone(context)
7468

7569
@skipUnlessPlatform(["netbsd"])
76-
@debugserver_test
77-
def test_signal_all_threads_debugserver(self):
70+
def test_signal_two_of_three_threads(self):
7871
self.build()
7972
self.set_inferior_startup_launch()
80-
self.signal_all_threads()
8173

82-
@skipUnlessPlatform(["netbsd"])
83-
@expectedFailureNetBSD
84-
@llgs_test
85-
def test_signal_all_threads_llgs(self):
86-
self.build()
87-
self.set_inferior_startup_launch()
88-
self.signal_all_threads()
89-
90-
def signal_two_of_three_threads(self):
9174
threads = self.start_threads(2)
9275
# try sending a signal to 2 out of 3 threads
9376
self.test_sequence.add_log_lines([
@@ -101,20 +84,10 @@ def signal_two_of_three_threads(self):
10184
self.assertIsNotNone(context)
10285

10386
@skipUnlessPlatform(["netbsd"])
104-
@debugserver_test
105-
def test_signal_two_of_three_threads_debugserver(self):
87+
def test_signal_two_signals(self):
10688
self.build()
10789
self.set_inferior_startup_launch()
108-
self.signal_two_of_three_threads()
10990

110-
@skipUnlessPlatform(["netbsd"])
111-
@llgs_test
112-
def test_signal_two_of_three_threads_llgs(self):
113-
self.build()
114-
self.set_inferior_startup_launch()
115-
self.signal_two_of_three_threads()
116-
117-
def signal_two_signals(self):
11891
threads = self.start_threads(1)
11992
# try sending two different signals to two threads
12093
self.test_sequence.add_log_lines([
@@ -126,17 +99,3 @@ def signal_two_signals(self):
12699

127100
context = self.expect_gdbremote_sequence()
128101
self.assertIsNotNone(context)
129-
130-
@skipUnlessPlatform(["netbsd"])
131-
@debugserver_test
132-
def test_signal_two_signals_debugserver(self):
133-
self.build()
134-
self.set_inferior_startup_launch()
135-
self.signal_two_signals()
136-
137-
@skipUnlessPlatform(["netbsd"])
138-
@llgs_test
139-
def test_signal_two_signals_llgs(self):
140-
self.build()
141-
self.set_inferior_startup_launch()
142-
self.signal_two_signals()
Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import gdbremote_testcase
42
import lldbgdbserverutils
53
import os
@@ -8,7 +6,6 @@
86
from lldbsuite.test.lldbtest import *
97
from lldbsuite.test import lldbutil
108

11-
129
class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
1310

1411
mydir = TestBase.compute_mydir(__file__)
@@ -27,53 +24,26 @@ def get_stub_sid(self, extra_stub_args=None):
2724
# Get the process id for the stub.
2825
return os.getsid(server.pid)
2926

30-
def sid_is_same_without_setsid(self):
31-
stub_sid = self.get_stub_sid()
32-
self.assertEqual(stub_sid, os.getsid(0))
33-
34-
def sid_is_different_with_setsid(self):
35-
stub_sid = self.get_stub_sid(["--setsid"])
36-
self.assertNotEqual(stub_sid, os.getsid(0))
37-
38-
def sid_is_different_with_S(self):
39-
stub_sid = self.get_stub_sid(["-S"])
40-
self.assertNotEqual(stub_sid, os.getsid(0))
41-
42-
@debugserver_test
43-
@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
44-
def test_sid_is_same_without_setsid_debugserver(self):
45-
self.set_inferior_startup_launch()
46-
self.sid_is_same_without_setsid()
47-
4827
@skipIfWindows
49-
@llgs_test
5028
@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
51-
def test_sid_is_same_without_setsid_llgs(self):
29+
def test_sid_is_same_without_setsid(self):
5230
self.set_inferior_startup_launch()
53-
self.sid_is_same_without_setsid()
5431

55-
@debugserver_test
56-
@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
57-
def test_sid_is_different_with_setsid_debugserver(self):
58-
self.set_inferior_startup_launch()
59-
self.sid_is_different_with_setsid()
32+
stub_sid = self.get_stub_sid()
33+
self.assertEqual(stub_sid, os.getsid(0))
6034

6135
@skipIfWindows
62-
@llgs_test
6336
@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
64-
def test_sid_is_different_with_setsid_llgs(self):
37+
def test_sid_is_different_with_setsid(self):
6538
self.set_inferior_startup_launch()
66-
self.sid_is_different_with_setsid()
6739

68-
@debugserver_test
69-
@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
70-
def test_sid_is_different_with_S_debugserver(self):
71-
self.set_inferior_startup_launch()
72-
self.sid_is_different_with_S()
40+
stub_sid = self.get_stub_sid(["--setsid"])
41+
self.assertNotEqual(stub_sid, os.getsid(0))
7342

7443
@skipIfWindows
75-
@llgs_test
7644
@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
7745
def test_sid_is_different_with_S_llgs(self):
7846
self.set_inferior_startup_launch()
79-
self.sid_is_different_with_S()
47+
48+
stub_sid = self.get_stub_sid(["-S"])
49+
self.assertNotEqual(stub_sid, os.getsid(0))
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
2-
31
import gdbremote_testcase
42
from lldbsuite.test.decorators import *
53
from lldbsuite.test.lldbtest import *
64
from lldbsuite.test import lldbutil
75

8-
96
class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase):
107
mydir = TestBase.compute_mydir(__file__)
118

12-
def inferior_abort_received(self):
9+
@skipIfWindows # No signal is sent on Windows.
10+
# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
11+
@expectedFailureAndroid(api_levels=list(range(16 + 1)))
12+
def test_inferior_abort_received_llgs(self):
13+
self.build()
14+
1315
procs = self.prep_debug_monitor_and_inferior(inferior_args=["abort"])
1416
self.assertIsNotNone(procs)
1517

@@ -27,16 +29,3 @@ def inferior_abort_received(self):
2729
self.assertIsNotNone(hex_exit_code)
2830
self.assertEqual(int(hex_exit_code, 16),
2931
lldbutil.get_signal_number('SIGABRT'))
30-
31-
@debugserver_test
32-
def test_inferior_abort_received_debugserver(self):
33-
self.build()
34-
self.inferior_abort_received()
35-
36-
@skipIfWindows # No signal is sent on Windows.
37-
@llgs_test
38-
# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
39-
@expectedFailureAndroid(api_levels=list(range(16 + 1)))
40-
def test_inferior_abort_received_llgs(self):
41-
self.build()
42-
self.inferior_abort_received()

lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
2-
31
import gdbremote_testcase
42
from lldbsuite.test.decorators import *
53
from lldbsuite.test.lldbtest import *
64
from lldbsuite.test import lldbutil
75

8-
96
class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):
107
mydir = TestBase.compute_mydir(__file__)
118

@@ -30,13 +27,10 @@ def inferior_seg_fault_received(self, expected_signo):
3027
self.assertIsNotNone(hex_exit_code)
3128
self.assertEqual(int(hex_exit_code, 16), expected_signo)
3229

33-
@debugserver_test
34-
def test_inferior_seg_fault_received_debugserver(self):
35-
self.build()
36-
self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS)
37-
3830
@skipIfWindows # No signal is sent on Windows.
39-
@llgs_test
40-
def test_inferior_seg_fault_received_llgs(self):
31+
def test_inferior_seg_fault_received(self):
4132
self.build()
42-
self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV'))
33+
if self.platformIsDarwin():
34+
self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS)
35+
else:
36+
self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV'))

0 commit comments

Comments
 (0)