-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update protocol tests #720
Conversation
ae686fa
to
fc42542
Compare
fc42542
to
7de6f3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments.
8b1d13f
to
3e909f2
Compare
3229bac
to
19c98f8
Compare
end | ||
sleep 0.001 while @reader_thread.status != 'sleep' | ||
@reader_thread.run | ||
INITIALIZE_CDP_MSGS.each{|msg| send(**msg)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the following lines here.
https://github.com/ruby/debug/blob/master/test/support/protocol_test_case.rb#L415-L416
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for adding this here is as follows:
- call
attach_to_cdp_server
directory. - call something that uses @crt_frames
- @crt_frames is not the latest frame because it may be changed every time 'Debugger.paused' is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Debugger.paused
is only returned at the first connection?
Loaded suite test/protocol/disconnect_cdp_test
Started
start initial attach
{:id=>2, :result=>{}}
{:method=>"Runtime.executionContextCreated", :params=>{:context=>{:id=>"eae712537be02fa944b64faad339a2ab", :origin=>"http://127.0.0.1:63585", :name=>""}}}
{:id=>3, :result=>{}}
{:id=>4, :result=>{}}
{:id=>8, :result=>{}}
{:method=>"Debugger.scriptParsed", :params=>{:scriptId=>"1", :url=>"/private/var/folders/yg/hnbymwxd5pn7v94_clc59y6r0000gn/T/debug-20221106-84811-rdzgps.rb", :startLine=>0, :startColumn=>0, :endLine=>12, :endColumn=>0, :executionContextId=>1, :hash=>"2195685978487654025"}}
{:method=>"Debugger.paused", :params=>{:reason=>"other", :callFrames=>[{:callFrameId=>"0fb3aefabd50b783487268956071f58c", :functionName=>"<main>", :functionLocation=>{:lineNumber=>0, :scriptId=>"1"}, :location=>{:lineNumber=>0, :scriptId=>"1"}, :url=>"/private/var/folders/yg/hnbymwxd5pn7v94_clc59y6r0000gn/T/debug-20221106-84811-rdz
gps.rb", :scopeChain=>[{:type=>"local", :object=>{:type=>"object", :objectId=>"0.449851775437477"}}, {:type=>"script", :object=>{:type=>"object", :objectId=>"0.07042992169684925"}}, {:type=>"global", :object=>{:type=>"object", :objectId=>"0.7769977982489024"}}], :this=>{:type=>"object"}}]}}
end initial attach
disconnected
start second attach
{:id=>2, :result=>{}}
{:method=>"Runtime.executionContextCreated", :params=>{:context=>{:id=>"bfb3534d760e52e0db4d88a84ea031a4", :origin=>"http://127.0.0.1:63585", :name=>""}}}
{:id=>3, :result=>{}}
{:id=>4, :result=>{}}
{:id=>8, :result=>{}}
F
=============================================================================================================================================================================================================================================================================================================================================
Failure: test_closing_cdp_connection_doesnt_kill_the_debuggee(DEBUGGER__::DisconnectCDPTest):
That's why I didn't move those 2 lines as it'll break reconnected cases like test/protocol/disconnect_cdp_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, seriously? Thank you for checking it. I'll also check it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the behavior, and you are right. Also, because I noticed that this behavior is a bug, I need to fix it, too.
I can notice this bug thanks to your reporting. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's OK with you, could you write comments somewhere as follows?
TODO: Support reattaching in Chrome DevTools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. But should I also remove the reattaching part from test/protocol/disconnect_cdp_test.rb
as it's actually not working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But should I also remove the reattaching part from test/protocol/disconnect_cdp_test.rb as it's actually not working?
If you can, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that we still need to reattach to the CDP server in disconnection test because we need to terminate it. But I added the comment right above the attaching call so others can understand that's not how actual reattaching works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I think that this PR looks good to me 👍 Thank you for your great work! |
19c98f8
to
8559e3c
Compare
Please remain this test because user can push the restart button on the VSCode. |
@ko1 The test actually doesn't test restart but just termination: debug/test/protocol/restart_test.rb Lines 12 to 16 in 1ecb014
|
Sorry, using
def req_restart
case get_target_ui
when 'vscode'
send_dap_request 'terminate', restart: true
end
end
WDYT? |
@ono-max If we currently only support |
Ok, so how about this one? we define |
After some testing, I think DAP's restart actually doesn't work. DAP.restart.not.working.movThe last DAP request is:
Based on the specification, if we're not supporting the restart request yet (commented out), we need to emulate the restarting behavior by starting a new debuggee manually in the server. And we can see that DAP server currently doesn't handle the Lines 354 to 371 in 1ecb014
So it appears that we actually don't support restart yet? If it's confirmed, I can convert this comment into an issue for the feature. |
8559e3c
to
7777b48
Compare
Now "launch" mode "Restart Debug" command (from menu) seems working. The spec https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect doesn't say anything I think.
|
Yes but we can't cover this case atm because we can only test attach mode in protocol tests. This means the current test tries to test a feature we're not supporting yet. And it is passing because it actually just test disconnection, which we already covered in other tests. That's why I want to delete that test. |
7777b48
to
6e7ad33
Compare
ok I merge it. |
This PR doesn't fix the flaky tests because
send_dap_request
still waits for the response ofdisconnect
request. But that request is not deterministic as the debugger can execute thekill!
command (and exit) before returning the response. I hope #721 can address the issue.