aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2019-03-07 16:13:19 +0100
committerIngela Anderton Andin <[email protected]>2019-03-08 09:01:51 +0100
commitbf952738a3be59693c35b2983020196bbbf71538 (patch)
treeb54c8763d939bec63494ca2070c462da38278b4e /lib
parent6842a1c9af46297021b4c9c37eb8dd2a62eec59c (diff)
downloadotp-bf952738a3be59693c35b2983020196bbbf71538.tar.gz
otp-bf952738a3be59693c35b2983020196bbbf71538.tar.bz2
otp-bf952738a3be59693c35b2983020196bbbf71538.zip
ftp: New test case
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp/test/ftp_SUITE.erl38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/ftp/test/ftp_SUITE.erl b/lib/ftp/test/ftp_SUITE.erl
index 81147b5821..0b070ee8cb 100644
--- a/lib/ftp/test/ftp_SUITE.erl
+++ b/lib/ftp/test/ftp_SUITE.erl
@@ -96,6 +96,7 @@ ftp_tests()->
recv_chunk,
recv_chunk_twice,
recv_chunk_three_times,
+ recv_chunk_delay,
type,
quote,
error_elogin,
@@ -732,21 +733,28 @@ recv_chunk(Pid, Acc) ->
Error
end.
-%% Make new test case that uses this or new code
-%% only test one thing at the time
-%% delay_recv_chunk(Pid) ->
-%% delay_recv_chunk(Pid, <<>>).
-%% delay_recv_chunk(Pid, Acc) ->
-%% ct:pal("FOO ~p", [byte_size(Acc)]),
-%% case ftp:recv_chunk(Pid) of
-%% ok ->
-%% {ok, Acc};
-%% {ok, Bin} ->
-%% ct:sleep(100),
-%% delay_recv_chunk(Pid, <<Acc/binary, Bin/binary>>);
-%% Error ->
-%% Error
-%% end.
+recv_chunk_delay(Config0) when is_list(Config0) ->
+ File1 = "big_file1.txt",
+ Contents = list_to_binary(lists:duplicate(1000, lists:seq(0,255))),
+ Config = set_state([reset, {mkfile,File1,Contents}], Config0),
+ Pid = proplists:get_value(ftp, Config),
+ ok = ftp:recv_chunk_start(Pid, id2ftp(File1,Config)),
+ {ok, ReceivedContents} = delay_recv_chunk(Pid),
+ find_diff(ReceivedContents, Contents).
+
+delay_recv_chunk(Pid) ->
+ delay_recv_chunk(Pid, <<>>).
+delay_recv_chunk(Pid, Acc) ->
+ ct:pal("Recived size ~p", [byte_size(Acc)]),
+ case ftp:recv_chunk(Pid) of
+ ok ->
+ {ok, Acc};
+ {ok, Bin} ->
+ ct:sleep(100),
+ delay_recv_chunk(Pid, <<Acc/binary, Bin/binary>>);
+ Error ->
+ Error
+ end.
%%-------------------------------------------------------------------------
type() ->