diff options
author | Siri Hansen <[email protected]> | 2016-06-01 15:04:09 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2016-06-01 15:04:09 +0200 |
commit | 77b6b9a3c5d044a832ba36f8683bbe88279d8c88 (patch) | |
tree | f0ee920f34102dcea446c94b5a52d2b19ac011ad /lib/common_test/test/telnet_server.erl | |
parent | d46e634b1c4ab0d88597c7bdff69a646a54f4477 (diff) | |
parent | 1964b89cb2ce66841467c15ea135e1ee1a292709 (diff) | |
download | otp-77b6b9a3c5d044a832ba36f8683bbe88279d8c88.tar.gz otp-77b6b9a3c5d044a832ba36f8683bbe88279d8c88.tar.bz2 otp-77b6b9a3c5d044a832ba36f8683bbe88279d8c88.zip |
Merge branch 'siri/cuddle-master'
* siri/cuddle-master:
Change ct:sleep to timer:sleep where scaling is not wanted
Don't generate ssh key files in netconf client test
Ignore data received in break mode in test telnet_server
Wait for process to die before next call
Retry ct_telnet:get_data if no data is received after short wait
Don't throw rest of line when NOP is received in test telnet_server
Change ct:sleep to timer:sleep in telnet_server
Diffstat (limited to 'lib/common_test/test/telnet_server.erl')
-rw-r--r-- | lib/common_test/test/telnet_server.erl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/common_test/test/telnet_server.erl b/lib/common_test/test/telnet_server.erl index 107d98d72c..2c33cb268a 100644 --- a/lib/common_test/test/telnet_server.erl +++ b/lib/common_test/test/telnet_server.erl @@ -59,7 +59,7 @@ init(Opts) -> accept(State), ok = gen_tcp:close(LSock), dbg("telnet_server closed the listen socket ~p\n", [LSock]), - ct:sleep(1000), + timer:sleep(1000), ok. listen(0, _Port, _Opts) -> @@ -68,7 +68,7 @@ listen(Retries, Port, Opts) -> case gen_tcp:listen(Port, Opts) of {error,eaddrinuse} -> dbg("Listen port not released, trying again..."), - ct:sleep(5000), + timer:sleep(5000), listen(Retries-1, Port, Opts); Ok = {ok,_LSock} -> Ok; @@ -193,6 +193,9 @@ handle_cmd([?AYT|T],State) -> %% Used when testing 'newline' option in ct_telnet:send and ct_telnet:cmd. send("yes\r\n> ",State), handle_data(T,State); +handle_cmd([?NOP|T],State) -> + %% Used for 'keep alive' + handle_data(T,State); handle_cmd([_H|T],State) -> %% Not responding to this command handle_cmd(T,State); @@ -203,6 +206,9 @@ handle_break_cmd([$q|T],State) -> %% Dummy cmd allowed in break mode - quit break mode send("\r\n> ",State), handle_data(T,State#state{break=false}); +handle_break_cmd([_H|T],State) -> + %% Unknown command i break mode - ignore + handle_break_cmd(T,State); handle_break_cmd([],State) -> {ok,State}. @@ -220,7 +226,7 @@ do_handle_data("echo_sep " ++ Data,State) -> Msgs = string:tokens(Data," "), lists:foreach(fun(Msg) -> send(Msg,State), - ct:sleep(10) + timer:sleep(10) end, Msgs), send("\r\n> ",State), {ok,State}; @@ -245,7 +251,7 @@ do_handle_data("echo_loop " ++ Data,State) -> do_handle_data("echo_delayed_prompt "++Data,State) -> [MsStr|EchoData] = string:tokens(Data, " "), send(string:join(EchoData,"\n"),State), - ct:sleep(list_to_integer(MsStr)), + timer:sleep(list_to_integer(MsStr)), send("\r\n> ",State), {ok,State}; do_handle_data("disconnect_after " ++WaitStr,State) -> @@ -298,7 +304,7 @@ send_loop(T0,T,Data,State) -> ok; true -> send(Data,State), - ct:sleep(500), + timer:sleep(500), send_loop(T0,T,Data,State) end. |