aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2012-02-13 20:13:37 +0100
committerPatrik Nyblom <[email protected]>2012-03-22 18:16:14 +0100
commitc15f94e7922040b63f3abf8680cd77d5548fecf3 (patch)
tree498dd289cf85393a70d4f34ff20c59338fd24066 /lib/kernel/test
parent0fd4e39abeea3fc87b78eec8495109f9245b5ac8 (diff)
downloadotp-c15f94e7922040b63f3abf8680cd77d5548fecf3.tar.gz
otp-c15f94e7922040b63f3abf8680cd77d5548fecf3.tar.bz2
otp-c15f94e7922040b63f3abf8680cd77d5548fecf3.zip
Add user tag spreading functionality to VM and use in file
User tags in a dynamic trace enabled VM are spread throughout the system in the same way as seq_trace tokens. This is used by the file module and various other modules to get hold of the tag from the user process without changing the protocol.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl108
1 files changed, 54 insertions, 54 deletions
diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl
index 9575762b12..3e2202922c 100644
--- a/lib/kernel/test/prim_file_SUITE.erl
+++ b/lib/kernel/test/prim_file_SUITE.erl
@@ -70,7 +70,7 @@
%% compile time.
-define(PRIM_FILE_call(F, H, A),
case H of
- [] -> apply(?PRIM_FILE, F, A -- ["utag"]);
+ [] -> apply(?PRIM_FILE, F, A);
_ -> apply(?PRIM_FILE, F, [H | A])
end).
@@ -255,31 +255,31 @@ make_del_dir(Config, Handle, Suffix) ->
?line NewDir = filename:join(RootDir,
atom_to_list(?MODULE)
++"_mk-dir"++Suffix),
- ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
- ?line {error, eexist} = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
- ?line ok = ?PRIM_FILE_call(del_dir, Handle, [NewDir, "utag"]),
- ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
+ ?line {error, eexist} = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
+ ?line ok = ?PRIM_FILE_call(del_dir, Handle, [NewDir]),
+ ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [NewDir]),
% Make sure we are not in a directory directly under test_server
% as that would result in eacess errors when trying to delere '..',
% because there are processes having that directory as current.
- ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
?line {ok, CurrentDir} = ?PRIM_FILE_call(get_cwd, Handle, []),
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [NewDir]),
try
%% Check that we get an error when trying to create...
%% a deep directory
?line NewDir2 = filename:join(RootDir,
atom_to_list(?MODULE)
++"_mk-dir-noexist/foo"),
- ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [NewDir2, "utag"]),
+ ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [NewDir2]),
%% a nameless directory
- ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, ["", "utag"]),
+ ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [""]),
%% a directory with illegal name
- ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, ['mk-dir', "utag"]),
+ ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, ['mk-dir']),
%% a directory with illegal name, even if it's a (bad) list
- ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, [[1,2,3,{}], "utag"]),
+ ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, [[1,2,3,{}]]),
%% Maybe this isn't an error, exactly, but worth mentioning anyway:
%% ok = ?PRIM_FILE:make_dir([$f,$o,$o,0,$b,$a,$r])),
@@ -292,17 +292,17 @@ make_del_dir(Config, Handle, Suffix) ->
%% Try deleting some bad directories
%% Deleting the parent directory to the current, sounds dangerous, huh?
%% Don't worry ;-) the parent directory should never be empty, right?
- ?line case ?PRIM_FILE_call(del_dir, Handle, ["..", "utag"]) of
+ ?line case ?PRIM_FILE_call(del_dir, Handle, [".."]) of
{error, eexist} -> ok;
{error, eacces} -> ok; %OpenBSD
{error, einval} -> ok %FreeBSD
end,
- ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, ["", "utag"]),
- ?line {error, badarg} = ?PRIM_FILE_call(del_dir, Handle, [[3,2,1,{}], "utag"]),
+ ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [""]),
+ ?line {error, badarg} = ?PRIM_FILE_call(del_dir, Handle, [[3,2,1,{}]]),
?line test_server:timetrap_cancel(Dog)
after
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [CurrentDir, "utag"])
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [CurrentDir])
end,
ok.
@@ -324,7 +324,7 @@ cur_dir_0(Config, Handle) ->
%% Find out the current dir, and cd to it ;-)
?line {ok,BaseDir} = ?PRIM_FILE_call(get_cwd, Handle, []),
?line Dir1 = BaseDir ++ "", %% Check that it's a string
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1, "utag"]),
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1]),
?line DirName = atom_to_list(?MODULE) ++
case Handle of
[] ->
@@ -336,40 +336,40 @@ cur_dir_0(Config, Handle) ->
%% Make a new dir, and cd to that
?line RootDir = ?config(priv_dir,Config),
?line NewDir = filename:join(RootDir, DirName),
- ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
?line io:format("cd to ~s",[NewDir]),
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [NewDir]),
%% Create a file in the new current directory, and check that it
%% really is created there
?line UncommonName = "uncommon.fil",
?line {ok,Fd} = ?PRIM_FILE:open(UncommonName, [read, write]),
?line ok = ?PRIM_FILE:close(Fd),
- ?line {ok,NewDirFiles} = ?PRIM_FILE_call(list_dir, Handle, [".", "utag"]),
+ ?line {ok,NewDirFiles} = ?PRIM_FILE_call(list_dir, Handle, ["."]),
?line true = lists:member(UncommonName,NewDirFiles),
%% Delete the directory and return to the old current directory
%% and check that the created file isn't there (too!)
?line expect({error, einval}, {error, eacces}, {error, eexist},
- ?PRIM_FILE_call(del_dir, Handle, [NewDir, "utag"])),
- ?line ?PRIM_FILE_call(delete, Handle, [UncommonName, "utag"]),
- ?line {ok,[]} = ?PRIM_FILE_call(list_dir, Handle, [".", "utag"]),
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1, "utag"]),
+ ?PRIM_FILE_call(del_dir, Handle, [NewDir])),
+ ?line ?PRIM_FILE_call(delete, Handle, [UncommonName]),
+ ?line {ok,[]} = ?PRIM_FILE_call(list_dir, Handle, ["."]),
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1]),
?line io:format("cd back to ~s",[Dir1]),
- ?line ok = ?PRIM_FILE_call(del_dir, Handle, [NewDir, "utag"]),
- ?line {error, enoent} = ?PRIM_FILE_call(set_cwd, Handle, [NewDir, "utag"]),
- ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1, "utag"]),
+ ?line ok = ?PRIM_FILE_call(del_dir, Handle, [NewDir]),
+ ?line {error, enoent} = ?PRIM_FILE_call(set_cwd, Handle, [NewDir]),
+ ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [Dir1]),
?line io:format("cd back to ~s",[Dir1]),
- ?line {ok,OldDirFiles} = ?PRIM_FILE_call(list_dir, Handle, [".", "utag"]),
+ ?line {ok,OldDirFiles} = ?PRIM_FILE_call(list_dir, Handle, ["."]),
?line false = lists:member(UncommonName,OldDirFiles),
%% Try doing some bad things
?line {error, badarg} =
- ?PRIM_FILE_call(set_cwd, Handle, [{foo,bar}, "utag"]),
+ ?PRIM_FILE_call(set_cwd, Handle, [{foo,bar}]),
?line {error, enoent} =
- ?PRIM_FILE_call(set_cwd, Handle, ["", "utag"]),
+ ?PRIM_FILE_call(set_cwd, Handle, [""]),
?line {error, enoent} =
- ?PRIM_FILE_call(set_cwd, Handle, [".......a......", "utag"]),
+ ?PRIM_FILE_call(set_cwd, Handle, [".......a......"]),
?line {ok,BaseDir} =
?PRIM_FILE_call(get_cwd, Handle, []), %% Still there?
@@ -405,10 +405,10 @@ cur_dir_1(Config, Handle) ->
?line case os:type() of
{unix, _} ->
?line {error, enotsup} =
- ?PRIM_FILE_call(get_cwd, Handle, ["d:", "utag"]);
+ ?PRIM_FILE_call(get_cwd, Handle, ["d:"]);
vxworks ->
?line {error, enotsup} =
- ?PRIM_FILE_call(get_cwd, Handle, ["d:", "utag"]);
+ ?PRIM_FILE_call(get_cwd, Handle, ["d:"]);
{win32, _} ->
win_cur_dir_1(Config, Handle)
end,
@@ -422,7 +422,7 @@ win_cur_dir_1(_Config, Handle) ->
%% and try to get current directory for that drive.
?line [Drive, $:|_] = BaseDir,
- ?line {ok, BaseDir} = ?PRIM_FILE_call(get_cwd, Handle, [[Drive, $:], "utag"]),
+ ?line {ok, BaseDir} = ?PRIM_FILE_call(get_cwd, Handle, [[Drive, $:]]),
io:format("BaseDir = ~s\n", [BaseDir]),
%% Unfortunately, there is no way to move away from the
@@ -1027,7 +1027,7 @@ file_write_file_info(Config, Handle, Suffix) ->
?line ok = ?PRIM_FILE:write_file(Name, "hello"),
?line Time = {{1997, 01, 02}, {12, 35, 42}},
?line Info = #file_info{mode=8#400, atime=Time, mtime=Time, ctime=Time},
- ?line ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, Info, "utag"]),
+ ?line ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, Info]),
%% Read back the times.
@@ -1050,12 +1050,12 @@ file_write_file_info(Config, Handle, Suffix) ->
%% Make the file writable again.
?line ?PRIM_FILE_call(write_file_info, Handle,
- [Name, #file_info{mode=8#600}, "utag"]),
+ [Name, #file_info{mode=8#600}]),
?line ok = ?PRIM_FILE:write_file(Name, "hello again"),
%% And unwritable.
?line ?PRIM_FILE_call(write_file_info, Handle,
- [Name, #file_info{mode=8#400}, "utag"]),
+ [Name, #file_info{mode=8#400}]),
?line {error, eacces} = ?PRIM_FILE:write_file(Name, "hello again"),
%% Write the times again.
@@ -1063,7 +1063,7 @@ file_write_file_info(Config, Handle, Suffix) ->
?line NewTime = {{1997, 02, 15}, {13, 18, 20}},
?line NewInfo = #file_info{atime=NewTime, mtime=NewTime, ctime=NewTime},
- ?line ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, NewInfo, "utag"]),
+ ?line ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, NewInfo]),
?line {ok, ActualInfo2} =
?PRIM_FILE_call(read_file_info, Handle, [Name]),
?line #file_info{atime=NewActAtime, mtime=NewTime,
@@ -1081,7 +1081,7 @@ file_write_file_info(Config, Handle, Suffix) ->
%% Make the file writeable again, so that we can remove the
%% test suites ... :-)
?line ?PRIM_FILE_call(write_file_info, Handle,
- [Name, #file_info{mode=8#600}, "utag"]),
+ [Name, #file_info{mode=8#600}]),
?line test_server:timetrap_cancel(Dog),
ok.
@@ -1390,11 +1390,11 @@ delete(Config, Handle, Suffix) ->
%% Check that the file is readable
?line {ok, Fd2} = ?PRIM_FILE:open(Name, [read]),
?line ok = ?PRIM_FILE:close(Fd2),
- ?line ok = ?PRIM_FILE_call(delete, Handle, [Name, "utag"]),
+ ?line ok = ?PRIM_FILE_call(delete, Handle, [Name]),
%% Check that the file is not readable anymore
?line {error, _} = ?PRIM_FILE:open(Name, [read]),
%% Try deleting a nonexistent file
- ?line {error, enoent} = ?PRIM_FILE_call(delete, Handle, [Name, "utag"]),
+ ?line {error, enoent} = ?PRIM_FILE_call(delete, Handle, [Name]),
?line test_server:timetrap_cancel(Dog),
ok.
@@ -1895,14 +1895,14 @@ make_link(Config, Handle, Suffix) ->
?line NewDir = filename:join(RootDir,
atom_to_list(?MODULE)
++"_make_link"++Suffix),
- ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
?line Name = filename:join(NewDir, "a_file"),
?line ok = ?PRIM_FILE:write_file(Name, "some contents\n"),
?line Alias = filename:join(NewDir, "an_alias"),
?line Result =
- case ?PRIM_FILE_call(make_link, Handle, [Name, Alias, "utag"]) of
+ case ?PRIM_FILE_call(make_link, Handle, [Name, Alias]) of
{error, enotsup} ->
{skipped, "Links not supported on this platform"};
ok ->
@@ -1913,12 +1913,12 @@ make_link(Config, Handle, Suffix) ->
%% since they are not used on symbolic links.
?line {ok, Info} =
- ?PRIM_FILE_call(read_link_info, Handle, [Name, "utag"]),
+ ?PRIM_FILE_call(read_link_info, Handle, [Name]),
?line {ok, Info} =
- ?PRIM_FILE_call(read_link_info, Handle, [Alias, "utag"]),
+ ?PRIM_FILE_call(read_link_info, Handle, [Alias]),
?line #file_info{links = 2, type = regular} = Info,
?line {error, eexist} =
- ?PRIM_FILE_call(make_link, Handle, [Name, Alias, "utag"]),
+ ?PRIM_FILE_call(make_link, Handle, [Name, Alias]),
ok
end,
@@ -1956,30 +1956,30 @@ symlinks(Config, Handle, Suffix) ->
?line NewDir = filename:join(RootDir,
atom_to_list(?MODULE)
++"_make_symlink"++Suffix),
- ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]),
?line Name = filename:join(NewDir, "a_plain_file"),
?line ok = ?PRIM_FILE:write_file(Name, "some stupid content\n"),
?line Alias = filename:join(NewDir, "a_symlink_alias"),
?line Result =
- case ?PRIM_FILE_call(make_symlink, Handle, [Name, Alias, "utag"]) of
+ case ?PRIM_FILE_call(make_symlink, Handle, [Name, Alias]) of
{error, enotsup} ->
{skipped, "Links not supported on this platform"};
ok ->
?line {ok, Info1} =
- ?PRIM_FILE_call(read_file_info, Handle, [Name, "utag"]),
+ ?PRIM_FILE_call(read_file_info, Handle, [Name]),
?line {ok, Info1} =
- ?PRIM_FILE_call(read_file_info, Handle, [Alias, "utag"]),
+ ?PRIM_FILE_call(read_file_info, Handle, [Alias]),
?line {ok, Info1} =
- ?PRIM_FILE_call(read_link_info, Handle, [Name, "utag"]),
+ ?PRIM_FILE_call(read_link_info, Handle, [Name]),
?line #file_info{links = 1, type = regular} = Info1,
?line {ok, Info2} =
- ?PRIM_FILE_call(read_link_info, Handle, [Alias, "utag"]),
+ ?PRIM_FILE_call(read_link_info, Handle, [Alias]),
?line #file_info{links=1, type=symlink} = Info2,
?line {ok, Name} =
- ?PRIM_FILE_call(read_link, Handle, [Alias, "utag"]),
+ ?PRIM_FILE_call(read_link, Handle, [Alias]),
ok
end,
@@ -2003,7 +2003,7 @@ list_dir_limit(Config) when is_list(Config) ->
?line NewDir = filename:join(RootDir,
atom_to_list(?MODULE)++"_list_dir_limit"),
?line {ok, Handle1} = ?PRIM_FILE:start(),
- ?line ok = ?PRIM_FILE_call(make_dir, Handle1, [NewDir, "utag"]),
+ ?line ok = ?PRIM_FILE_call(make_dir, Handle1, [NewDir]),
Ref = erlang:start_timer(MaxTime*1000, self(), []),
?line Result = list_dir_limit_loop(NewDir, Handle1, Ref, MaxNumber, 0),
?line Time = case erlang:cancel_timer(Ref) of
@@ -2054,7 +2054,7 @@ list_dir_limit_loop(Dir, Handle, Ref, N, Cnt) ->
end.
list_dir_check(Dir, Handle, Cnt) ->
- case ?PRIM_FILE:list_dir(Handle, Dir, "utag") of
+ case ?PRIM_FILE:list_dir(Handle, Dir) of
{ok, ListDir} ->
case length(ListDir) of
Cnt ->