Skip to content

Commit a236601

Browse files
ono-maxko1
authored andcommitted
Make sure to fail when remote debuggee does not exit after scenarios
Because Errno::EPIPE is rescued while sending message to socket, protocol_test_case_test.rb does not pass. protocol_test_case_test.rb had been passed because ReaderThreadError was occurred and the debuggee process was still alive. Here is a scenario. After closing socket, terminated event was sent. However socket was closed, so debuggee process raised Errno::EPIPE and debugggee process was still alive. The test framework detected the status and failed. Thus I fixed so that the test framework does not kill the debuggee process unexpectedly.
1 parent 7b0c078 commit a236601

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/support/protocol_test_case.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,13 @@ def execute_dap_scenario scenario
335335
attach_to_dap_server
336336
scenario.call
337337
ensure
338-
@reader_thread&.kill
339-
@sock&.close
340338
kill_remote_debuggee test_info
341339
if name = test_info.failed_process
342340
flunk create_protocol_message "Expected the debuggee program to finish"
343341
end
342+
# Because the debuggee may be terminated by executing the following operations, we need to run them after `kill_remote_debuggee` method.
343+
@reader_thread&.kill
344+
@sock&.close
344345
end
345346

346347
def execute_cdp_scenario_ scenario
@@ -365,12 +366,13 @@ def execute_cdp_scenario_ scenario
365366
@crt_frames = res.dig(:params, :callFrames)
366367
scenario.call
367368
ensure
368-
@reader_thread&.kill
369-
@web_sock&.close
370369
kill_remote_debuggee test_info
371370
if name = test_info.failed_process
372371
flunk create_protocol_message "Expected the debuggee program to finish"
373372
end
373+
# Because the debuggee may be terminated by executing the following operations, we need to run them after `kill_remote_debuggee` method.
374+
@reader_thread&.kill
375+
@web_sock&.close
374376
end
375377

376378
def execute_cdp_scenario scenario

0 commit comments

Comments
 (0)