aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_telnet_SUITE_data
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2014-03-25 11:16:49 +0100
committerPeter Andersson <[email protected]>2014-03-25 11:17:04 +0100
commitc5dc6babf962b22aaffd04bd8c1fff761973f0c0 (patch)
tree41b43c6489073b36a6c91367e61c871ffc433ef8 /lib/common_test/test/ct_telnet_SUITE_data
parent646ad9bd6679f629d8c5c7bad7adc3fbb4d1a627 (diff)
parent1acc2ed6ebb2837e66419b357f88a1709fa2c0f1 (diff)
downloadotp-c5dc6babf962b22aaffd04bd8c1fff761973f0c0.tar.gz
otp-c5dc6babf962b22aaffd04bd8c1fff761973f0c0.tar.bz2
otp-c5dc6babf962b22aaffd04bd8c1fff761973f0c0.zip
Merge branch 'peppe/common_test/telnet_expect_timeout'
* peppe/common_test/telnet_expect_timeout: Add test cases Introduce total timeout value in ct_telnet:expect/3 options OTP-11689
Diffstat (limited to 'lib/common_test/test/ct_telnet_SUITE_data')
-rw-r--r--lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl
index 394d64c2ed..0ee0525216 100644
--- a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl
+++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl
@@ -20,7 +20,9 @@ all() ->
expect_repeat,
expect_sequence,
expect_error_prompt,
- expect_error_timeout,
+ expect_error_timeout1,
+ expect_error_timeout2,
+ expect_error_timeout3,
no_prompt_check,
no_prompt_check_repeat,
no_prompt_check_sequence,
@@ -87,13 +89,34 @@ expect_error_prompt(_) ->
%% Check that expect returns after idle timeout, and even if the
%% expected pattern is received - as long as not newline or prompt is
%% received it will not match.
-expect_error_timeout(_) ->
+expect_error_timeout1(_) ->
{ok, Handle} = ct_telnet:open(telnet_server_conn1),
ok = ct_telnet:send(Handle, "echo_no_prompt xxx"),
{error,timeout} = ct_telnet:expect(Handle, ["xxx"], [{timeout,1000}]),
ok = ct_telnet:close(Handle),
ok.
+expect_error_timeout2(_) ->
+ {ok, Handle} = ct_telnet:open(telnet_server_conn1),
+ ok = ct_telnet:send(Handle, "echo_no_prompt xxx"),
+ {error,timeout} = ct_telnet:expect(Handle, ["xxx"], [{idle_timeout,1000},
+ {total_timeout,infinity}]),
+ ok = ct_telnet:close(Handle),
+ ok.
+
+%% Check that if server loops and pattern not matching, the operation
+%% can be aborted
+expect_error_timeout3(_) ->
+ {ok, Handle} = ct_telnet:open(telnet_server_conn1),
+ ok = ct_telnet:send(Handle, "echo_loop 5000 xxx"),
+ {error,timeout} = ct_telnet:expect(Handle, ["yyy"],
+ [{idle_timeout,infinity},
+ {total_timeout,3000}]),
+ ok = ct_telnet:send(Handle, "echo ayt"),
+ {ok,["ayt"]} = ct_telnet:expect(Handle, ["ayt"]),
+ ok = ct_telnet:close(Handle),
+ ok.
+
%% expect with ignore_prompt option should not return even if a prompt
%% is found. The pattern after the prompt (here "> ") can be matched.
ignore_prompt(_) ->