summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2020-06-12 10:38:23 +0200
committerHans Nilsson <hans@erlang.org>2020-06-16 11:44:25 +0200
commit6a9bdc8572459d33610217bbba63cdffb67313d0 (patch)
tree4bd4d091abaf10594af99cd159df36efeeb15b38
parent560fc726d6079b64a8d27e10d2466a187bccf3e4 (diff)
downloaderlang-6a9bdc8572459d33610217bbba63cdffb67313d0.tar.gz
ssh: Testcase for encode/decode of pty_opts
-rw-r--r--lib/ssh/test/ssh_connection_SUITE.erl28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl
index c4621723f6..5faa2808fb 100644
--- a/lib/ssh/test/ssh_connection_SUITE.erl
+++ b/lib/ssh/test/ssh_connection_SUITE.erl
@@ -63,6 +63,7 @@ all() ->
start_exec_direct_fun1_read_write_advanced,
start_shell_sock_exec_fun,
start_shell_sock_daemon_exec,
+ encode_decode_pty_opts,
connect_sock_not_tcp,
daemon_sock_not_tcp,
gracefull_invalid_version,
@@ -343,6 +344,33 @@ send_after_exit(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
+encode_decode_pty_opts(_Config) ->
+ Tags =
+ [vintr, vquit, verase, vkill, veof, veol, veol2, vstart, vstop, vsusp, vdsusp,
+ vreprint, vwerase, vlnext, vflush, vswtch, vstatus, vdiscard, ignpar, parmrk,
+ inpck, istrip, inlcr, igncr, icrnl, iuclc, ixon, ixany, ixoff, imaxbel, isig,
+ icanon, xcase, echo, echoe, echok, echonl, noflsh, tostop, iexten, echoctl,
+ echoke, pendin, opost, olcuc, onlcr, ocrnl, onocr, onlret, cs7, cs8, parenb,
+ parodd, tty_op_ispeed, tty_op_ospeed],
+ Opts =
+ lists:zip(Tags,
+ lists:seq(1, length(Tags))),
+
+ case ssh_connection:encode_pty_opts(Opts) of
+ Bin when is_binary(Bin) ->
+ case ssh_connection:decode_pty_opts(Bin) of
+ Opts ->
+ ok;
+ Other ->
+ ct:log("Expected ~p~nGot ~p~nBin = ~p",[Opts,Other,Bin]),
+ ct:fail("Not the same",[])
+ end;
+ Other ->
+ ct:log("encode -> ~p",[Other]),
+ ct:fail("Encode failed",[])
+ end.
+
+%%--------------------------------------------------------------------
ptty_alloc_default() ->
[{doc, "Test sending PTTY alloc message with only defaults."}].