Skip to content

Commit

Permalink
test: fix some compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed Feb 19, 2024
1 parent 2707e8e commit a6fb990
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/quicer_server_conn_callback.erl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ new_stream(
ok ->
{ok, CBState#{streams := [{StreamOwner, Stream} | Streams]}};
{error, _} = E ->
{stop, {shutdown, handoff}, CBState}
{stop, {shutdown, {handoff, E}, CBState}}
end;
Other ->
Other
Expand Down
4 changes: 2 additions & 2 deletions test/example_server_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
-include("quicer.hrl").
-include_lib("snabbkaffe/include/snabbkaffe.hrl").

init_handoff(Stream, StreamOpts, Conn, #{flags := Flags}) ->
init_handoff(Stream, _StreamOpts, Conn, #{flags := Flags}) ->
InitState = #{
stream => Stream,
conn => Conn,
peer_stream => undefined,
is_local => false,
is_unidir => quicer:is_unidirectional(Flags)
},
% ct:pal("init_handoff ~p", [{InitState, StreamOpts}]),
% ct:pal("init_handoff ~p", [{InitState, _StreamOpts}]),
{ok, InitState}.

post_handoff(Stream, _PostData, State) ->
Expand Down
4 changes: 2 additions & 2 deletions test/prop_quicer_nif.erl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ prop_listen_robust() ->
%% precondition: with valid listener handle
prop_start_listener_with_valid_handle() ->
?FORALL(
{#prop_handle{type = listener, handle = Handle, destructor = Destroy} = H, On, Opts},
{#prop_handle{type = listener, handle = Handle, destructor = Destroy}, On, Opts},
{valid_listen_handle(), listen_on(), quicer_listen_opts()},
begin
case quicer_nif:start_listener(Handle, On, maps:from_list(Opts)) of
Expand Down Expand Up @@ -373,7 +373,7 @@ prop_csend_with_valid_opts() ->
begin
SOpts = maps:from_list(Opts),
case quicer_nif:csend(ConnHandle, Data, SOpts, Flags) of
{ok, StreamHandle} ->
{ok, _StreamHandle} ->
Destroy(),
collect(ok, true);
{error, closed} ->
Expand Down
2 changes: 1 addition & 1 deletion test/prop_stateful_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ next_state(#{state := connected} = State, _Res, {call, quicer, close_connection,
next_state(#{state := connected} = State, _Res, {call, quicer, shutdown_connection, _Args}) ->
State#{state := closed};
next_state(
#{state := connected, handle := H} = State, ok, {call, quicer, controlling_process, [_, Owner]}
#{state := connected} = State, ok, {call, quicer, controlling_process, [_, Owner]}
) ->
State#{owner := Owner};
next_state(State, _Res, {call, _Mod, _Fun, _Args}) ->
Expand Down
39 changes: 22 additions & 17 deletions test/quicer_listener_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ end_per_group(_GroupName, _Config) ->
%% @end
%%--------------------------------------------------------------------
init_per_testcase(tc_listener_conf_reload_listen_on_neg, Config) ->
{skip, "MacOs is able to listen on port 1"};
case os:type() of
{unix, darwin} -> {skip, "Not runnable on MacOS"};
_ -> Config
end;
init_per_testcase(_TestCase, Config) ->
application:ensure_all_started(quicer),
quicer_test_lib:cleanup_msquic(),
Expand Down Expand Up @@ -542,11 +545,12 @@ tc_listener_conf_reload(Config) ->
),
{ok, _} = quicer:send(Stream2, <<"ping_from_conn_2">>),

receive
{quic, new_stream, Stream2Remote, #{is_orphan := true}} ->
quicer:setopt(Stream2Remote, active, true),
ok
end,
Stream2Remote =
receive
{quic, new_stream, Stream2R, #{is_orphan := true}} ->
quicer:setopt(Stream2R, active, true),
Stream2R
end,

receive
{quic, <<"ping_from_conn_2">>, Stream2Remote, _} -> ok
Expand Down Expand Up @@ -623,12 +627,12 @@ tc_listener_conf_reload_listen_on(Config) ->
),
{ok, _} = quicer:send(Stream2, <<"ping_from_conn_2">>),

receive
{quic, new_stream, Stream2Remote, #{is_orphan := true}} ->
quicer:setopt(Stream2Remote, active, true),
ok
end,

Stream2Remote =
receive
{quic, new_stream, Stream2R, #{is_orphan := true}} ->
quicer:setopt(Stream2R, active, true),
Stream2R
end,
receive
{quic, <<"ping_from_conn_2">>, Stream2Remote, _} -> ok
after 2000 ->
Expand Down Expand Up @@ -705,11 +709,12 @@ tc_listener_conf_reload_listen_on_neg(Config) ->
),
{ok, _} = quicer:send(Stream2, <<"ping_from_conn_2">>),

receive
{quic, new_stream, Stream2Remote, #{is_orphan := true}} ->
quicer:setopt(Stream2Remote, active, true),
ok
end,
Stream2Remote =
receive
{quic, new_stream, Stream2R, #{is_orphan := true}} ->
quicer:setopt(Stream2R, active, true),
Stream2R
end,

receive
{quic, <<"ping_from_conn_2">>, Stream2Remote, _} -> ok
Expand Down
3 changes: 2 additions & 1 deletion test/quicer_prop_gen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
valid_csend_stream_opts/0,
pid/0,
data/0,
quicer_send_flags/0
quicer_send_flags/0,
latin1_string/0
]).

-include_lib("proper/include/proper.hrl").
Expand Down

0 comments on commit a6fb990

Please sign in to comment.