service/dap: refactor the server into two layers (#2729)
* service/dap: refactor the server into two layers * Add delay before setting debugger in remote tests Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
This commit is contained in:
parent
6a282112cc
commit
dc2f615c9a
File diff suppressed because it is too large
Load Diff
@ -2808,7 +2808,7 @@ func TestHaltPreventsAutoResume(t *testing.T) {
|
|||||||
// Send a halt request when trying to resume the program after being
|
// Send a halt request when trying to resume the program after being
|
||||||
// interrupted. This should allow the log message to be processed,
|
// interrupted. This should allow the log message to be processed,
|
||||||
// but keep the process from continuing beyond the line.
|
// but keep the process from continuing beyond the line.
|
||||||
resumeOnceAndCheckStop = func(s *Server, command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) {
|
resumeOnceAndCheckStop = func(s *Session, command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) {
|
||||||
// This should trigger after the log message is sent, but before
|
// This should trigger after the log message is sent, but before
|
||||||
// execution is resumed.
|
// execution is resumed.
|
||||||
if command == api.DirectionCongruentContinue {
|
if command == api.DirectionCongruentContinue {
|
||||||
@ -5579,9 +5579,15 @@ func launchDebuggerWithTargetHalted(t *testing.T, fixture string) *debugger.Debu
|
|||||||
func runTestWithDebugger(t *testing.T, dbg *debugger.Debugger, test func(c *daptest.Client)) {
|
func runTestWithDebugger(t *testing.T, dbg *debugger.Debugger, test func(c *daptest.Client)) {
|
||||||
serverStopped := make(chan struct{})
|
serverStopped := make(chan struct{})
|
||||||
server, _ := startDapServer(t, serverStopped)
|
server, _ := startDapServer(t, serverStopped)
|
||||||
// TODO(polina): update once the server interface is refactored to take debugger as arg
|
|
||||||
server.debugger = dbg
|
|
||||||
client := daptest.NewClient(server.listener.Addr().String())
|
client := daptest.NewClient(server.listener.Addr().String())
|
||||||
|
time.Sleep(100 * time.Millisecond) // Give time for connection to be set as dap.Session
|
||||||
|
// TODO(polina): update once the server interface is refactored to take debugger as arg
|
||||||
|
server.sessionMu.Lock()
|
||||||
|
if server.session == nil {
|
||||||
|
t.Fatal("dap session is not ready")
|
||||||
|
}
|
||||||
|
server.session.debugger = dbg
|
||||||
|
server.sessionMu.Unlock()
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
client.InitializeRequest()
|
client.InitializeRequest()
|
||||||
client.ExpectInitializeResponseAndCapabilities(t)
|
client.ExpectInitializeResponseAndCapabilities(t)
|
||||||
|
Loading…
Reference in New Issue
Block a user