|
5 | 5 | import dap_server |
6 | 6 | from lldbsuite.test.decorators import * |
7 | 7 | from lldbsuite.test.lldbtest import * |
8 | | -from lldbsuite.test import lldbutil |
9 | | -import lldbdap_testcase |
10 | | -import time |
11 | 8 | import os |
12 | 9 | import re |
| 10 | +import time |
| 11 | + |
| 12 | +import lldbdap_testcase |
| 13 | +from lldbsuite.test import lldbutil |
13 | 14 |
|
14 | 15 | # Many tests are skipped on Windows because get_stdout() returns None there. |
15 | 16 | # Despite the test program printing correctly. See |
@@ -100,6 +101,23 @@ def test_stopOnEntry(self): |
100 | 101 | reason, "breakpoint", 'verify stop isn\'t "main" breakpoint' |
101 | 102 | ) |
102 | 103 |
|
| 104 | + def test_empty_sourceMap(self): |
| 105 | + """ |
| 106 | + Tests the launch with empty source map should not issue source map command. |
| 107 | + """ |
| 108 | + program = self.getBuildArtifact("a.out") |
| 109 | + self.build_and_create_debug_adapter() |
| 110 | + empty_source_map = [] |
| 111 | + self.launch(program, sourceMap=empty_source_map) |
| 112 | + self.continue_to_exit() |
| 113 | + |
| 114 | + # Now get the console output and verify no source map command was issued for empty source map. |
| 115 | + console_output = self.get_console() |
| 116 | + self.assertTrue( |
| 117 | + console_output and len(console_output) > 0, "expect some console output" |
| 118 | + ) |
| 119 | + self.assertNotIn("Setting source map:", console_output) |
| 120 | + |
103 | 121 | @skipIfWindows |
104 | 122 | def test_cwd(self): |
105 | 123 | """ |
@@ -575,25 +593,28 @@ def test_version(self): |
575 | 593 |
|
576 | 594 | def test_session_id_update(self): |
577 | 595 | program = self.getBuildArtifact("a.out") |
578 | | - postRunCommands = ["script print('Actual_Session_ID: ' + str(os.getenv('VSCODE_DEBUG_SESSION_ID')))"] |
| 596 | + postRunCommands = [ |
| 597 | + "script print('Actual_Session_ID: ' + str(os.getenv('VSCODE_DEBUG_SESSION_ID')))" |
| 598 | + ] |
579 | 599 | self.build_and_launch( |
580 | | - program, |
581 | | - vscode_session_id="test_session_id", |
| 600 | + program, |
| 601 | + vscode_session_id="test_session_id", |
582 | 602 | postRunCommands=postRunCommands, |
583 | | - ) |
584 | | - output = self.get_console() |
| 603 | + ) |
| 604 | + output = self.get_console() |
585 | 605 | self.continue_to_exit() |
586 | | - lines = filter(lambda x: 'Actual_Session_ID' in x, output.splitlines()) |
| 606 | + lines = filter(lambda x: "Actual_Session_ID" in x, output.splitlines()) |
587 | 607 | self.assertTrue( |
588 | | - any("test_session_id" in l for l in lines), "expect session id in console output" |
| 608 | + any("test_session_id" in l for l in lines), |
| 609 | + "expect session id in console output", |
589 | 610 | ) |
590 | | - |
591 | | - def test_session_id_update_empty(self): |
| 611 | + |
| 612 | + def test_session_id_update_empty(self): |
592 | 613 | program = self.getBuildArtifact("a.out") |
593 | | - self.build_and_launch(program) |
594 | | - output = self.get_console() |
| 614 | + self.build_and_launch(program) |
| 615 | + output = self.get_console() |
595 | 616 | self.continue_to_exit() |
596 | 617 | self.assertTrue( |
597 | | - all("VSCODE_DEBUG_SESSION_ID" not in l for l in output.splitlines()), |
598 | | - "expect NO session id update command" |
| 618 | + all("VSCODE_DEBUG_SESSION_ID" not in l for l in output.splitlines()), |
| 619 | + "expect NO session id update command", |
599 | 620 | ) |
0 commit comments