aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/sendfile_SUITE.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-10-11 10:01:53 +0200
committerJohn Högberg <[email protected]>2017-11-30 15:44:33 +0100
commit26b39c8914cb030886ddfbc3ce4b938dbd5bafc3 (patch)
tree41e67ea4de9790940506aeb4bab772119373f4c7 /lib/kernel/test/sendfile_SUITE.erl
parentebbd26eeea4115c946d1254d94acd50f150b4455 (diff)
downloadotp-26b39c8914cb030886ddfbc3ce4b938dbd5bafc3.tar.gz
otp-26b39c8914cb030886ddfbc3ce4b938dbd5bafc3.tar.bz2
otp-26b39c8914cb030886ddfbc3ce4b938dbd5bafc3.zip
Account for new behavior in tests that touch prim_file
This also hides the module behind ?PRIM_FILE to make testing new implementations less painful.
Diffstat (limited to 'lib/kernel/test/sendfile_SUITE.erl')
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index bfa564c32c..b68903ed39 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -91,9 +91,12 @@ init_per_testcase(TC,Config) when TC == t_sendfile_recvduring;
Send = fun(Sock) ->
{_Size, Data} = sendfile_file_info(Filename),
- {ok,D} = file:open(Filename, [raw,binary,read]),
- prim_file:sendfile(D, Sock, 0, 0, 0,
- [],[],[]),
+ {ok,Fd} = file:open(Filename, [raw,binary,read]),
+ %% Determine whether the driver has native support by
+ %% hitting the raw module directly; file:sendfile/5 will
+ %% land in the fallback if it doesn't.
+ RawModule = Fd#file_descriptor.module,
+ {ok, _Ignored} = RawModule:sendfile(Fd,Sock,0,0,0,[],[],[]),
Data
end,