9
9
import lldbdap_testcase
10
10
import time
11
11
import os
12
+ import re
12
13
13
14
14
15
class TestDAP_launch (lldbdap_testcase .DAPTestCaseBase ):
15
- @skipIfWindows
16
16
def test_default (self ):
17
17
"""
18
18
Tests the default launch of a simple program. No arguments,
@@ -27,7 +27,6 @@ def test_default(self):
27
27
lines = output .splitlines ()
28
28
self .assertIn (program , lines [0 ], "make sure program path is in first argument" )
29
29
30
- @skipIfWindows
31
30
def test_termination (self ):
32
31
"""
33
32
Tests the correct termination of lldb-dap upon a 'disconnect'
@@ -47,7 +46,6 @@ def test_termination(self):
47
46
# Check the return code
48
47
self .assertEqual (self .dap_server .process .poll (), 0 )
49
48
50
- @skipIfWindows
51
49
def test_stopOnEntry (self ):
52
50
"""
53
51
Tests the default launch of a simple program that stops at the
@@ -66,7 +64,6 @@ def test_stopOnEntry(self):
66
64
reason , "breakpoint" , 'verify stop isn\' t "main" breakpoint'
67
65
)
68
66
69
- @skipIfWindows
70
67
def test_cwd (self ):
71
68
"""
72
69
Tests the default launch of a simple program with a current working
@@ -92,15 +89,17 @@ def test_cwd(self):
92
89
)
93
90
self .assertTrue (found , "verified program working directory" )
94
91
95
- @skipIfWindows
96
92
def test_debuggerRoot (self ):
97
93
"""
98
94
Tests the "debuggerRoot" will change the working directory of
99
95
the lldb-dap debug adaptor.
100
96
"""
101
97
program = self .getBuildArtifact ("a.out" )
102
98
program_parent_dir = os .path .realpath (os .path .dirname (os .path .dirname (program )))
103
- commands = ["platform shell echo cwd = $PWD" ]
99
+
100
+ var = "%cd%" if lldbplatformutil .getHostPlatform () == "windows" else "$PWD"
101
+ commands = [f"platform shell echo cwd = { var } " ]
102
+
104
103
self .build_and_launch (
105
104
program , debuggerRoot = program_parent_dir , initCommands = commands
106
105
)
@@ -114,14 +113,13 @@ def test_debuggerRoot(self):
114
113
found = True
115
114
self .assertEqual (
116
115
program_parent_dir ,
117
- line [len (prefix ) :],
116
+ line . strip () [len (prefix ) :],
118
117
"lldb-dap working dir '%s' == '%s'"
119
- % (program_parent_dir , line [6 :]),
118
+ % (program_parent_dir , line [len ( prefix ) :]),
120
119
)
121
120
self .assertTrue (found , "verified lldb-dap working directory" )
122
121
self .continue_to_exit ()
123
122
124
- @skipIfWindows
125
123
def test_sourcePath (self ):
126
124
"""
127
125
Tests the "sourcePath" will set the target.source-map.
@@ -146,7 +144,6 @@ def test_sourcePath(self):
146
144
self .assertTrue (found , 'found "sourcePath" in console output' )
147
145
self .continue_to_exit ()
148
146
149
- @skipIfWindows
150
147
def test_disableSTDIO (self ):
151
148
"""
152
149
Tests the default launch of a simple program with STDIO disabled.
@@ -182,7 +179,6 @@ def test_shellExpandArguments_enabled(self):
182
179
quote_path , line , 'verify "%s" expanded to "%s"' % (glob , program )
183
180
)
184
181
185
- @skipIfWindows
186
182
def test_shellExpandArguments_disabled (self ):
187
183
"""
188
184
Tests the default launch of a simple program with shell expansion
@@ -204,7 +200,6 @@ def test_shellExpandArguments_disabled(self):
204
200
quote_path , line , 'verify "%s" stayed to "%s"' % (glob , glob )
205
201
)
206
202
207
- @skipIfWindows
208
203
def test_args (self ):
209
204
"""
210
205
Tests launch of a simple program with arguments
@@ -229,7 +224,6 @@ def test_args(self):
229
224
'arg[%i] "%s" not in "%s"' % (i + 1 , quoted_arg , lines [i ]),
230
225
)
231
226
232
- @skipIfWindows
233
227
def test_environment (self ):
234
228
"""
235
229
Tests launch of a simple program with environment variables
@@ -258,7 +252,6 @@ def test_environment(self):
258
252
found , '"%s" must exist in program environment (%s)' % (var , lines )
259
253
)
260
254
261
- @skipIfWindows
262
255
@skipIf (
263
256
archs = ["arm" , "aarch64" ]
264
257
) # failed run https://lab.llvm.org/buildbot/#/builders/96/builds/6933
@@ -344,7 +337,6 @@ def test_commands(self):
344
337
self .verify_commands ("exitCommands" , output , exitCommands )
345
338
self .verify_commands ("terminateCommands" , output , terminateCommands )
346
339
347
- @skipIfWindows
348
340
def test_extra_launch_commands (self ):
349
341
"""
350
342
Tests the "launchCommands" with extra launching settings
@@ -409,7 +401,6 @@ def test_extra_launch_commands(self):
409
401
output = self .get_console (timeout = lldbdap_testcase .DAPTestCaseBase .timeoutval )
410
402
self .verify_commands ("exitCommands" , output , exitCommands )
411
403
412
- @skipIfWindows
413
404
def test_failing_launch_commands (self ):
414
405
"""
415
406
Tests "launchCommands" failures prevents a launch.
@@ -418,7 +409,8 @@ def test_failing_launch_commands(self):
418
409
program = self .getBuildArtifact ("a.out" )
419
410
420
411
# Run an invalid launch command, in this case a bad path.
421
- launchCommands = ['!target create "/bad/path%s"' % (program )]
412
+ bad_path = os .path .join ("bad" , "path" )
413
+ launchCommands = ['!target create "%s%s"' % (bad_path , program )]
422
414
423
415
initCommands = ["target list" , "platform list" ]
424
416
preRunCommands = ["image list a.out" , "image dump sections a.out" ]
@@ -447,9 +439,8 @@ def test_failing_launch_commands(self):
447
439
# Verify all "launchCommands" were founc in console output
448
440
# The launch should fail due to the invalid command.
449
441
self .verify_commands ("launchCommands" , output , launchCommands )
450
- self .assertRegex (output , r"bad/path/ .*does not exist" )
442
+ self .assertRegex (output , re . escape ( bad_path ) + r" .*does not exist" )
451
443
452
- @skipIfWindows
453
444
@skipIfNetBSD # Hangs on NetBSD as well
454
445
@skipIf (archs = ["arm" , "aarch64" ], oslist = ["linux" ])
455
446
def test_terminate_commands (self ):
@@ -476,7 +467,6 @@ def test_terminate_commands(self):
476
467
)
477
468
self .verify_commands ("terminateCommands" , output , terminateCommands )
478
469
479
- @skipIfWindows
480
470
def test_version (self ):
481
471
"""
482
472
Tests that "initialize" response contains the "version" string the same
0 commit comments