aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_basic_SUITE.erl
diff options
context:
space:
mode:
authorSvilen Ivanov <[email protected]>2016-09-19 14:58:48 +0300
committerSvilen Ivanov <[email protected]>2016-09-19 15:56:06 +0300
commit27d3d5c6f6ddd51dc27d684b613c8c261f19a82f (patch)
tree6c0ffc886f0e0bd97e0fb248f1ecc45099f69299 /lib/ssh/test/ssh_basic_SUITE.erl
parentfde238fb52133a6c7a2a3f2a2e16f1c1bef62394 (diff)
downloadotp-27d3d5c6f6ddd51dc27d684b613c8c261f19a82f.tar.gz
otp-27d3d5c6f6ddd51dc27d684b613c8c261f19a82f.tar.bz2
otp-27d3d5c6f6ddd51dc27d684b613c8c261f19a82f.zip
Add SSH custom REPL exit status test
Test that when used defined shell REPL exit with reason normal SSH client receives exit status 0.
Diffstat (limited to 'lib/ssh/test/ssh_basic_SUITE.erl')
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl33
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index d52d453007..51e0d5196b 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -67,7 +67,8 @@
shell_unicode_string/1,
ssh_info_print/1,
key_callback/1,
- key_callback_options/1
+ key_callback_options/1,
+ shell_exit_status/1
]).
%%% Common test callbacks
@@ -106,7 +107,8 @@ all() ->
multi_daemon_opt_fd,
packet_size_zero,
ssh_info_print,
- {group, login_bad_pwd_no_retry}
+ {group, login_bad_pwd_no_retry},
+ shell_exit_status
].
groups() ->
@@ -1167,6 +1169,33 @@ login_bad_pwd_no_retry(Config, AuthMethods) ->
end
end.
+
+%%----------------------------------------------------------------------------
+%%% Test that when shell REPL exit with reason normal client receives status 0
+shell_exit_status(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ SystemDir = proplists:get_value(data_dir, Config),
+ UserDir = proplists:get_value(priv_dir, Config),
+
+ ShellFun = fun (_User) -> spawn(fun() -> ok end) end,
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
+ {user_dir, UserDir},
+ {user_passwords, [{"vego", "morot"}]},
+ {shell, ShellFun},
+ {failfun, fun ssh_test_lib:failfun/2}]),
+ ConnectionRef =
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
+ {user_dir, UserDir},
+ {user, "vego"},
+ {password, "morot"},
+ {user_interaction, false}]),
+
+ {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
+ ok = ssh_connection:shell(ConnectionRef, ChannelId),
+ ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId),
+ ssh:stop_daemon(Pid).
+
+
%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------
%%--------------------------------------------------------------------