aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/test
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-08-17 15:38:35 +0200
committerSiri Hansen <[email protected]>2012-08-20 15:56:06 +0200
commitee8e60f1c160e576a040a92d28f3a3eed1cb572a (patch)
tree05bec74fe6a408b433a041ac10cddbdf5a01ae2b /lib/reltool/test
parent2a017b471cb2096eccf2f908f38a7a5305901788 (diff)
downloadotp-ee8e60f1c160e576a040a92d28f3a3eed1cb572a.tar.gz
otp-ee8e60f1c160e576a040a92d28f3a3eed1cb572a.tar.bz2
otp-ee8e60f1c160e576a040a92d28f3a3eed1cb572a.zip
[reltool] Add option {excl_lib,otp_root}
With this option reltool will create a target structure with only the applications found in specified 'lib_dirs' (on system level) or 'lib_dir' (on app level). Erts will not be included, and no applications found under $OTP_ROOT/lib.
Diffstat (limited to 'lib/reltool/test')
-rw-r--r--lib/reltool/test/reltool_server_SUITE.erl67
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/Makefile.src11
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/ebin/a.app7
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl49
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl37
5 files changed, 160 insertions, 11 deletions
diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl
index 8a98dc36cf..f29f6049a5 100644
--- a/lib/reltool/test/reltool_server_SUITE.erl
+++ b/lib/reltool/test/reltool_server_SUITE.erl
@@ -67,6 +67,7 @@ all() ->
create_standalone_app_clash,
create_multiple_standalone,
create_old_target,
+ create_slim,
eval_target_spec,
otp_9135,
otp_9229_dupl_mod_exclude_app,
@@ -985,6 +986,56 @@ create_old_target(_Config) ->
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate target system
+
+create_slim(Config) ->
+ %% Configure the server
+ RelName = "slim",
+ RelVsn = "1.0",
+
+ DataDir = ?config(data_dir,Config),
+ LibDir = filename:join(DataDir,"slim"),
+
+ Sys =
+ {sys,
+ [
+ {root_dir, code:root_dir()},
+ {lib_dirs, []},
+ {boot_rel, RelName},
+ {rel, RelName, RelVsn, [sasl, stdlib, kernel, a]},
+ {app, sasl, [{incl_cond, include}]},
+ {app, a, [{incl_cond, include},
+ {lib_dir,filename:join(LibDir,"a-1.0")}]},
+ {excl_lib,otp_root}
+ ]},
+
+ %% Generate target file
+ TargetDir = filename:absname(filename:join([?WORK_DIR, "target_slim"])),
+ ?m(ok, reltool_utils:recursive_delete(TargetDir)),
+ ?m(ok, file:make_dir(TargetDir)),
+ ?log("SPEC: ~p\n", [reltool:get_target_spec([{config, Sys}])]),
+ ok = ?m(ok, reltool:create_target([{config, Sys}], TargetDir)),
+
+ TargetLibDir = filename:join(TargetDir,"lib"),
+ TargetRelDir = filename:join(TargetDir,"releases"),
+ TargetRelVsnDir = filename:join(TargetRelDir,RelVsn),
+
+ {ok,["a-1.0.ez"]} = file:list_dir(TargetLibDir),
+
+ RootDir = code:root_dir(),
+ Erl = filename:join([RootDir, "bin", "erl"]),
+ Args = "-boot_var RELTOOL_EXT_LIB " ++ TargetLibDir ++
+ " -boot " ++ filename:join(TargetRelVsnDir,RelName) ++
+ " -sasl releases_dir \\\"" ++ TargetRelDir ++ "\\\"",
+ {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl, Args)),
+ ?msym(RootDir, rpc:call(Node, code, root_dir, [])),
+ ?msym([{RelName,RelVsn,_,permanent}],
+ rpc:call(Node,release_handler,which_releases,[])),
+ ?msym(ok, stop_node(Node)),
+
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Generate target system with eval_target_spec/3
eval_target_spec(_Config) ->
@@ -2226,8 +2277,10 @@ mod_path(Node,Mod) ->
%% Node handling
start_node(Name, ErlPath) ->
+ start_node(Name, ErlPath, []).
+start_node(Name, ErlPath, Args) ->
FullName = full_node_name(Name),
- CmdLine = mk_node_cmdline(Name, ErlPath),
+ CmdLine = mk_node_cmdline(Name, ErlPath, Args),
io:format("Starting node ~p: ~s~n", [FullName, CmdLine]),
case open_port({spawn, CmdLine}, []) of
Port when is_port(Port) ->
@@ -2246,14 +2299,7 @@ stop_node(Node) ->
spawn(Node, fun () -> halt() end),
receive {nodedown, Node} -> ok end.
-mk_node_cmdline(Name) ->
- Prog = case catch init:get_argument(progname) of
- {ok,[[P]]} -> P;
- _ -> exit(no_progname_argument_found)
- end,
- mk_node_cmdline(Name, Prog).
-
-mk_node_cmdline(Name, Prog) ->
+mk_node_cmdline(Name, Prog, Args) ->
Static = "-detached -noinput",
Pa = filename:dirname(code:which(?MODULE)),
NameSw = case net_kernel:longnames() of
@@ -2268,7 +2314,8 @@ mk_node_cmdline(Name, Prog) ->
++ NameSw ++ " " ++ NameStr ++ " "
++ "-pa " ++ Pa ++ " "
++ "-env ERL_CRASH_DUMP " ++ Pwd ++ "/erl_crash_dump." ++ NameStr ++ " "
- ++ "-setcookie " ++ atom_to_list(erlang:get_cookie()).
+ ++ "-setcookie " ++ atom_to_list(erlang:get_cookie())
+ ++ " " ++ Args.
full_node_name(PreName) ->
HostSuffix = lists:dropwhile(fun ($@) -> false; (_) -> true end,
diff --git a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
index 21410ceaa9..02846f42b6 100644
--- a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
+++ b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
@@ -22,7 +22,11 @@ SEL_VSN= \
use_selected_vsn/b-3.0/ebin/b.@EMULATOR@ \
use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@
-all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT) $(SEL_VSN)
+SLIM= \
+ slim/a-1.0/ebin/a_sup.@EMULATOR@ \
+ slim/a-1.0/ebin/a.@EMULATOR@
+
+all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT) $(SEL_VSN) $(SLIM)
otp_9229/x-1.0/ebin/x.@EMULATOR@: otp_9229/x-1.0/src/x.erl
erlc $(EFLAGS) -ootp_9229/x-1.0/ebin otp_9229/x-1.0/src/x.erl
@@ -55,3 +59,8 @@ use_selected_vsn/b-3.0/ebin/b.@EMULATOR@: use_selected_vsn/b-3.0/src/b.erl
erlc $(EFLAGS) -ouse_selected_vsn/b-3.0/ebin use_selected_vsn/b-3.0/src/b.erl
use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@: use_selected_vsn/lib2/b-2.0/src/b.erl
erlc $(EFLAGS) -ouse_selected_vsn/lib2/b-2.0/ebin use_selected_vsn/lib2/b-2.0/src/b.erl
+
+slim/a-1.0/ebin/a_sup.@EMULATOR@: slim/a-1.0/src/a_sup.erl
+ erlc $(EFLAGS) -oslim/a-1.0/ebin slim/a-1.0/src/a_sup.erl
+slim/a-1.0/ebin/a.@EMULATOR@: slim/a-1.0/src/a.erl
+ erlc $(EFLAGS) -oslim/a-1.0/ebin slim/a-1.0/src/a.erl
diff --git a/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/ebin/a.app b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/ebin/a.app
new file mode 100644
index 0000000000..3160e00da7
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/ebin/a.app
@@ -0,0 +1,7 @@
+{application, a,
+ [{description, "A CXC 138 11"},
+ {vsn, "1.0"},
+ {modules, [a, a_sup]},
+ {registered, [a_sup]},
+ {applications, [kernel, stdlib]},
+ {mod, {a_sup, []}}]}.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl
new file mode 100644
index 0000000000..bb500bed69
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl
@@ -0,0 +1,49 @@
+%% ``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 via the world wide web 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.
+%%
+%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
+%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
+%% AB. All Rights Reserved.''
+%%
+%% $Id$
+%%
+-module(a).
+
+
+-behaviour(gen_server).
+
+-vsn(1).
+
+%% External exports
+-export([start_link/0, a/0]).
+%% Internal exports
+-export([init/1, handle_call/3, handle_info/2, terminate/2]).
+
+start_link() -> gen_server:start_link({local, aa}, a, [], []).
+
+a() -> gen_server:call(aa, a).
+
+%%-----------------------------------------------------------------
+%% Callback functions from gen_server
+%%-----------------------------------------------------------------
+init([]) ->
+ process_flag(trap_exit, true),
+ {ok, state}.
+
+handle_call(a, _From, State) ->
+ X = application:get_all_env(a),
+ {reply, X, State}.
+
+handle_info(_, State) ->
+ {noreply, State}.
+
+terminate(_Reason, _State) ->
+ ok.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl
new file mode 100644
index 0000000000..a141c1767b
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl
@@ -0,0 +1,37 @@
+%% ``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 via the world wide web 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.
+%%
+%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
+%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
+%% AB. All Rights Reserved.''
+%%
+%% $Id$
+%%
+-module(a_sup).
+
+
+-behaviour(supervisor).
+
+%% External exports
+-export([start/2]).
+
+%% Internal exports
+-export([init/1]).
+
+start(_, _) ->
+ supervisor:start_link({local, a_sup}, a_sup, []).
+
+init([]) ->
+ SupFlags = {one_for_one, 4, 3600},
+ Config = {a,
+ {a, start_link, []},
+ permanent, 2000, worker, [a]},
+ {ok, {SupFlags, [Config]}}.