aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-04-05 11:47:02 +0200
committerAnthony Ramine <[email protected]>2013-04-11 14:28:45 +0200
commit9f2c736e273aed9034aeab2d2877b5c52cc8d327 (patch)
tree48aaedb3b41004bf8378ad6e7a5b33a5f437f782 /lib/kernel/test
parente72043e3519cb14aabf461849eba959b97e07410 (diff)
downloadotp-9f2c736e273aed9034aeab2d2877b5c52cc8d327.tar.gz
otp-9f2c736e273aed9034aeab2d2877b5c52cc8d327.tar.bz2
otp-9f2c736e273aed9034aeab2d2877b5c52cc8d327.zip
Optimize communication with file io server
The file module communicates with a file io server with the following protocol for file operations: > {file_request,From,ReplyAs,Request} < {file_reply,ReplyAs,Reply} The ReplyAs value is sent by the client side to match against when receiving the reply and is otherwise left untouched and passed as is by the server. This commit enables receive optimizations by using the reference of the server monitor, changing the protocol to: > {file_request,From,MonitorRef,Request} < {file_reply,MonitorRef,Reply} As the shape of the messages is not changed, backwards compatibility is not a concern.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/file_SUITE.erl29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl
index c604e7073f..4218cfa646 100644
--- a/lib/kernel/test/file_SUITE.erl
+++ b/lib/kernel/test/file_SUITE.erl
@@ -91,6 +91,8 @@
-export([standard_io/1,mini_server/1]).
+-export([old_io_protocol/1]).
+
%% Debug exports
-export([create_file_slow/2, create_file/2, create_bin/2]).
-export([verify_file/2, verify_bin/3]).
@@ -114,7 +116,7 @@ all() ->
delayed_write, read_ahead, segment_read, segment_write,
ipread, pid2name, interleaved_read_write, otp_5814, otp_10852,
large_file, large_write, read_line_1, read_line_2, read_line_3,
- read_line_4, standard_io].
+ read_line_4, standard_io, old_io_protocol].
groups() ->
[{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1,
@@ -310,6 +312,31 @@ standard_io(Config) when is_list(Config) ->
Pid ! die,
receive after 1000 -> ok end.
+old_io_protocol(suite) ->
+ [];
+old_io_protocol(doc) ->
+ ["Test that the old file IO protocol =< R16B still works"];
+old_io_protocol(Config) when is_list(Config) ->
+ Dog = test_server:timetrap(test_server:seconds(5)),
+ RootDir = ?config(priv_dir,Config),
+ Name = filename:join(RootDir,
+ atom_to_list(?MODULE)
+ ++"old_io_protocol.fil"),
+ MyData = "0123456789abcdefghijklmnopqrstuvxyz",
+ ok = ?FILE_MODULE:write_file(Name, MyData),
+ {ok, Fd} = ?FILE_MODULE:open(Name, write),
+ Fd ! {file_request,self(),Fd,truncate},
+ receive
+ {file_reply,Fd,ok} -> ok
+ end,
+ ok = ?FILE_MODULE:close(Fd),
+ {ok, <<>>} = ?FILE_MODULE:read_file(Name),
+ test_server:timetrap_cancel(Dog),
+ [] = flush(),
+ ok.
+
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
read_write_file(suite) -> [];