aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/erl_prim_loader_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-02-26 13:09:07 +0100
committerBjörn Gustavsson <[email protected]>2016-02-26 13:09:07 +0100
commit6336e0dda8d668c24412775fb45aa8ad19ac384f (patch)
tree2e063c4bd6fdea8a5f3e76738bc96ce6ac8fdaf4 /lib/kernel/test/erl_prim_loader_SUITE.erl
parente76103a4549bc25937af5cdccbe43c1683613d07 (diff)
parent1703b979ffcbfbe44c9014f28384305fea930511 (diff)
downloadotp-6336e0dda8d668c24412775fb45aa8ad19ac384f.tar.gz
otp-6336e0dda8d668c24412775fb45aa8ad19ac384f.tar.bz2
otp-6336e0dda8d668c24412775fb45aa8ad19ac384f.zip
Merge branch 'bjorn/multiple-load/OTP-13111'
* bjorn/multiple-load/OTP-13111: code: Add functions that can load multiple modules Refactor post_beam_load handling Simplify and robustify code_server:all_loaded/1 Update preloaded modules Add erl_prim_loader:get_modules/3 Add has_prepared_code_on_load/1 BIF Allow erlang:finish_loading/1 to load more than one module beam_load.c: Add a function to check for an on_load function
Diffstat (limited to 'lib/kernel/test/erl_prim_loader_SUITE.erl')
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl37
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl
index bc14a2764d..bccca59b93 100644
--- a/lib/kernel/test/erl_prim_loader_SUITE.erl
+++ b/lib/kernel/test/erl_prim_loader_SUITE.erl
@@ -29,7 +29,8 @@
inet_existing/1, inet_coming_up/1, inet_disconnects/1,
multiple_slaves/1, file_requests/1,
local_archive/1, remote_archive/1,
- primary_archive/1, virtual_dir_in_archive/1]).
+ primary_archive/1, virtual_dir_in_archive/1,
+ get_modules/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
@@ -44,7 +45,8 @@ all() ->
normalize_and_backslash, inet_existing,
inet_coming_up, inet_disconnects, multiple_slaves,
file_requests, local_archive, remote_archive,
- primary_archive, virtual_dir_in_archive].
+ primary_archive, virtual_dir_in_archive,
+ get_modules].
groups() ->
[].
@@ -109,6 +111,37 @@ get_file(Config) when is_list(Config) ->
?line error = erl_prim_loader:get_file({dummy}),
ok.
+get_modules(_Config) ->
+ MsGood = lists:sort([lists,gen_server,gb_trees,code_server]),
+ Ms = [certainly_not_existing|MsGood],
+ SuccExp = [begin
+ F = code:which(M),
+ {ok,Code} = file:read_file(F),
+ {M,{F,erlang:md5(Code)}}
+ end || M <- MsGood],
+ FailExp = [{certainly_not_existing,enoent}],
+
+ Path = code:get_path(),
+ Process = fun(_, F, Code) -> {ok,{F,erlang:md5(Code)}} end,
+ {ok,{Succ,FailExp}} = erl_prim_loader:get_modules(Ms, Process, Path),
+ SuccExp = lists:sort(Succ),
+
+ Name = inet_get_modules,
+ {ok, Node, BootPid} = complete_start_node(Name),
+ ThisDir = filename:dirname(code:which(?MODULE)),
+ 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]),
+ SuccExp = lists:sort(InetSucc),
+
+ stop_node(Node),
+ unlink(BootPid),
+ exit(BootPid, kill),
+
+ ok.
+
+
normalize_and_backslash(Config) ->
%% Test OTP-11170
case os:type() of