Skip to content

Commit

Permalink
Debug CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pguyot committed Nov 4, 2023
1 parent d115a1f commit 4c05bf5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/libs/estdlib/test_tcp_socket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@
-export([test/0]).

test() ->
erlang:display({?MODULE, ?LINE}),
ok = test_echo_server(),
erlang:display({?MODULE, ?LINE}),
ok = test_shutdown(),
erlang:display({?MODULE, ?LINE}),
ok = test_close_by_another_process(),
erlang:display({?MODULE, ?LINE}),
case get_otp_version() of
atomvm ->
ok = test_abandon_select();
_ ->
ok
end,
erlang:display({?MODULE, ?LINE}),
ok.

test_echo_server() ->
Expand All @@ -54,14 +59,20 @@ test_shutdown() ->
Port = 44404,
ListenSocket = start_echo_server(Port),

erlang:display({?MODULE, ?LINE}),
ok = test_shutdown_of_client_sockets(Port),
erlang:display({?MODULE, ?LINE}),

ok = close_listen_socket(ListenSocket).

test_shutdown_of_client_sockets(Port) ->
erlang:display({?MODULE, ?LINE}),
ok = test_shutdown_of_side(Port, write),
erlang:display({?MODULE, ?LINE}),
ok = test_shutdown_of_side(Port, read_write),
erlang:display({?MODULE, ?LINE}),
ok = test_shutdown_of_side(Port, read),
erlang:display({?MODULE, ?LINE}),
ok.

test_shutdown_of_side(Port, Side) ->
Expand Down Expand Up @@ -276,7 +287,9 @@ test_abandon_select() ->
test_close_by_another_process() ->
% socket:recv is blocking and the only way to interrupt it is to close
% the socket.
erlang:display({?MODULE, ?LINE}),
etest:flush_msg_queue(),
erlang:display({?MODULE, ?LINE}),

Port = 44404,
ListenSocket = start_echo_server(Port),
Expand All @@ -289,7 +302,9 @@ test_close_by_another_process() ->
ok = socket:close(ClientSocket1)
end),
% recv is blocking
erlang:display({?MODULE, ?LINE}),
{error, closed} = socket:recv(ClientSocket1, 0, 5000),
erlang:display({?MODULE, ?LINE}),

close_listen_socket(ListenSocket).

Expand Down

0 comments on commit 4c05bf5

Please sign in to comment.