File 0235-ssh-Misc-testcase-fixes.patch of Package erlang
From 97ff3d25f8c43bf5ae228e1260cb5b9ba13db08f Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Tue, 22 Dec 2020 16:40:38 +0100
Subject: [PATCH] ssh: Misc testcase fixes
---
.../property_test/ssh_eqc_client_server.erl | 4 ++--
lib/ssh/test/ssh_echo_server.erl | 1 +
lib/ssh/test/ssh_options_SUITE.erl | 22 +++++++++----------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/lib/ssh/test/property_test/ssh_eqc_client_server.erl b/lib/ssh/test/property_test/ssh_eqc_client_server.erl
index 66a79c8a17..4bfc23d5ff 100644
--- a/lib/ssh/test/property_test/ssh_eqc_client_server.erl
+++ b/lib/ssh/test/property_test/ssh_eqc_client_server.erl
@@ -287,7 +287,7 @@ client_loop() ->
client_loop()
end.
-do(Pid, Fun) -> do(Pid, Fun, 30?sec).
+do(Pid, Fun) -> do(Pid, Fun, 60?sec).
do(Pid, Fun, Timeout) when is_function(Fun,0) ->
Pid ! {please_do,Fun,Ref=make_ref(),self()},
@@ -418,7 +418,7 @@ ssh_send(C=#chan{conn_ref=ConnectionRef, ref=ChannelRef, client_pid=Pid}, Type,
ok ->
receive
{ssh_cm,ConnectionRef,{data,ChannelRef,Type,Answer}} -> Answer
- after 15?sec ->
+ after 30?sec ->
%% receive
%% Other -> {error,{unexpected,Other}}
%% after 0 ->
diff --git a/lib/ssh/test/ssh_echo_server.erl b/lib/ssh/test/ssh_echo_server.erl
index e039439f87..0e2519fc84 100644
--- a/lib/ssh/test/ssh_echo_server.erl
+++ b/lib/ssh/test/ssh_echo_server.erl
@@ -57,6 +57,7 @@ handle_ssh_msg({ssh_cm, CM, {data, ChannelId, 0, Data}}, #state{n = N} = State)
case M > 0 of
true ->
?DBG(State, "ssh_cm data Cid=~p size(Data)=~p M=~p",[ChannelId,size(Data),M]),
+ ssh_connection:adjust_window(CM, ChannelId, size(Data)),
ssh_connection:send(CM, ChannelId, Data),
{ok, State#state{n = M}};
false ->
diff --git a/lib/ssh/test/ssh_options_SUITE.erl b/lib/ssh/test/ssh_options_SUITE.erl
index 1dbfb0249b..09b1c7ccbb 100644
--- a/lib/ssh/test/ssh_options_SUITE.erl
+++ b/lib/ssh/test/ssh_options_SUITE.erl
@@ -1446,14 +1446,14 @@ try_to_connect(Connect, Host, Port, Pid, Tref, N) ->
%%--------------------------------------------------------------------
max_sessions_drops_tcp_connects() ->
- [{timetrap,{minutes,5}}].
+ [{timetrap,{minutes,20}}].
max_sessions_drops_tcp_connects(Config) ->
MaxSessions = 20,
UseSessions = 2, % Must be =< MaxSessions
FloodSessions = 1000,
ParallelLogin = true,
- NegTimeOut = 10*1000,
+ NegTimeOut = 8*1000,
HelloTimeOut = 1*1000,
%% Start a test daemon
@@ -1470,8 +1470,8 @@ max_sessions_drops_tcp_connects(Config) ->
{max_sessions, MaxSessions}
]),
Host = ssh_test_lib:mangle_connect_address(Host0),
- ct:log("~p Listen ~p:~p for max ~p sessions. Mangled Host = ~p",
- [Pid,Host0,Port,MaxSessions,Host]),
+ ct:log("~p:~p ~p Listen ~p:~p for max ~p sessions. Mangled Host = ~p",
+ [?MODULE,?LINE,Pid,Host0,Port,MaxSessions,Host]),
%% Log in UseSessions connections
SSHconnect = fun(N) ->
@@ -1482,7 +1482,7 @@ max_sessions_drops_tcp_connects(Config) ->
{user, "carni"},
{password, "meat"}
]),
- ct:log("~p: ssh:connect -> ~p", [N,R]),
+ ct:log("~p:~p ~p: ssh:connect -> ~p", [?MODULE,?LINE,N,R]),
R
end,
@@ -1491,18 +1491,18 @@ max_sessions_drops_tcp_connects(Config) ->
UseSessions ->
%% As expected
%% Try gen_tcp:connect
- [ct:log("~p: gen_tcp:connect -> ~p",
- [N, gen_tcp:connect(Host, Port, [])])
+ [ct:log("~p:~p ~p: gen_tcp:connect -> ~p",
+ [?MODULE,?LINE, N, gen_tcp:connect(Host, Port, [])])
|| N <- lists:seq(UseSessions+1, MaxSessions)
],
- ct:log("Now try ~p gen_tcp:connect to be rejected", [FloodSessions]),
- [ct:log("~p: gen_tcp:connect -> ~p",
- [N, gen_tcp:connect(Host, Port, [])])
+ ct:log("~p:~p Now try ~p gen_tcp:connect to be rejected", [?MODULE,?LINE,FloodSessions]),
+ [ct:log("~p:~p ~p: gen_tcp:connect -> ~p",
+ [?MODULE,?LINE, N, gen_tcp:connect(Host, Port, [])])
|| N <- lists:seq(MaxSessions+1, MaxSessions+1+FloodSessions)
],
- ct:log("try ~p ssh:connect", [MaxSessions - UseSessions]),
+ ct:log("~p:~p try ~p ssh:connect", [?MODULE,?LINE, MaxSessions - UseSessions]),
try_ssh_connect(MaxSessions - UseSessions, NegTimeOut, SSHconnect);
Len1 ->
--
2.26.2