diff options
author | Siri Hansen <[email protected]> | 2013-05-15 12:09:36 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2013-05-17 11:47:26 +0200 |
commit | 55d975b3a1266d50b5a55004a004d0f244d5a17b (patch) | |
tree | 5f82e8d4e9478f409616f72b5ae3718c2e446044 /lib/common_test/test/telnet_server.erl | |
parent | 61641a3e1d86014ce6e6a27ab27faac7ec461d70 (diff) | |
download | otp-55d975b3a1266d50b5a55004a004d0f244d5a17b.tar.gz otp-55d975b3a1266d50b5a55004a004d0f244d5a17b.tar.bz2 otp-55d975b3a1266d50b5a55004a004d0f244d5a17b.zip |
[common_test] Add new option 'no_prompt_check' to ct_telnet:expect/3.
If this option is used, ct_telnet will not search for a prompt before
attempting to match the given pattern. This is useful if, for
instance, the Pattern itself matches the prompt or if the telnet
session starts interactive programs which do not display the normal
prompt.
Diffstat (limited to 'lib/common_test/test/telnet_server.erl')
-rw-r--r-- | lib/common_test/test/telnet_server.erl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/common_test/test/telnet_server.erl b/lib/common_test/test/telnet_server.erl index 5843155eee..31884aa182 100644 --- a/lib/common_test/test/telnet_server.erl +++ b/lib/common_test/test/telnet_server.erl @@ -93,6 +93,7 @@ do_accept(LSock,Server) -> end. init_client(#state{client=Sock}=State) -> + dbg("Server sending: ~p~n",["login: "]), R = case gen_tcp:send(Sock,"login: ") of ok -> loop(State); @@ -164,8 +165,18 @@ do_handle_data(Data,#state{authorized={user,_}}=State) -> do_handle_data("echo "++ Data,State) -> send(Data++"\r\n> ",State), {ok,State}; -do_handle_data("repeat "++ Data,State) -> - send(Data++"\r\n"++Data++"\r\n> ",State), +do_handle_data("echo_no_prompt "++ Data,State) -> + send(Data,State), + {ok,State}; +do_handle_data("echo_ml "++ Data,State) -> + Lines = string:tokens(Data," "), + ReturnData = string:join(Lines,"\n"), + send(ReturnData++"\r\n> ",State), + {ok,State}; +do_handle_data("echo_ml_no_prompt "++ Data,State) -> + Lines = string:tokens(Data," "), + ReturnData = string:join(Lines,"\n"), + send(ReturnData,State), {ok,State}; do_handle_data([],State) -> send("> ",State), |