diff options
author | Hans Nilsson <[email protected]> | 2016-05-25 14:51:55 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2016-06-07 15:41:28 +0200 |
commit | ab95786ce0dc29f330de6e0c3565a30948ba799b (patch) | |
tree | 3609ce8b6f3840372d69865e84640fb08450fc9c /lib/ssh/test/ssh_connection_SUITE.erl | |
parent | a39395d4f99aff99ac57ab40a3191fa13a7371fd (diff) | |
download | otp-ab95786ce0dc29f330de6e0c3565a30948ba799b.tar.gz otp-ab95786ce0dc29f330de6e0c3565a30948ba799b.tar.bz2 otp-ab95786ce0dc29f330de6e0c3565a30948ba799b.zip |
ssh: logging in test helper ssh_echo_server
Diffstat (limited to 'lib/ssh/test/ssh_connection_SUITE.erl')
-rw-r--r-- | lib/ssh/test/ssh_connection_SUITE.erl | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl index a52633a269..a6e2f0fba9 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -366,19 +366,21 @@ interrupted_send(Config) -> UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth file:make_dir(UserDir), SysDir = proplists:get_value(data_dir, Config), + EchoSS_spec = {ssh_echo_server, [4000000,[{dbg,true}]]}, {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, {user_dir, UserDir}, {password, "morot"}, - {subsystems, [{"echo_n", {ssh_echo_server, [4000000]}}]}]), - + {subsystems, [{"echo_n",EchoSS_spec}]}]), + + ct:log("connect", []), ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, {user, "foo"}, {password, "morot"}, {user_interaction, false}, {user_dir, UserDir}]), - + ct:log("connected", []), {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - + ct:log("start subsystem", []), success = ssh_connection:subsystem(ConnectionRef, ChannelId, "echo_n", infinity), %% build 10MB binary @@ -388,15 +390,21 @@ interrupted_send(Config) -> <<ExpectedData:4000000/binary, _/binary>> = Data, %% pre-adjust receive window so the other end doesn't block + ct:log("adjust window", []), ssh_connection:adjust_window(ConnectionRef, ChannelId, size(ExpectedData) + 1), + ct:log("going to send ~p bytes", [size(Data)]), case ssh_connection:send(ConnectionRef, ChannelId, Data, 10000) of {error, closed} -> + ct:log("{error,closed} - That's what we expect :)", []), ok; Msg -> + ct:log("Got ~p - that's bad, very bad indeed",[Msg]), ct:fail({expected,{error,closed}, got, Msg}) end, + ct:log("going to receive data", []), receive_data(ExpectedData, ConnectionRef, ChannelId), + ct:log("back from receive data", []), ssh:close(ConnectionRef), ssh:stop_daemon(Pid). @@ -860,15 +868,21 @@ receive_data(ExpectedData, ConnectionRef, ChannelId) -> ExpectedData = collect_data(ConnectionRef, ChannelId). collect_data(ConnectionRef, ChannelId) -> - collect_data(ConnectionRef, ChannelId, []). + ct:pal("Listener ~p running!",[self()]), + collect_data(ConnectionRef, ChannelId, [], 0). -collect_data(ConnectionRef, ChannelId, Acc) -> +collect_data(ConnectionRef, ChannelId, Acc, Sum) -> receive {ssh_cm, ConnectionRef, {data, ChannelId, 0, Data}} -> - collect_data(ConnectionRef, ChannelId, [Data | Acc]); + ct:pal("collect_data: received ~p bytes. total ~p bytes",[size(Data),Sum+size(Data)]), + collect_data(ConnectionRef, ChannelId, [Data | Acc], Sum+size(Data)); {ssh_cm, ConnectionRef, {eof, ChannelId}} -> - iolist_to_binary(lists:reverse(Acc)) + ct:pal("collect_data: received eof",[]), + R = iolist_to_binary(lists:reverse(Acc)), + ct:pal("Got in total ~p bytes",[size(R)]), + R after 5000 -> + ct:pal("collect_data: timeout",[]), timeout end. |