Skip to content

Commit 17e812f

Browse files
committed
Re-enable and update tests
1 parent 7441ea0 commit 17e812f

20 files changed

+54
-52
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ def request_attach(
591591
attachCommands=None,
592592
terminateCommands=None,
593593
coreFile=None,
594+
stopOnAttach=True,
594595
postRunCommands=None,
595596
sourceMap=None,
596597
gdbRemotePort=None,
@@ -620,6 +621,8 @@ def request_attach(
620621
args_dict["attachCommands"] = attachCommands
621622
if coreFile:
622623
args_dict["coreFile"] = coreFile
624+
if stopOnAttach:
625+
args_dict["stopOnEntry"] = stopOnAttach
623626
if postRunCommands:
624627
args_dict["postRunCommands"] = postRunCommands
625628
if sourceMap:
@@ -666,10 +669,6 @@ def request_configurationDone(self):
666669
response = self.send_recv(command_dict)
667670
if response:
668671
self.configuration_done_sent = True
669-
# Client requests the baseline of currently existing threads after
670-
# a successful launch or attach.
671-
# Kick off the threads request that follows
672-
self.request_threads()
673672
return response
674673

675674
def _process_stopped(self):
@@ -1325,6 +1324,26 @@ def attach_options_specified(options):
13251324

13261325
def run_vscode(dbg, args, options):
13271326
dbg.request_initialize(options.sourceInitFile)
1327+
1328+
if options.sourceBreakpoints:
1329+
source_to_lines = {}
1330+
for file_line in options.sourceBreakpoints:
1331+
(path, line) = file_line.split(":")
1332+
if len(path) == 0 or len(line) == 0:
1333+
print('error: invalid source with line "%s"' % (file_line))
1334+
1335+
else:
1336+
if path in source_to_lines:
1337+
source_to_lines[path].append(int(line))
1338+
else:
1339+
source_to_lines[path] = [int(line)]
1340+
for source in source_to_lines:
1341+
dbg.request_setBreakpoints(source, source_to_lines[source])
1342+
if options.funcBreakpoints:
1343+
dbg.request_setFunctionBreakpoints(options.funcBreakpoints)
1344+
1345+
dbg.request_configurationDone()
1346+
13281347
if attach_options_specified(options):
13291348
response = dbg.request_attach(
13301349
program=options.program,
@@ -1353,23 +1372,6 @@ def run_vscode(dbg, args, options):
13531372
)
13541373

13551374
if response["success"]:
1356-
if options.sourceBreakpoints:
1357-
source_to_lines = {}
1358-
for file_line in options.sourceBreakpoints:
1359-
(path, line) = file_line.split(":")
1360-
if len(path) == 0 or len(line) == 0:
1361-
print('error: invalid source with line "%s"' % (file_line))
1362-
1363-
else:
1364-
if path in source_to_lines:
1365-
source_to_lines[path].append(int(line))
1366-
else:
1367-
source_to_lines[path] = [int(line)]
1368-
for source in source_to_lines:
1369-
dbg.request_setBreakpoints(source, source_to_lines[source])
1370-
if options.funcBreakpoints:
1371-
dbg.request_setFunctionBreakpoints(options.funcBreakpoints)
1372-
dbg.request_configurationDone()
13731375
dbg.wait_for_stopped()
13741376
else:
13751377
if "message" in response:

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

+4
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def attach(
333333
exitCommands=None,
334334
attachCommands=None,
335335
coreFile=None,
336+
stopOnAttach=True,
336337
disconnectAutomatically=True,
337338
terminateCommands=None,
338339
postRunCommands=None,
@@ -357,6 +358,7 @@ def cleanup():
357358
self.addTearDownHook(cleanup)
358359
# Initialize and launch the program
359360
self.dap_server.request_initialize(sourceInitFile)
361+
self.dap_server.request_configurationDone()
360362
response = self.dap_server.request_attach(
361363
program=program,
362364
pid=pid,
@@ -369,6 +371,7 @@ def cleanup():
369371
attachCommands=attachCommands,
370372
terminateCommands=terminateCommands,
371373
coreFile=coreFile,
374+
stopOnAttach=stopOnAttach,
372375
postRunCommands=postRunCommands,
373376
sourceMap=sourceMap,
374377
gdbRemotePort=gdbRemotePort,
@@ -427,6 +430,7 @@ def cleanup():
427430

428431
# Initialize and launch the program
429432
self.dap_server.request_initialize(sourceInitFile)
433+
self.dap_server.request_configurationDone()
430434
response = self.dap_server.request_launch(
431435
program,
432436
args=args,

lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ def spawn_and_wait(program, delay):
2525
process.wait()
2626

2727

28-
@skipIf
2928
class TestDAP_attach(lldbdap_testcase.DAPTestCaseBase):
3029
def set_and_hit_breakpoint(self, continueToExit=True):
30+
self.dap_server.wait_for_stopped()
31+
3132
source = "main.c"
3233
breakpoint1_line = line_number(source, "// breakpoint 1")
3334
lines = [breakpoint1_line]

lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
import socket
2020

2121

22-
@skip
2322
class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase):
2423
default_timeout = 20
2524

2625
def set_and_hit_breakpoint(self, continueToExit=True):
26+
self.dap_server.wait_for_stopped()
27+
2728
source = "main.c"
28-
main_source_path = os.path.join(os.getcwd(), source)
29-
breakpoint1_line = line_number(main_source_path, "// breakpoint 1")
29+
breakpoint1_line = line_number(source, "// breakpoint 1")
3030
lines = [breakpoint1_line]
3131
# Set breakpoint in the thread function so we can step the threads
32-
breakpoint_ids = self.set_source_breakpoints(main_source_path, lines)
32+
breakpoint_ids = self.set_source_breakpoints(source, lines)
3333
self.assertEqual(
3434
len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
3535
)

lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import lldbdap_testcase
1212
import os
1313

14-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
15-
@skip
14+
1615
class TestDAP_breakpointLocations(lldbdap_testcase.DAPTestCaseBase):
1716
def setUp(self):
1817
lldbdap_testcase.DAPTestCaseBase.setUp(self)

lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import lldbdap_testcase
1212
import os
1313

14-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
15-
@skip
14+
1615
class TestDAP_setBreakpoints(lldbdap_testcase.DAPTestCaseBase):
1716
def setUp(self):
1817
lldbdap_testcase.DAPTestCaseBase.setUp(self)

lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from lldbsuite.test import lldbtest, lldbutil
66
from lldbsuite.test.decorators import *
77

8-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
9-
@skip
8+
109
class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
1110
def test_command_directive_quiet_on_success(self):
1211
program = self.getBuildArtifact("a.out")

lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def verify_completions(self, actual_list, expected_list, not_expected_list=[]):
4444
self.assertNotIn(not_expected_item, actual_list)
4545

4646

47-
def setup_debugee(self):
47+
def setup_debugee(self, stopOnEntry=False):
4848
program = self.getBuildArtifact("a.out")
49-
self.build_and_launch(program)
49+
self.build_and_launch(program, stopOnEntry=stopOnEntry)
5050

5151
source = "main.cpp"
5252
breakpoint1_line = line_number(source, "// breakpoint 1")
@@ -235,7 +235,7 @@ def test_auto_completions(self):
235235
"""
236236
Tests completion requests in "repl-mode=auto"
237237
"""
238-
self.setup_debugee()
238+
self.setup_debugee(stopOnEntry=True)
239239

240240
res = self.dap_server.request_evaluate(
241241
"`lldb-dap repl-mode auto", context="repl"

lldb/test/API/tools/lldb-dap/console/TestDAP_console.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_exit_status_message_ok(self):
167167

168168
def test_diagnositcs(self):
169169
program = self.getBuildArtifact("a.out")
170-
self.build_and_launch(program)
170+
self.build_and_launch(program, stopOnEntry=True)
171171

172172
core = self.getBuildArtifact("minidump.core")
173173
self.yaml2obj("minidump.yaml", core)

lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import lldbdap_testcase
1111
import os
1212

13-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
14-
@skip
13+
1514
class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
1615
@skipIfWindows
1716
def test_disassemble(self):

lldb/test/API/tools/lldb-dap/disconnect/TestDAP_disconnect.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ def test_launch(self):
3131
created.
3232
"""
3333
program = self.getBuildArtifact("a.out")
34-
self.build_and_launch(program, disconnectAutomatically=False)
34+
self.build_and_launch(program, stopOnEntry=True, disconnectAutomatically=False)
3535

3636
# We set a breakpoint right before the side effect file is created
3737
self.set_source_breakpoints(
3838
self.source, [line_number(self.source, "// breakpoint")]
3939
)
4040
self.continue_to_next_stop()
4141

42+
# verify we haven't produced the side effect file yet
43+
self.assertFalse(os.path.exists(program + ".side_effect"))
44+
4245
self.dap_server.request_disconnect()
46+
4347
# verify we didn't produce the side effect file
4448
time.sleep(1)
4549
self.assertFalse(os.path.exists(program + ".side_effect"))

lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from lldbsuite.test.decorators import *
1111
from lldbsuite.test.lldbtest import *
1212

13-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
14-
@skip
13+
1514
class TestDAP_evaluate(lldbdap_testcase.DAPTestCaseBase):
1615
def assertEvaluate(self, expression, regex):
1716
self.assertRegex(

lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def test_stopOnEntry(self):
8888
"""
8989
program = self.getBuildArtifact("a.out")
9090
self.build_and_launch(program, stopOnEntry=True)
91-
self.set_function_breakpoints(["main"])
92-
stopped_events = self.continue_to_next_stop()
91+
92+
stopped_events = self.dap_server.wait_for_stopped()
9393
for stopped_event in stopped_events:
9494
if "body" in stopped_event:
9595
body = stopped_event["body"]

lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import lldbdap_testcase
1111
import os
1212

13-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
14-
@skip
13+
1514
class TestDAP_memory(lldbdap_testcase.DAPTestCaseBase):
1615
def test_memory_refs_variables(self):
1716
"""

lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def verify_progress_events(
5050
@skipIfWindows
5151
def test(self):
5252
program = self.getBuildArtifact("a.out")
53-
self.build_and_launch(program)
53+
self.build_and_launch(program, stopOnEntry=True)
5454
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
5555
self.dap_server.request_evaluate(
5656
f"`command script import {progress_emitter}", context="repl"

lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def assertEvaluate(self, expression, regex):
2020

2121
def test_completions(self):
2222
program = self.getBuildArtifact("a.out")
23-
self.build_and_launch(program)
23+
self.build_and_launch(program, stopOnEntry=True)
2424

2525
source = "main.cpp"
2626
breakpoint1_line = line_number(source, "// breakpoint 1")

lldb/test/API/tools/lldb-dap/restart/TestDAP_restart.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def test_basic_functionality(self):
2222
[bp_A, bp_B] = self.set_source_breakpoints("main.c", [line_A, line_B])
2323

2424
# Verify we hit A, then B.
25-
self.dap_server.request_configurationDone()
2625
self.verify_breakpoint_hit([bp_A])
2726
self.dap_server.request_continue()
2827
self.verify_breakpoint_hit([bp_B])

lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def test_stopOnEntry(self):
7474
program = self.getBuildArtifact("a.out")
7575
self.build_and_launch(program, runInTerminal=True, stopOnEntry=True)
7676
[bp_main] = self.set_function_breakpoints(["main"])
77-
self.dap_server.request_configurationDone()
7877

7978
# When using stopOnEntry, configurationDone doesn't result in a running
8079
# process, we should immediately get a stopped event instead.

lldb/test/API/tools/lldb-dap/stop-hooks/TestDAP_stop_hooks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_stop_hooks_before_run(self):
1919
self.build_and_launch(program, stopOnEntry=True, preRunCommands=preRunCommands)
2020

2121
# The first stop is on entry.
22-
self.continue_to_next_stop()
22+
self.dap_server.wait_for_stopped()
2323

2424
breakpoint_ids = self.set_function_breakpoints(["main"])
2525
# This request hangs if the race happens, because, in that case, the

lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def make_buffer_verify_dict(start_idx, count, offset=0):
1717
verify_dict["[%i]" % (i)] = {"type": "int", "value": str(i + offset)}
1818
return verify_dict
1919

20-
# DAP tests are flakey, see https://github.com/llvm/llvm-project/issues/137660.
21-
@skip
20+
2221
class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
2322
def verify_values(self, verify_dict, actual, varref_dict=None, expression=None):
2423
if "equals" in verify_dict:

0 commit comments

Comments
 (0)