aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/erl_prim_loader_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-11 10:05:44 +0100
committerBjörn Gustavsson <[email protected]>2016-03-11 10:05:44 +0100
commitd369571f10ccc5ebf4548f4dbc74efe649c5e669 (patch)
tree30c4344e66d86ef619568e3b193795659d3ba5b0 /lib/kernel/test/erl_prim_loader_SUITE.erl
parent12e365ce0af0e93d87aee614d33f71a3b6c3bcc8 (diff)
parent0ba20cd6d43e277593b59463d2c2959bb6db0957 (diff)
downloadotp-d369571f10ccc5ebf4548f4dbc74efe649c5e669.tar.gz
otp-d369571f10ccc5ebf4548f4dbc74efe649c5e669.tar.bz2
otp-d369571f10ccc5ebf4548f4dbc74efe649c5e669.zip
Merge branch 'bjorn/kernel/modernize-tests'
* bjorn/kernel/modernize-tests: Remove ?line macros Fix comments gen_tcp_misc_SUITE: Use unique node names Eliminate use of the ?t macro Eliminate use of doc and suite clauses Replace use of test_server:capture*/0 with ct:capture*/0 Eliminate use test_server:format() Eliminate use of test_server:sleep/1 Eliminate use of test_server:fail/0,1 Eliminate use of ?config() macro Modernize timetraps disk_log_SUITE: Remove vestiges of VxWorks support Conflicts: lib/kernel/test/code_SUITE.erl
Diffstat (limited to 'lib/kernel/test/erl_prim_loader_SUITE.erl')
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl322
1 files changed, 153 insertions, 169 deletions
diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl
index 55a5b1acf8..3ea925ee9a 100644
--- a/lib/kernel/test/erl_prim_loader_SUITE.erl
+++ b/lib/kernel/test/erl_prim_loader_SUITE.erl
@@ -23,6 +23,7 @@
-include_lib("common_test/include/ct.hrl").
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
+ init_per_testcase/2,end_per_testcase/2,
init_per_group/2,end_per_group/2]).
-export([get_path/1, set_path/1, get_file/1, normalize_and_backslash/1,
@@ -32,13 +33,14 @@
primary_archive/1, virtual_dir_in_archive/1,
get_modules/1]).
--export([init_per_testcase/2, end_per_testcase/2]).
%%-----------------------------------------------------------------
%% Test suite for erl_prim_loader. (Most code is run during system start/stop.)
%%-----------------------------------------------------------------
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap,{minutes,3}}].
all() ->
[get_path, set_path, get_file,
@@ -64,51 +66,46 @@ end_per_group(_GroupName, Config) ->
Config.
-init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
- Dog=?t:timetrap(?t:minutes(3)),
- [{watchdog, Dog}|Config].
+init_per_testcase(_Func, Config) ->
+ Config.
-end_per_testcase(_Func, Config) ->
- Dog=?config(watchdog, Config),
- ?t:timetrap_cancel(Dog).
+end_per_testcase(_Func, _Config) ->
+ ok.
-get_path(doc) -> [];
get_path(Config) when is_list(Config) ->
- ?line case erl_prim_loader:get_path() of
- {ok, Path} when is_list(Path) ->
- ok;
- _ ->
- test_server:fail(get_path)
- end,
+ case erl_prim_loader:get_path() of
+ {ok, Path} when is_list(Path) ->
+ ok;
+ _ ->
+ ct:fail(get_path)
+ end,
ok.
-set_path(doc) -> [];
set_path(Config) when is_list(Config) ->
- ?line {ok, Path} = erl_prim_loader:get_path(),
- ?line ok = erl_prim_loader:set_path(Path),
- ?line {ok, Path} = erl_prim_loader:get_path(),
+ {ok, Path} = erl_prim_loader:get_path(),
+ ok = erl_prim_loader:set_path(Path),
+ {ok, Path} = erl_prim_loader:get_path(),
NewPath = Path ++ ["dummy_dir","/dummy_dir/dummy_dir"],
- ?line ok = erl_prim_loader:set_path(NewPath),
- ?line {ok, NewPath} = erl_prim_loader:get_path(),
+ ok = erl_prim_loader:set_path(NewPath),
+ {ok, NewPath} = erl_prim_loader:get_path(),
- ?line ok = erl_prim_loader:set_path(Path), % Reset path.
- ?line {ok, Path} = erl_prim_loader:get_path(),
+ ok = erl_prim_loader:set_path(Path), % Reset path.
+ {ok, Path} = erl_prim_loader:get_path(),
- ?line {'EXIT',_} = (catch erl_prim_loader:set_path(not_a_list)),
- ?line {ok, Path} = erl_prim_loader:get_path(),
+ {'EXIT',_} = (catch erl_prim_loader:set_path(not_a_list)),
+ {ok, Path} = erl_prim_loader:get_path(),
ok.
-get_file(doc) -> [];
get_file(Config) when is_list(Config) ->
- ?line case erl_prim_loader:get_file("lists" ++ code:objfile_extension()) of
- {ok,Bin,File} when is_binary(Bin), is_list(File) ->
- ok;
- _ ->
- test_server:fail(get_valid_file)
- end,
- ?line error = erl_prim_loader:get_file("duuuuuuummmy_file"),
- ?line error = erl_prim_loader:get_file(duuuuuuummmy_file),
- ?line error = erl_prim_loader:get_file({dummy}),
+ case erl_prim_loader:get_file("lists" ++ code:objfile_extension()) of
+ {ok,Bin,File} when is_binary(Bin), is_list(File) ->
+ ok;
+ _ ->
+ ct:fail(get_valid_file)
+ end,
+ error = erl_prim_loader:get_file("duuuuuuummmy_file"),
+ error = erl_prim_loader:get_file(duuuuuuummmy_file),
+ error = erl_prim_loader:get_file({dummy}),
ok.
get_modules(_Config) ->
@@ -141,7 +138,7 @@ do_get_modules() ->
true = rpc:call(Node, code, add_patha, [ThisDir]),
_ = rpc:call(Node, code, ensure_loaded, [?MODULE]),
{ok,{InetSucc,FailExp}} = rpc:call(Node, erl_prim_loader,
- get_modules, [Ms,Process,Path]),
+ get_modules, [Ms,Process,Path]),
SuccExp = lists:sort(InetSucc),
stop_node(Node),
@@ -160,7 +157,7 @@ normalize_and_backslash(Config) ->
test_normalize_and_backslash(Config)
end.
test_normalize_and_backslash(Config) ->
- PrivDir = ?config(priv_dir,Config),
+ PrivDir = proplists:get_value(priv_dir,Config),
Dir = filename:join(PrivDir,"\\"),
File = filename:join(Dir,"file-OTP-11170"),
ok = file:make_dir(Dir),
@@ -171,8 +168,8 @@ test_normalize_and_backslash(Config) ->
ok = file:del_dir(Dir),
ok.
-inet_existing(doc) -> ["Start a node using the 'inet' loading method, ",
- "from an already started boot server."];
+%% Start a node using the 'inet' loading method,
+%% from an already started boot server.
inet_existing(Config) when is_list(Config) ->
Name = erl_prim_test_inet_existing,
BootPid = start_boot_server(),
@@ -183,14 +180,14 @@ inet_existing(Config) when is_list(Config) ->
exit(BootPid, kill),
ok.
-inet_coming_up(doc) -> ["Start a node using the 'inet' loading method, ",
- "but start the boot server afterwards."];
+%% Start a node using the 'inet' loading method,
+%% but start the boot server afterwards.
inet_coming_up(Config) when is_list(Config) ->
Name = erl_prim_test_inet_coming_up,
Node = start_node_using_inet(Name, [{wait,false}]),
%% Wait a while, then start boot server, and wait for node to start.
- test_server:sleep(test_server:seconds(6)),
+ ct:sleep({seconds,6}),
BootPid = start_boot_server(),
wait_really_started(Node, 25),
@@ -202,25 +199,25 @@ inet_coming_up(Config) when is_list(Config) ->
ok.
wait_really_started(Node, 0) ->
- test_server:fail({not_booted,Node});
+ ct:fail({not_booted,Node});
wait_really_started(Node, N) ->
case rpc:call(Node, init, get_status, []) of
{started, _} ->
ok;
_ ->
- test_server:sleep(1000),
+ ct:sleep(1000),
wait_really_started(Node, N - 1)
end.
-inet_disconnects(doc) -> ["Start a node using the 'inet' loading method, ",
- "then lose the connection."];
+%% Start a node using the 'inet' loading method,
+%% then lose the connection.
inet_disconnects(Config) when is_list(Config) ->
case test_server:is_native(erl_boot_server) of
true ->
{skip,"erl_boot_server is native"};
false ->
Name = erl_prim_test_inet_disconnects,
-
+
BootPid = start_boot_server(),
unlink(BootPid),
Self = self(),
@@ -239,9 +236,9 @@ inet_disconnects(Config) when is_list(Config) ->
{Stopper,ok} ->
ok;
{Stopper,{error,Reason}} ->
- ?line ?t:fail(Reason)
+ ct:fail(Reason)
after 60000 ->
- ?line ?t:fail(stopper_died)
+ ct:fail(stopper_died)
end,
%% Start new boot server to see that loading is continued.
@@ -279,13 +276,12 @@ get_calls(Count, Pid) ->
{error,{trace_msg_timeout,Count}}
end.
-multiple_slaves(doc) ->
- ["Start nodes in parallell, all using the 'inet' loading method, ",
- "verify that the boot server manages"];
+%% Start nodes in parallel, all using the 'inet' loading method;
+%% verify that the boot server manages.
multiple_slaves(Config) when is_list(Config) ->
- ?line Name = erl_prim_test_multiple_slaves,
- ?line Host = host(),
- ?line IpStr = ip_str(Host),
+ Name = erl_prim_test_multiple_slaves,
+ Host = host(),
+ IpStr = ip_str(Host),
Args = " -loader inet -hosts " ++ IpStr,
NoOfNodes = 10, % no of slave nodes to be started
@@ -298,54 +294,54 @@ multiple_slaves(Config) when is_list(Config) ->
{list_to_atom(NameN),list_to_atom(NodeN)}
end, lists:seq(1, NoOfNodes)),
- ?line Nodes = start_multiple_nodes(NamesAndNodes, Args, []),
+ Nodes = start_multiple_nodes(NamesAndNodes, Args, []),
%% "queue up" the nodes to wait for the boot server to respond
%% (note: test_server supervises each node start by accept()
%% on a socket, the timeout value for the accept has to be quite
%% long for this test to work).
- ?line test_server:sleep(test_server:seconds(5)),
+ ct:sleep({seconds,5}),
%% start the code loading circus!
BootPid = start_boot_server(),
%% give the nodes a chance to boot up before attempting to stop them
- ?line test_server:sleep(test_server:seconds(10)),
+ ct:sleep({seconds,10}),
- ?line wait_and_shutdown(lists:reverse(Nodes), 30),
+ wait_and_shutdown(lists:reverse(Nodes), 30),
- ?line unlink(BootPid),
- ?line exit(BootPid, kill),
+ unlink(BootPid),
+ exit(BootPid, kill),
ok.
start_multiple_nodes([{Name,Node} | NNs], Args, Started) ->
- ?line {ok,Node} = start_node(Name, Args, [{wait, false}]),
+ {ok,Node} = start_node(Name, Args, [{wait, false}]),
start_multiple_nodes(NNs, Args, [Node | Started]);
start_multiple_nodes([], _, Nodes) ->
Nodes.
wait_and_shutdown([Node | Nodes], Tries) ->
- ?line wait_really_started(Node, Tries),
- ?line {ok,[["inet"]]} = rpc:call(Node, init, get_argument, [loader]),
- ?line stop_node(Node),
+ wait_really_started(Node, Tries),
+ {ok,[["inet"]]} = rpc:call(Node, init, get_argument, [loader]),
+ stop_node(Node),
wait_and_shutdown(Nodes, Tries);
wait_and_shutdown([], _) ->
ok.
-file_requests(doc) -> ["Start a node using the 'inet' loading method, ",
- "verify that the boot server responds to file requests."];
+%% Start a node using the 'inet' loading method,
+%% verify that the boot server responds to file requests.
file_requests(Config) when is_list(Config) ->
- ?line {ok, Node, BootPid} = complete_start_node(erl_prim_test_file_req),
+ {ok, Node, BootPid} = complete_start_node(erl_prim_test_file_req),
%% compare with results from file server calls (the
%% boot server uses the same file sys and cwd)
{ok,Files} = file:list_dir("."),
io:format("Files: ~p~n",[Files]),
- ?line {ok,Files} = rpc:call(Node, erl_prim_loader, list_dir, ["."]),
+ {ok,Files} = rpc:call(Node, erl_prim_loader, list_dir, ["."]),
{ok,Info} = file:read_file_info(code:which(test_server)),
- ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info,
- [code:which(test_server)]),
+ {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info,
+ [code:which(test_server)]),
- PrivDir = ?config(priv_dir,Config),
+ PrivDir = proplists:get_value(priv_dir,Config),
Dir = filename:join(PrivDir,?MODULE_STRING++"_file_requests"),
ok = file:make_dir(Dir),
Alias = filename:join(Dir,"symlink"),
@@ -369,149 +365,140 @@ file_requests(Config) when is_list(Config) ->
end,
{ok,Cwd} = file:get_cwd(),
- ?line {ok,Cwd} = rpc:call(Node, erl_prim_loader, get_cwd, []),
+ {ok,Cwd} = rpc:call(Node, erl_prim_loader, get_cwd, []),
case file:get_cwd("C:") of
{error,enotsup} ->
ok;
{ok,DCwd} ->
- ?line {ok,DCwd} = rpc:call(Node, erl_prim_loader, get_cwd, ["C:"])
+ {ok,DCwd} = rpc:call(Node, erl_prim_loader, get_cwd, ["C:"])
end,
- ?line stop_node(Node),
- ?line unlink(BootPid),
- ?line exit(BootPid, kill),
+ stop_node(Node),
+ unlink(BootPid),
+ exit(BootPid, kill),
ok.
-local_archive(suite) ->
- [];
-local_archive(doc) ->
- ["Read files from local archive."];
+%% Read files from local archive.
local_archive(Config) when is_list(Config) ->
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
KernelDir = filename:basename(code:lib_dir(kernel)),
Archive = filename:join([PrivDir, KernelDir ++ init:archive_extension()]),
file:delete(Archive),
- ?line {ok, Archive} = create_archive(Archive, [KernelDir]),
+ {ok, Archive} = create_archive(Archive, [KernelDir]),
Node = node(),
BeamName = "inet.beam",
- ?line ok = test_archive(Node, Archive, KernelDir, BeamName),
+ ok = test_archive(Node, Archive, KernelDir, BeamName),
%% Cleanup
ok = rpc:call(Node, erl_prim_loader, purge_archive_cache, []),
- ?line ok = file:delete(Archive),
+ ok = file:delete(Archive),
ok.
-remote_archive(suite) ->
- {req, [{local_slave_nodes, 1}, {time, 10}]};
-remote_archive(doc) ->
- ["Read files from remote archive."];
+%% Read files from remote archive.
remote_archive(Config) when is_list(Config) ->
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
KernelDir = filename:basename(code:lib_dir(kernel)),
Archive = filename:join([PrivDir, KernelDir ++ init:archive_extension()]),
file:delete(Archive),
- ?line {ok, Archive} = create_archive(Archive, [KernelDir]),
+ {ok, Archive} = create_archive(Archive, [KernelDir]),
- ?line {ok, Node, BootPid} = complete_start_node(remote_archive),
+ {ok, Node, BootPid} = complete_start_node(remote_archive),
BeamName = "inet.beam",
- ?line ok = test_archive(Node, Archive, KernelDir, BeamName),
+ ok = test_archive(Node, Archive, KernelDir, BeamName),
%% Cleanup
- ?line stop_node(Node),
- ?line unlink(BootPid),
- ?line exit(BootPid, kill),
+ stop_node(Node),
+ unlink(BootPid),
+ exit(BootPid, kill),
ok.
-primary_archive(suite) ->
- {req, [{local_slave_nodes, 1}, {time, 10}]};
-primary_archive(doc) ->
- ["Read files from primary archive."];
+%% Read files from primary archive.
primary_archive(Config) when is_list(Config) ->
%% Copy the orig files to priv_dir
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
Archive = filename:join([PrivDir, "primary_archive.zip"]),
file:delete(Archive),
- DataDir = ?config(data_dir, Config),
- ?line {ok, _} = zip:create(Archive, ["primary_archive"],
- [{compress, []}, {cwd, DataDir}]),
- ?line {ok, _} = zip:extract(Archive, [{cwd, PrivDir}]),
+ DataDir = proplists:get_value(data_dir, Config),
+ {ok, _} = zip:create(Archive, ["primary_archive"],
+ [{compress, []}, {cwd, DataDir}]),
+ {ok, _} = zip:extract(Archive, [{cwd, PrivDir}]),
TopDir = filename:join([PrivDir, "primary_archive"]),
%% Compile the code
DictDir = "primary_archive_dict-1.0",
DummyDir = "primary_archive_dummy",
- ?line ok = compile_app(TopDir, DictDir),
- ?line ok = compile_app(TopDir, DummyDir),
-
+ ok = compile_app(TopDir, DictDir),
+ ok = compile_app(TopDir, DummyDir),
+
%% Create the archive
{ok, TopFiles} = file:list_dir(TopDir),
- ?line {ok, {_, ArchiveBin}} = zip:create(Archive, TopFiles,
- [memory, {compress, []}, {cwd, TopDir}]),
-
+ {ok, {_, ArchiveBin}} = zip:create(Archive, TopFiles,
+ [memory, {compress, []}, {cwd, TopDir}]),
+
%% Use temporary node to simplify cleanup
- ?line Cookie = atom_to_list(erlang:get_cookie()),
- ?line Args = " -setcookie " ++ Cookie,
- ?line {ok,Node} = start_node(primary_archive, Args),
- ?line wait_really_started(Node, 25),
- ?line {_,_,_} = rpc:call(Node, erlang, date, []),
+ Cookie = atom_to_list(erlang:get_cookie()),
+ Args = " -setcookie " ++ Cookie,
+ {ok,Node} = start_node(primary_archive, Args),
+ wait_really_started(Node, 25),
+ {_,_,_} = rpc:call(Node, erlang, date, []),
%% Set primary archive
ExpectedEbins = [Archive, DictDir ++ "/ebin", DummyDir ++ "/ebin"],
io:format("ExpectedEbins: ~p\n", [ExpectedEbins]),
- ?line {ok, FileInfo} = prim_file:read_file_info(Archive),
- ?line {ok, Ebins} = rpc:call(Node, erl_prim_loader, set_primary_archive,
- [Archive, ArchiveBin, FileInfo,
- fun escript:parse_file/1]),
- ?line ExpectedEbins = lists:sort(Ebins), % assert
-
- ?line {ok, TopFiles2} = rpc:call(Node, erl_prim_loader, list_dir, [Archive]),
- ?line [DictDir, DummyDir] = lists:sort(TopFiles2),
+ {ok, FileInfo} = prim_file:read_file_info(Archive),
+ {ok, Ebins} = rpc:call(Node, erl_prim_loader, set_primary_archive,
+ [Archive, ArchiveBin, FileInfo,
+ fun escript:parse_file/1]),
+ ExpectedEbins = lists:sort(Ebins), % assert
+
+ {ok, TopFiles2} = rpc:call(Node, erl_prim_loader, list_dir, [Archive]),
+ [DictDir, DummyDir] = lists:sort(TopFiles2),
BeamName = "primary_archive_dict_app.beam",
- ?line ok = test_archive(Node, Archive, DictDir, BeamName),
-
+ ok = test_archive(Node, Archive, DictDir, BeamName),
+
%% Cleanup
- ?line {ok, []} = rpc:call(Node, erl_prim_loader, set_primary_archive,
- [undefined, undefined, undefined,
- fun escript:parse_file/1]),
- ?line stop_node(Node),
- ?line ok = file:delete(Archive),
+ {ok, []} = rpc:call(Node, erl_prim_loader, set_primary_archive,
+ [undefined, undefined, undefined,
+ fun escript:parse_file/1]),
+ stop_node(Node),
+ ok = file:delete(Archive),
ok.
test_archive(Node, TopDir, AppDir, BeamName) ->
%% List dir
io:format("test_archive: ~p\n", [rpc:call(Node, erl_prim_loader, list_dir, [TopDir])]),
- ?line {ok, TopFiles} = rpc:call(Node, erl_prim_loader, list_dir, [TopDir]),
- ?line true = lists:member(AppDir, TopFiles),
+ {ok, TopFiles} = rpc:call(Node, erl_prim_loader, list_dir, [TopDir]),
+ true = lists:member(AppDir, TopFiles),
AbsAppDir = TopDir ++ "/" ++ AppDir,
- ?line {ok, AppFiles} = rpc:call(Node, erl_prim_loader, list_dir, [AbsAppDir]),
- ?line true = lists:member("ebin", AppFiles),
+ {ok, AppFiles} = rpc:call(Node, erl_prim_loader, list_dir, [AbsAppDir]),
+ true = lists:member("ebin", AppFiles),
Ebin = AbsAppDir ++ "/ebin",
- ?line {ok, EbinFiles} = rpc:call(Node, erl_prim_loader, list_dir, [Ebin]),
+ {ok, EbinFiles} = rpc:call(Node, erl_prim_loader, list_dir, [Ebin]),
Beam = Ebin ++ "/" ++ BeamName,
- ?line true = lists:member(BeamName, EbinFiles),
- ?line error = rpc:call(Node, erl_prim_loader, list_dir, [TopDir ++ "/no_such_file"]),
- ?line error = rpc:call(Node, erl_prim_loader, list_dir, [TopDir ++ "/ebin/no_such_file"]),
-
+ true = lists:member(BeamName, EbinFiles),
+ error = rpc:call(Node, erl_prim_loader, list_dir, [TopDir ++ "/no_such_file"]),
+ error = rpc:call(Node, erl_prim_loader, list_dir, [TopDir ++ "/ebin/no_such_file"]),
+
%% File info
- ?line {ok, #file_info{type = directory}} =
+ {ok, #file_info{type = directory}} =
rpc:call(Node, erl_prim_loader, read_file_info, [TopDir]),
- ?line {ok, #file_info{type = directory}} =
+ {ok, #file_info{type = directory}} =
rpc:call(Node, erl_prim_loader, read_file_info, [Ebin]),
- ?line {ok, #file_info{type = regular} = FI} =
+ {ok, #file_info{type = regular} = FI} =
rpc:call(Node, erl_prim_loader, read_file_info, [Beam]),
- ?line error = rpc:call(Node, erl_prim_loader, read_file_info, [TopDir ++ "/no_such_file"]),
- ?line error = rpc:call(Node, erl_prim_loader, read_file_info, [TopDir ++ "/ebin/no_such_file"]),
-
+ error = rpc:call(Node, erl_prim_loader, read_file_info, [TopDir ++ "/no_such_file"]),
+ error = rpc:call(Node, erl_prim_loader, read_file_info, [TopDir ++ "/ebin/no_such_file"]),
+
%% Get file
- ?line {ok, Bin, Beam} = rpc:call(Node, erl_prim_loader, get_file, [Beam]),
- ?line if
- FI#file_info.size =:= byte_size(Bin) -> ok;
- true -> exit({FI#file_info.size, byte_size(Bin)})
- end,
- ?line error = rpc:call(Node, erl_prim_loader, get_file, ["/no_such_file"]),
- ?line error = rpc:call(Node, erl_prim_loader, get_file, ["/ebin/no_such_file"]),
+ {ok, Bin, Beam} = rpc:call(Node, erl_prim_loader, get_file, [Beam]),
+ if
+ FI#file_info.size =:= byte_size(Bin) -> ok;
+ true -> exit({FI#file_info.size, byte_size(Bin)})
+ end,
+ error = rpc:call(Node, erl_prim_loader, get_file, ["/no_such_file"]),
+ error = rpc:call(Node, erl_prim_loader, get_file, ["/ebin/no_such_file"]),
ok.
create_archive(Archive, AppDirs) ->
@@ -521,12 +508,9 @@ create_archive(Archive, AppDirs) ->
zip:create(Archive, AppDirs, Opts).
-virtual_dir_in_archive(suite) ->
- [];
-virtual_dir_in_archive(doc) ->
- ["Read virtual directories from archive."];
+%% Read virtual directories from archive.
virtual_dir_in_archive(Config) when is_list(Config) ->
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
Data = <<"A little piece of data.">>,
ArchiveBase = "archive_with_virtual_dirs",
Archive = filename:join([PrivDir, ArchiveBase ++ init:archive_extension()]),
@@ -535,29 +519,29 @@ virtual_dir_in_archive(Config) when is_list(Config) ->
FileInArchive = filename:join([ArchiveBase, EbinBase, FileBase]),
BinFiles = [{FileInArchive, Data}],
Opts = [{compress, []}],
- ?line file:delete(Archive),
+ file:delete(Archive),
io:format("zip:create(~p,\n\t~p,\n\t~p).\n", [Archive, BinFiles, Opts]),
- ?line {ok, Archive} = zip:create(Archive, BinFiles, Opts),
+ {ok, Archive} = zip:create(Archive, BinFiles, Opts),
%% Verify that there is no directories
- ?line {ok, BinFiles} = zip:unzip(Archive, [memory]),
+ {ok, BinFiles} = zip:unzip(Archive, [memory]),
FullPath = filename:join([Archive, FileInArchive]),
- ?line {ok, _} = erl_prim_loader:read_file_info(FullPath),
+ {ok, _} = erl_prim_loader:read_file_info(FullPath),
%% Read one virtual dir
EbinDir = filename:dirname(FullPath),
- ?line {ok, _} = erl_prim_loader:read_file_info(EbinDir),
- ?line {ok, [FileBase]} = erl_prim_loader:list_dir(EbinDir),
+ {ok, _} = erl_prim_loader:read_file_info(EbinDir),
+ {ok, [FileBase]} = erl_prim_loader:list_dir(EbinDir),
%% Read another virtual dir
AppDir = filename:dirname(EbinDir),
- ?line {ok, _} = erl_prim_loader:read_file_info(AppDir),
- ?line {ok, [EbinBase]} = erl_prim_loader:list_dir(AppDir),
-
+ {ok, _} = erl_prim_loader:read_file_info(AppDir),
+ {ok, [EbinBase]} = erl_prim_loader:list_dir(AppDir),
+
%% Cleanup
ok = erl_prim_loader:purge_archive_cache(),
- ?line ok = file:delete(Archive),
+ ok = file:delete(Archive),
ok.
%%%
@@ -620,7 +604,7 @@ compile_app(TopDir, AppName) ->
AppDir = filename:join([TopDir, AppName]),
SrcDir = filename:join([AppDir, "src"]),
OutDir = filename:join([AppDir, "ebin"]),
- ?line {ok, Files} = file:list_dir(SrcDir),
+ {ok, Files} = file:list_dir(SrcDir),
compile_files(Files, SrcDir, OutDir).
compile_files([File | Files], SrcDir, OutDir) ->