diff options
author | Siri Hansen <[email protected]> | 2016-05-25 14:49:59 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2016-05-25 14:49:59 +0200 |
commit | cabe113ee5e4a137e16ad2cf6c6a0bbb8889fdb6 (patch) | |
tree | cac9487788d588a7e1b564f8cd18f4d742e58ed6 /lib/common_test/test | |
parent | 8651f714e7b06f85f765ab01697984a1687d56bb (diff) | |
download | otp-cabe113ee5e4a137e16ad2cf6c6a0bbb8889fdb6.tar.gz otp-cabe113ee5e4a137e16ad2cf6c6a0bbb8889fdb6.tar.bz2 otp-cabe113ee5e4a137e16ad2cf6c6a0bbb8889fdb6.zip |
Retry ct_telnet:get_data if no data is received after short wait
ct_telnet_own_server_SUITE:large_string tests that the client can
receive a chopped up string. To make sure the right thing is tested, a
SHORT timer is used before calling ct_telnet:get_data, but on some
slow machines the the timer is too short to allow data to be
received. To overcome this, the test now re-tries ct_telnet:get_data a
few times before giving up.
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl | 15 |
1 files changed, 13 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 9dc9095f47..985fa40ad2 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 @@ -308,8 +308,19 @@ large_string(_) -> VerifyStr = [C || C <- lists:flatten(Data1), C/=$ , C/=$\r, C/=$\n, C/=$>], ok = ct_telnet:send(Handle, "echo_sep "++BigString), - ct:sleep(50), - {ok,Data2} = ct_telnet:get_data(Handle), + %% On some slow machines, 50 ms might not be enough to get the + %% first packet of data. We will therefore keep trying for a + %% second before we give up this... + F = fun RepeatUntilData(N) -> + ct:sleep(50), + case ct_telnet:get_data(Handle) of + {ok,[]} when N>1 -> + RepeatUntilData(N-1); + Other -> + Other + end + end, + {ok,Data2} = F(20), ct:log("[GET DATA #2] Received ~w chars: ~s", [length(lists:flatten(Data2)),Data2]), VerifyStr = [C || C <- lists:flatten(Data2), C/=$ , C/=$\r, C/=$\n, C/=$>], |