From d4d7231a24c697085ddf89fcdfac506b7e732e5c Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Wed, 17 Sep 2014 09:36:15 +0200 Subject: ssh: Avoid timeout of init_per_test_case on some platforms Also some code cleanup --- lib/ssh/test/ssh_connection_SUITE.erl | 12 ++++++------ lib/ssh/test/ssh_to_openssh_SUITE.erl | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl index c115ccee5f..c52b91986b 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -302,7 +302,7 @@ start_shell(Config) when is_list(Config) -> ok = ssh_connection:shell(ConnectionRef,ChannelId0), receive - {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"Enter command\r\n">>}} -> + {ssh_cm, ConnectionRef, {data, _ChannelId, 0, <<"Enter command\r\n">>}} -> ok after 5000 -> ct:fail("CLI Timeout") @@ -335,8 +335,8 @@ start_shell_exec(Config) when is_list(Config) -> success = ssh_connection:exec(ConnectionRef, ChannelId0, "testing", infinity), receive - {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"testing\r\n">>}} -> - ok + {ssh_cm, ConnectionRef, {data, _ChannelId, 0, <<"testing\r\n">>}} -> + ok after 5000 -> ct:fail("Exec Timeout") end, @@ -370,8 +370,8 @@ start_shell_exec_fun(Config) when is_list(Config) -> "testing", infinity), receive - {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"testing\r\n">>}} -> - ok + {ssh_cm, ConnectionRef, {data, _ChannelId, 0, <<"testing\r\n">>}} -> + ok after 5000 -> ct:fail("Exec Timeout") end, diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl index 3500bf012b..35179adf28 100644 --- a/lib/ssh/test/ssh_to_openssh_SUITE.erl +++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -564,4 +564,7 @@ check_ssh_client_support2(P) -> check_ssh_client_support2(P); {P, {exit_status, E}} -> E + after 5000 -> + ct:pal("Openssh command timed out ~n"), + -1 end. -- cgit v1.2.3 From e00e62392040ddc328cd0581b4743a4edebe25ab Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 19 Sep 2014 22:26:30 +0200 Subject: ssh: Avoid windows wierdness --- lib/ssh/test/ssh_to_openssh_SUITE.erl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl index 35179adf28..41fbd324c4 100644 --- a/lib/ssh/test/ssh_to_openssh_SUITE.erl +++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl @@ -119,15 +119,7 @@ erlang_shell_client_openssh_server(Config) when is_list(Config) -> IO ! {input, self(), "echo Hej\n"}, receive_hej(), IO ! {input, self(), "exit\n"}, - receive - <<"logout">> -> - receive - <<"Connection closed">> -> - ok - end; - Other0 -> - ct:fail({unexpected_msg, Other0}) - end, + receive_logout(), receive {'EXIT', Shell, normal} -> ok; @@ -544,6 +536,21 @@ receive_hej() -> receive_hej() end. +receive_logout() -> + receive + <<"logout">> -> + receive + <<"Connection closed">> -> + ok + end; + <<"TERM environment variable not set.\n">> -> %% Windows work around + receive_logout(); + Other0 -> + ct:fail({unexpected_msg, Other0}) + end. + + + %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% Check if we have a "newer" ssh client that supports these test cases -- cgit v1.2.3