Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
test:

runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
ruby-version: ['2.6', '2.7', '3.0', '3.1', 'head', 'debug']
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
test:

runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
ruby-version: ['2.6', '2.7', '3.0', '3.1', 'head', 'debug']
Expand Down
2 changes: 1 addition & 1 deletion test/support/cdp_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def exchange_cdp_message msgs
flunk create_protocol_message"TIMEOUT ERROR (#{TIMEOUT_SEC} sec) while waiting for the following response.\n#{JSON.pretty_generate target_msg}"
ensure
@reader_thread.kill
@web_sock.cleanup
@web_sock.close
@remote_info.reader_thread.kill
@remote_info.r.close
@remote_info.w.close
Expand Down
28 changes: 14 additions & 14 deletions test/support/protocol_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def req_terminate_debuggee
send_cdp_request 'Runtime.terminateExecution'
end

cleanup_reader
close_reader
end

def assert_reattach
Expand Down Expand Up @@ -291,11 +291,11 @@ def execute_dap_scenario scenario

flunk create_protocol_message "Expected the debuggee program to finish" unless wait_pid @remote_info.pid, TIMEOUT_SEC
ensure
@reader_thread.kill
@sock.close if @sock
@remote_info.reader_thread.kill
@remote_info.r.close
@remote_info.w.close
@reader_thread&.kill
@sock&.close
@remote_info&.reader_thread&.kill
@remote_info&.r&.close
@remote_info&.w&.close
end

def execute_cdp_scenario scenario
Expand All @@ -316,11 +316,11 @@ def execute_cdp_scenario scenario

flunk create_protocol_message "Expected the debuggee program to finish" unless wait_pid @remote_info.pid, TIMEOUT_SEC
ensure
@reader_thread.kill
@web_sock.cleanup if @web_sock
@remote_info.reader_thread.kill
@remote_info.r.close
@remote_info.w.close
@reader_thread&.kill
@web_sock&.close
@remote_info&.reader_thread&.kill
@remote_info&.r&.close
@remote_info&.w&.close
end

def req_disconnect
Expand All @@ -333,7 +333,7 @@ def req_disconnect
@web_sock.send_close_connection
end

cleanup_reader
close_reader
end

def req_set_breakpoints_on_dap
Expand All @@ -360,14 +360,14 @@ def req_set_breakpoints_on_dap
}
end

def cleanup_reader
def close_reader
@reader_thread.raise Detach

case ENV['RUBY_DEBUG_TEST_UI']
when 'vscode'
@sock.close
when 'chrome'
@web_sock.cleanup
@web_sock.close
end
end

Expand Down
8 changes: 4 additions & 4 deletions test/support/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def send_close_connection
@sock.print frame.pack 'c*'
end

def cleanup
def close
@sock.close
end
end
Expand Down Expand Up @@ -361,7 +361,7 @@ def cleanup
method: "Debugger.setBlackboxPatterns",
params: {
patterns: [

]
}
},
Expand All @@ -378,15 +378,15 @@ def initialize
@result = []
@keys = []
end

def parse objs
objs.each{|k, v|
parse_ k, v
@keys.pop
}
@result
end

def parse_ k, v
@keys << k
case v
Expand Down
12 changes: 9 additions & 3 deletions test/support/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,10 @@ def manual_debug_code(program)
write_temp_file(strip_line_num(program))
remote_info = setup_unix_domain_socket_remote_debuggee

while !File.exist?(remote_info.sock_path)
sleep 0.1
Timeout.timeout(TIMEOUT_SEC) do
while !File.exist?(remote_info.sock_path)
sleep 0.1
end
end

DEBUGGER__::Client.new([socket_path]).connect
Expand Down Expand Up @@ -335,7 +337,11 @@ def setup_unix_domain_socket_remote_debuggee
sock_path = DEBUGGER__.create_unix_domain_socket_name + "-#{$ruby_debug_test_num += 1}"
remote_info = setup_remote_debuggee("#{RDBG_EXECUTABLE} -O --sock-path=#{sock_path} #{temp_file_path}")
remote_info.sock_path = sock_path
sleep 0.1 while !File.exist?(sock_path) && Process.kill(0, remote_info.pid)

Timeout.timeout(TIMEOUT_SEC) do
sleep 0.1 while !File.exist?(sock_path) && Process.kill(0, remote_info.pid)
end

remote_info
end

Expand Down