From c5dde79924dc4d46842ab4d2a2465dbe64230599 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 3 Jan 2012 10:52:26 +0100 Subject: Add test case for sending multiple small files on same connection --- lib/kernel/test/sendfile_SUITE.erl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl index 6cf695adfd..5d77305e37 100644 --- a/lib/kernel/test/sendfile_SUITE.erl +++ b/lib/kernel/test/sendfile_SUITE.erl @@ -27,6 +27,7 @@ all() -> [t_sendfile_small ,t_sendfile_big + ,t_sendfile_many_small ,t_sendfile_partial ,t_sendfile_offset ,t_sendfile_sendafter @@ -96,6 +97,23 @@ t_sendfile_small(Config) when is_list(Config) -> ok = sendfile_send(Send). +t_sendfile_many_small(Config) when is_list(Config) -> + Filename = proplists:get_value(small_file, Config), + FileOpts = proplists:get_value(file_opts, Config, []), + + Send = fun(Sock) -> + {Size,_} = sendfile_file_info(Filename), + N = 10000, + {ok,D} = file:open(Filename,[read|FileOpts]), + [begin + {ok,Size} = file:sendfile(D,Sock,0,0,[]) + end || _I <- lists:seq(1,N)], + file:close(D), + Size*N + end, + + ok = sendfile_send({127,0,0,1}, Send, 0). + t_sendfile_big(Config) when is_list(Config) -> Filename = proplists:get_value(big_file, Config), -- cgit v1.2.3