diff options
author | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
commit | 84adefa331c4159d432d22840663c38f155cd4c1 (patch) | |
tree | bff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/kernel/test/code_SUITE_data | |
download | otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2 otp-84adefa331c4159d432d22840663c38f155cd4c1.zip |
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/kernel/test/code_SUITE_data')
22 files changed, 365 insertions, 0 deletions
diff --git a/lib/kernel/test/code_SUITE_data/calendar.erl b/lib/kernel/test/code_SUITE_data/calendar.erl new file mode 100644 index 0000000000..c1a4a1c12a --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/calendar.erl @@ -0,0 +1,23 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(calendar). +-export([test/1]). + +test(apa) -> + {error, this_function_should_not_be_called}. diff --git a/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/ebin/code_archive_dict.app b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/ebin/code_archive_dict.app new file mode 100644 index 0000000000..e3b5a5ce03 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/ebin/code_archive_dict.app @@ -0,0 +1,12 @@ +{application, code_archive_dict, + [{description, "code_archive_dict"}, + {vsn, "1.0"}, + {modules, [ + code_archive_dict, + code_archive_dict_sup + ]}, + {registered, [ + code_archive_dict_sup + ]}, + {applications, [kernel, stdlib]}, + {mod, {code_archive_dict_app, [[]]}}]}. diff --git a/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/priv/code_archive.txt b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/priv/code_archive.txt new file mode 100644 index 0000000000..8fa2c8c064 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/priv/code_archive.txt @@ -0,0 +1 @@ +Some private data... diff --git a/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl new file mode 100644 index 0000000000..ccc954ee17 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl @@ -0,0 +1,125 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(code_archive_dict). +-behaviour(sys). + +%% Public +-export([new/1, store/3, erase/2, find/2, foldl/3, erase/1]). + +%% Internal +-export([init/3, loop/3]). + +%% supervisor callback +-export([start_link/2]). + +%% sys callback functions +-export([ + system_continue/3, + system_terminate/4, + system_code_change/4 + ]). + +-define(SUPERVISOR, code_archive_dict_sup). + +start_link(Name, Debug) -> + proc_lib:start_link(?MODULE, init, [self(), Name, Debug], infinity, []). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Client + +new(Name) -> + supervisor:start_child(?SUPERVISOR, [Name]). + +store(Pid, Key, Val) -> + call(Pid, {store, Key, Val}). + +erase(Pid, Key) -> + call(Pid, {erase, Key}). + +find(Pid, Key) -> + call(Pid, {find, Key}). + +foldl(Pid, Fun, Acc) -> + call(Pid, {foldl, Fun, Acc}). + +erase(Pid) -> + call(Pid, stop). + +call(Name, Msg) when is_atom(Name) -> + call(whereis(Name), Msg); +call(Pid, Msg) when is_pid(Pid) -> + Ref = erlang:monitor(process, Pid), + Pid ! {self(), Ref, Msg}, + receive + {Ref, Reply} -> + erlang:demonitor(Ref, [flush]), + Reply; + {'DOWN', Ref, _, _, Reason} -> + {error, Reason} + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Server + +init(Parent, Name, Debug) -> + register(Name, self()), + Dict = dict:new(), + proc_lib:init_ack(Parent, {ok, self()}), + loop(Dict, Parent, Debug). + +loop(Dict, Parent, Debug) -> + receive + {system, From, Msg} -> + sys:handle_system_msg(Msg, From, Parent, ?MODULE, Debug, Dict); + {ReplyTo, Ref, {store, Key, Val}} -> + Dict2 = dict:store(Key, Val, Dict), + ReplyTo ! {Ref, ok}, + ?MODULE:loop(Dict2, Parent, Debug); + {ReplyTo, Ref, {erase, Key}} -> + Dict2 = dict:erase(Key, Dict), + ReplyTo ! {Ref, ok}, + ?MODULE:loop(Dict2, Parent, Debug); + {ReplyTo, Ref, {find, Key}} -> + Res = dict:find(Key, Dict), + ReplyTo ! {Ref, Res}, + ?MODULE:loop(Dict, Parent, Debug); + {ReplyTo, Ref, {foldl, Fun, Acc}} -> + Acc2 = dict:foldl(Fun, Acc, Dict), + ReplyTo ! {Ref, {ok, Acc2}}, + ?MODULE:loop(Dict, Parent, Debug); + {ReplyTo, Ref, stop} -> + ReplyTo ! {Ref, ok}, + exit(normal); + Msg -> + error_logger:format("~p got unexpected message: ~p\n", + [self(), Msg]), + ?MODULE:loop(Dict, Parent, Debug) + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% sys callbacks + +system_continue(Parent, Debug, Dict) -> + ?MODULE:loop(Dict, Parent, Debug). + +system_terminate(Reason, _Parent, _Debug, _Dict) -> + exit(Reason). + +system_code_change(Dict,_Module,_OldVsn,_Extra) -> + {ok, Dict}. diff --git a/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl new file mode 100644 index 0000000000..a23ef7001d --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl @@ -0,0 +1,29 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(code_archive_dict_app). +-behaviour(application). + +%% Public +-export([start/2, stop/1]). + +start(_Type, Args) -> + code_archive_dict_sup:start_link(Args). + +stop(_State) -> + ok. diff --git a/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl new file mode 100644 index 0000000000..3e427ed34a --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl @@ -0,0 +1,39 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(code_archive_dict_sup). +-behaviour(supervisor). + +%% Public +-export([start_link/1]). + +%% Internal +-export([init/1, start_simple_child/2]). + +-define(CHILD_MOD, code_archive_dict). + +start_link(Debug) -> + supervisor:start_link({local, ?MODULE}, ?MODULE, [Debug]). + +init([Debug]) -> + Flags = {simple_one_for_one, 0, 3600}, + MFA = {?MODULE, start_simple_child, [Debug]}, + {ok, {Flags, [{?MODULE, MFA, transient, timer:seconds(3), worker, [?CHILD_MOD]}]}}. + +start_simple_child(Debug, Name) -> + ?CHILD_MOD:start_link(Name, Debug). diff --git a/lib/kernel/test/code_SUITE_data/dummy_app-1.0/ebin/dummy_file b/lib/kernel/test/code_SUITE_data/dummy_app-1.0/ebin/dummy_file new file mode 100644 index 0000000000..5b1ed2e49c --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/dummy_app-1.0/ebin/dummy_file @@ -0,0 +1 @@ +dummy_file diff --git a/lib/kernel/test/code_SUITE_data/dummy_app-1.0/priv/dummy_file b/lib/kernel/test/code_SUITE_data/dummy_app-1.0/priv/dummy_file new file mode 100644 index 0000000000..5b1ed2e49c --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/dummy_app-1.0/priv/dummy_file @@ -0,0 +1 @@ +dummy_file diff --git a/lib/kernel/test/code_SUITE_data/dummy_app-2.0/ebin/dummy_file b/lib/kernel/test/code_SUITE_data/dummy_app-2.0/ebin/dummy_file new file mode 100644 index 0000000000..5b1ed2e49c --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/dummy_app-2.0/ebin/dummy_file @@ -0,0 +1 @@ +dummy_file diff --git a/lib/kernel/test/code_SUITE_data/dummy_app-2.0/priv/dummy_file b/lib/kernel/test/code_SUITE_data/dummy_app-2.0/priv/dummy_file new file mode 100644 index 0000000000..5b1ed2e49c --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/dummy_app-2.0/priv/dummy_file @@ -0,0 +1 @@ +dummy_file diff --git a/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-a/ebin/.gitignore b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-a/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-a/ebin/.gitignore diff --git a/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl new file mode 100644 index 0000000000..e97dde2703 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl @@ -0,0 +1,24 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(lists). + +-export([not_your_standard_lists_module/0]). + +not_your_standard_lists_module() -> + ok. diff --git a/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl new file mode 100644 index 0000000000..3c9cd75f34 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl @@ -0,0 +1,24 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(code_SUITE_mult_root_module). + +-export([works_fine/0]). + +works_fine() -> + true. diff --git a/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-d/ebin/.gitignore b/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-d/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-d/ebin/.gitignore diff --git a/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-e/ebin/.gitignore b/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-e/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/mult_lib_roots/second_root/my_dummy_app-e/ebin/.gitignore diff --git a/lib/kernel/test/code_SUITE_data/on_load/on_load_a.erl b/lib/kernel/test/code_SUITE_data/on_load/on_load_a.erl new file mode 100644 index 0000000000..660000df46 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/on_load/on_load_a.erl @@ -0,0 +1,28 @@ +-module(on_load_a). +-on_load(on_load/0). +-export([data/0]). + +on_load() -> + ?MASTER ! {?MODULE,start}, + on_load_b:data(), + + %% Call local function. + 120 = fact(5), + + %% Call remote function. + LibDir = code:lib_dir(kernel), + + ?MASTER ! {?MODULE,LibDir}, + true. + +data() -> + [a|on_load_b:data()]. + +fact(N) -> + fact(N, 1). + +fact(0, P) -> P; +fact(1, P) -> P; +fact(N, P) -> fact(N-1, P*N). + + diff --git a/lib/kernel/test/code_SUITE_data/on_load/on_load_b.erl b/lib/kernel/test/code_SUITE_data/on_load/on_load_b.erl new file mode 100644 index 0000000000..5c4d676e2d --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/on_load/on_load_b.erl @@ -0,0 +1,12 @@ +-module(on_load_b). +-on_load(on_load/0). +-export([on_load/0,data/0]). + +on_load() -> + ?MASTER ! {?MODULE,start}, + on_load_c:data(), + ?MASTER ! {?MODULE,done}, + true. + +data() -> + [b|on_load_c:data()]. diff --git a/lib/kernel/test/code_SUITE_data/on_load/on_load_c.erl b/lib/kernel/test/code_SUITE_data/on_load/on_load_c.erl new file mode 100644 index 0000000000..4b2edbfb5a --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/on_load/on_load_c.erl @@ -0,0 +1,14 @@ +-module(on_load_c). +-on_load(on_load/0). +-export([data/0]). + +on_load() -> + ?MASTER ! {?MODULE,self()}, + receive + go -> + ?MASTER ! {?MODULE,done}, + true + end. + +data() -> + [c]. diff --git a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/ebin/on_load_app.app b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/ebin/on_load_app.app new file mode 100644 index 0000000000..6b79a74c0a --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/ebin/on_load_app.app @@ -0,0 +1,10 @@ +{application, on_load_app, + [ + {description, "ERTS CXC 138 10"}, + {vsn, "1.0"}, + {modules, [on_load_embedded]}, + {applications, []}, + {registered, []}, + {env, []} + ] +}. diff --git a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl new file mode 100644 index 0000000000..bfc26864d5 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl @@ -0,0 +1,18 @@ +-module(on_load_embedded). +-export([status/0]). +-on_load(run_me/0). + +run_me() -> + spawn(fun() -> + register(everything_is_fine, self()), + receive Any -> + ok + end + end), + true. + +status() -> + case whereis(everything_is_fine) of + Pid when is_pid(Pid) -> + ok + end. diff --git a/lib/kernel/test/code_SUITE_data/pa/dummy b/lib/kernel/test/code_SUITE_data/pa/dummy new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/pa/dummy @@ -0,0 +1 @@ + diff --git a/lib/kernel/test/code_SUITE_data/pz/dummy b/lib/kernel/test/code_SUITE_data/pz/dummy new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/lib/kernel/test/code_SUITE_data/pz/dummy @@ -0,0 +1 @@ + |