2
2
Test lldb-dap setBreakpoints request
3
3
"""
4
4
5
-
6
5
import dap_server
7
6
from lldbsuite .test .decorators import *
8
7
from lldbsuite .test .lldbtest import *
@@ -398,7 +397,7 @@ def test_extra_launch_commands(self):
398
397
# Verify all "preRunCommands" were found in console output
399
398
self .verify_commands ("preRunCommands" , output , preRunCommands )
400
399
401
- # Verify all "launchCommands" were founc in console output
400
+ # Verify all "launchCommands" were found in console output
402
401
# After execution, program should launch
403
402
self .verify_commands ("launchCommands" , output , launchCommands )
404
403
# Verify the "stopCommands" here
@@ -420,6 +419,47 @@ def test_extra_launch_commands(self):
420
419
output = self .get_console (timeout = 1.0 )
421
420
self .verify_commands ("exitCommands" , output , exitCommands )
422
421
422
+ @skipIfWindows
423
+ @skipIfRemote
424
+ def test_failing_launch_commands (self ):
425
+ """
426
+ Tests "launchCommands" failures prevents a launch.
427
+ """
428
+ self .build_and_create_debug_adaptor ()
429
+ program = self .getBuildArtifact ("a.out" )
430
+
431
+ # Run an invalid launch command, in this case a bad path.
432
+ launchCommands = ['!target create "/bad/path%s"' % (program )]
433
+
434
+ initCommands = ["target list" , "platform list" ]
435
+ preRunCommands = ["image list a.out" , "image dump sections a.out" ]
436
+ response = self .launch (
437
+ program ,
438
+ initCommands = initCommands ,
439
+ preRunCommands = preRunCommands ,
440
+ launchCommands = launchCommands ,
441
+ expectFailure = True ,
442
+ )
443
+
444
+ self .assertFalse (response ["success" ])
445
+ self .assertRegex (
446
+ response ["message" ],
447
+ r"Failed to run launch commands\. See the Debug Console for more details" ,
448
+ )
449
+
450
+ # Get output from the console. This should contain both the
451
+ # "initCommands" and the "preRunCommands".
452
+ output = self .get_console ()
453
+ # Verify all "initCommands" were found in console output
454
+ self .verify_commands ("initCommands" , output , initCommands )
455
+ # Verify all "preRunCommands" were found in console output
456
+ self .verify_commands ("preRunCommands" , output , preRunCommands )
457
+
458
+ # Verify all "launchCommands" were founc in console output
459
+ # The launch should fail due to the invalid command.
460
+ self .verify_commands ("launchCommands" , output , launchCommands )
461
+ self .assertRegex (output , r"unable to find executable for '/bad/path/" )
462
+
423
463
@skipIfWindows
424
464
@skipIfNetBSD # Hangs on NetBSD as well
425
465
@skipIf (archs = ["arm" , "aarch64" ], oslist = ["linux" ])
0 commit comments