aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-03-14 20:02:43 +0100
committerLukas Larsson <[email protected]>2012-03-20 10:34:06 +0100
commit3618672c3e4746fada7464b2e31bf7c3ad0b3b88 (patch)
tree68a9b884be480efd58763a04099286221e61a7f7 /lib/kernel
parenta9dac8d98a9b848426961087b2567ddeb9c05395 (diff)
downloadotp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.tar.gz
otp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.tar.bz2
otp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.zip
Fix bug when sending long files using select
The return value from efile_sendfile was not consistent inbetween platforms. The API should now be working as it was intended. OTP-9994
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index 5d77305e37..4056b5d121 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -26,7 +26,8 @@
all() ->
[t_sendfile_small
- ,t_sendfile_big
+ ,t_sendfile_big_all
+ ,t_sendfile_big_size
,t_sendfile_many_small
,t_sendfile_partial
,t_sendfile_offset
@@ -114,7 +115,7 @@ t_sendfile_many_small(Config) when is_list(Config) ->
ok = sendfile_send({127,0,0,1}, Send, 0).
-t_sendfile_big(Config) when is_list(Config) ->
+t_sendfile_big_all(Config) when is_list(Config) ->
Filename = proplists:get_value(big_file, Config),
Send = fun(Sock) ->
@@ -126,6 +127,20 @@ t_sendfile_big(Config) when is_list(Config) ->
ok = sendfile_send({127,0,0,1}, Send, 0).
+t_sendfile_big_size(Config) ->
+ Filename = proplists:get_value(big_file, Config),
+ FileOpts = proplists:get_value(file_opts, Config, []),
+
+ SendAll = fun(Sock) ->
+ {ok, #file_info{size = Size}} =
+ file:read_file_info(Filename),
+ {ok,D} = file:open(Filename,[read|FileOpts]),
+ {ok, Size} = file:sendfile(D, Sock,0,Size,[]),
+ Size
+ end,
+
+ ok = sendfile_send({127,0,0,1}, SendAll, 0).
+
t_sendfile_partial(Config) ->
Filename = proplists:get_value(small_file, Config),
FileOpts = proplists:get_value(file_opts, Config, []),