aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/rlx_app_info_tests.erl40
-rw-r--r--test/rlx_archive_SUITE.erl94
-rw-r--r--test/rlx_eunit_SUITE.erl50
-rw-r--r--test/rlx_release_SUITE.erl221
-rw-r--r--test/rlx_test_utils.erl4
5 files changed, 401 insertions, 8 deletions
diff --git a/test/rlx_app_info_tests.erl b/test/rlx_app_info_tests.erl
new file mode 100644
index 0000000..451efe4
--- /dev/null
+++ b/test/rlx_app_info_tests.erl
@@ -0,0 +1,40 @@
+%% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 92 -*-
+%%% Copyright 2012 Erlware, LLC. All Rights Reserved.
+%%%
+%%% This file is provided to you under the Apache License,
+%%% Version 2.0 (the "License"); you may not use this file
+%%% except in compliance with the License. You may obtain
+%%% a copy of the License at
+%%%
+%%% http://www.apache.org/licenses/LICENSE-2.0
+%%%
+%%% Unless required by applicable law or agreed to in writing,
+%%% software distributed under the License is distributed on an
+%%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%%% KIND, either express or implied. See the License for the
+%%% specific language governing permissions and limitations
+%%% under the License.
+%%%---------------------------------------------------------------------------
+%%% @doc test for target spec parsing
+-module(rlx_app_info_tests).
+
+-include_lib("eunit/include/eunit.hrl").
+-include("relx.hrl").
+
+name_test() ->
+ {ok, AppInfo0} = rlx_app_info:new(),
+ AppInfo1 = rlx_app_info:name(AppInfo0, app_name),
+ ?assertMatch(app_name,
+ rlx_app_info:name(AppInfo1)).
+
+vsn_test() ->
+ {ok, AppInfo0} = rlx_app_info:new(),
+ {ok, AppInfo1} = rlx_app_info:vsn(AppInfo0, "1.2.3"),
+ ?assertMatch({{1,2,3},{[],[]}},
+ rlx_app_info:vsn(AppInfo1)).
+
+dir_test() ->
+ {ok, AppInfo0} = rlx_app_info:new(),
+ AppInfo1 = rlx_app_info:dir(AppInfo0, "dir"),
+ ?assertMatch("dir",
+ rlx_app_info:dir(AppInfo1)).
diff --git a/test/rlx_archive_SUITE.erl b/test/rlx_archive_SUITE.erl
index 2373fa0..08da2b8 100644
--- a/test/rlx_archive_SUITE.erl
+++ b/test/rlx_archive_SUITE.erl
@@ -10,7 +10,8 @@
basic_tar/1,
exclude_erts/1,
exclude_src/1,
- include_src/1]).
+ include_src/1,
+ overlay_archive/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@@ -35,7 +36,8 @@ init_per_testcase(_, Config) ->
{state, State1} | Config].
all() ->
- [basic_tar, exclude_erts, exclude_src, include_src].
+ [basic_tar, exclude_erts, exclude_src, include_src,
+ overlay_archive].
basic_tar(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -227,3 +229,91 @@ include_src(Config) ->
?assert(lists:any(fun(X) -> re:run(X, "lib/stdlib-.*/src/.*") =/= nomatch end, Files)),
?assert(lists:any(fun(X) -> re:run(X, "lib/kernel-.*/src/.*") =/= nomatch end, Files)),
?assert(filelib:is_regular(TarFile)).
+
+overlay_archive(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ OverlayVars1 = filename:join([LibDir1, "vars1.config"]),
+ OverlayVars2 = filename:join([LibDir1, "vars2.config"]),
+ OverlayVars3 = filename:join([LibDir1, "vars3.config"]),
+ Template = filename:join([LibDir1, "test_template"]),
+ TestDir = "first_test_dir",
+ TestFile = "test_file",
+ TestDirFull = filename:join([LibDir1, TestDir]),
+ TestFileFull = filename:join(TestDirFull, TestFile),
+ SecondTestDir = "second_test_dir",
+ rlx_test_utils:write_config(ConfigFile,
+ [{overlay_vars, [OverlayVars1, OverlayVars2]},
+ {overlay, [{mkdir, "{{target_dir}}/fooo"},
+ {copy, OverlayVars1,
+ "{{target_dir}}/{{foo_dir}}/vars1.config"},
+ {copy, OverlayVars1,
+ "{{target_dir}}/{{yahoo}}/"},
+ {link, OverlayVars1,
+ "{{target_dir}}/{{yahoo}}/vars.link.config"},
+ {copy, TestDirFull,
+ "{{target_dir}}/"++SecondTestDir++"/"},
+ {template, Template,
+ "{{target_dir}}/test_template_resolved"},
+ {template, Template,
+ "bin/{{default_release_name}}-{{default_release_version}}"}]},
+ {release, {foo, "0.0.1"},
+ [goal_app_1,
+ goal_app_2]}]),
+
+ VarsFile1 = filename:join([LibDir1, "vars1.config"]),
+ rlx_test_utils:write_config(VarsFile1, [{yahoo, "yahoo"},
+ {yahoo2, [{foo, "bar"}]},
+ {foo_yahoo, "foo_{{yahoo}}"},
+ {foo_dir, "foodir"}]),
+
+ VarsFile2 = filename:join([LibDir1, "vars2.config"]),
+ rlx_test_utils:write_config(VarsFile2, [{google, "yahoo"},
+ {yahoo2, "foo"},
+ OverlayVars3]),
+
+ VarsFile3 = filename:join([LibDir1, "vars3.config"]),
+ rlx_test_utils:write_config(VarsFile3, [{google, "yahoo"},
+ {yahoo4, "{{yahoo}}/{{yahoo2}}4"}]),
+
+ ok = rlx_util:mkdir_p(TestDirFull),
+ ok = file:write_file(TestFileFull, rlx_test_utils:test_template_contents()),
+
+ TemplateFile = filename:join([LibDir1, "test_template"]),
+ ok = file:write_file(TemplateFile, rlx_test_utils:test_template_contents()),
+ {ok, FileInfo} = file:read_file_info(TemplateFile),
+ ok = file:write_file_info(TemplateFile, FileInfo#file_info{mode=8#00777}),
+
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+
+ {ok, State} = relx:do([{relname, foo},
+ {relvsn, "0.0.1"},
+ {goals, []},
+ {lib_dirs, [LibDir1]},
+ {log_level, 3},
+ {output_dir, OutputDir},
+ {config, ConfigFile}], ["release", "tar"]),
+
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)),
+
+ TarFile = filename:join([OutputDir, "foo", "foo-0.0.1.tar.gz"]),
+ {ok, Files} = erl_tar:table(TarFile, [compressed]),
+ ?assert(lists:any(fun(X) -> re:run(X, "lib/stdlib-.*/src/.*") =/= nomatch end, Files)),
+ ?assert(lists:any(fun(X) -> re:run(X, "lib/kernel-.*/src/.*") =/= nomatch end, Files)),
+ ?assert(filelib:is_regular(TarFile)).
diff --git a/test/rlx_eunit_SUITE.erl b/test/rlx_eunit_SUITE.erl
new file mode 100644
index 0000000..d429f36
--- /dev/null
+++ b/test/rlx_eunit_SUITE.erl
@@ -0,0 +1,50 @@
+%% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 92 -*-
+%%% Copyright 2012 Erlware, LLC. All Rights Reserved.
+%%%
+%%% This file is provided to you under the Apache License,
+%%% Version 2.0 (the "License"); you may not use this file
+%%% except in compliance with the License. You may obtain
+%%% a copy of the License at
+%%%
+%%% http://www.apache.org/licenses/LICENSE-2.0
+%%%
+%%% Unless required by applicable law or agreed to in writing,
+%%% software distributed under the License is distributed on an
+%%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%%% KIND, either express or implied. See the License for the
+%%% specific language governing permissions and limitations
+%%% under the License.
+%%%-------------------------------------------------------------------
+-module(rlx_eunit_SUITE).
+
+-export([suite/0,
+ init_per_suite/1,
+ end_per_suite/1,
+ all/0,
+ depsolver/1,
+ goal/1,
+ app_info/1]).
+
+-include_lib("common_test/include/ct.hrl").
+-include_lib("eunit/include/eunit.hrl").
+
+suite() ->
+ [{timetrap,{seconds,30}}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+all() ->
+ [depsolver, goal, app_info].
+
+depsolver(_Config) ->
+ ok = eunit:test(rlx_depsolver).
+
+goal(_Config) ->
+ ok = eunit:test(rlx_goal).
+
+app_info(_Config) ->
+ ok = eunit:test(rlx_app_info).
diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl
index 780b1c8..2b30923 100644
--- a/test/rlx_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -24,9 +24,12 @@
end_per_suite/1,
init_per_testcase/2,
all/0,
+ providers/1,
add_providers/1,
make_release/1,
+ make_config_release/1,
make_extend_release/1,
+ make_extend_config_release/1,
make_scriptless_release/1,
make_overridden_release/1,
make_skip_app_release/1,
@@ -45,7 +48,10 @@
make_dev_mode_release/1,
make_config_script_release/1,
make_release_twice/1,
- make_release_twice_dev_mode/1]).
+ make_release_twice_dev_mode/1,
+ make_erts_release/1,
+ make_erts_config_release/1,
+ make_included_nodetool_release/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@@ -70,14 +76,16 @@ init_per_testcase(_, Config) ->
{state, State1} | Config].
all() ->
- [add_providers, make_release, make_extend_release, make_scriptless_release,
+ [providers, add_providers, make_release, make_config_release,
+ make_extend_release, make_extend_config_release, make_scriptless_release,
make_overridden_release, make_auto_skip_empty_app_release,
make_skip_app_release, make_exclude_app_release, make_app_type_none_release,
make_implicit_config_release, make_rerun_overridden_release,
overlay_release, make_goalless_release, make_depfree_release,
make_invalid_config_release, make_relup_release, make_relup_release2,
make_one_app_top_level_release, make_dev_mode_release,
- make_config_script_release, make_release_twice, make_release_twice_dev_mode].
+ make_config_script_release, make_release_twice, make_release_twice_dev_mode,
+ make_erts_release, make_erts_config_release, make_included_nodetool_release].
add_providers(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -116,6 +124,43 @@ add_providers(Config) ->
?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+providers(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ [(fun({Name, Vsn}) ->
+ rlx_test_utils:create_app(LibDir1, Name, Vsn, [kernel, stdlib], [])
+ end)(App)
+ ||
+ App <-
+ [{rlx_test_utils:create_random_name("lib_app1_"), rlx_test_utils:create_random_vsn()}
+ || _ <- lists:seq(1, 100)]],
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"},
+ [goal_app_1,
+ goal_app_2]},
+ {providers, [rlx_prv_app_discover]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+
make_release(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -155,6 +200,48 @@ make_release(Config) ->
?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+make_config_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ [(fun({Name, Vsn}) ->
+ rlx_test_utils:create_app(LibDir1, Name, Vsn, [kernel, stdlib], [])
+ end)(App)
+ ||
+ App <-
+ [{rlx_test_utils:create_random_name("lib_app1_"), rlx_test_utils:create_random_vsn()}
+ || _ <- lists:seq(1, 100)]],
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"},
+ [goal_app_1,
+ goal_app_2],
+ [{some, config1}]},
+ {release, {foo, "0.0.2"},
+ [goal_app_1,
+ goal_app_2],
+ [{some, config2}]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo, "0.0.2"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)),
+ ?assertEqual([{some, config2}], rlx_release:config(Release)).
+
make_extend_release(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -190,6 +277,43 @@ make_extend_release(Config) ->
?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+make_extend_config_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"},
+ [goal_app_1,
+ goal_app_2]},
+ {release, {foo_test, "0.0.1", {extend, foo}},
+ [goal_app_2],
+ [{some, config}]},
+ {lib_dirs, [filename:join(LibDir1, "*")]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+
+ ?assertMatch({error, {rlx_prv_release, {multiple_release_names,foo_test,foo}}},
+ catch relx:do(undefined, undefined, [], [LibDir1], 3, OutputDir, ConfigFile)),
+
+ {ok, State} = relx:do(foo_test, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo_test, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)),
+ ?assertEqual([{some, config}], rlx_release:config(Release)).
+
make_invalid_config_release(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -524,6 +648,7 @@ overlay_release(Config) ->
OverlayVars1 = filename:join([LibDir1, "vars1.config"]),
OverlayVars2 = filename:join([LibDir1, "vars2.config"]),
OverlayVars3 = filename:join([LibDir1, "vars3.config"]),
+ OverlayVars4 = filename:join([LibDir1, "vars4.config"]),
Template = filename:join([LibDir1, "test_template"]),
TestDir = "first_test_dir",
TestFile = "test_file",
@@ -531,12 +656,14 @@ overlay_release(Config) ->
TestFileFull = filename:join(TestDirFull, TestFile),
SecondTestDir = "second_test_dir",
rlx_test_utils:write_config(ConfigFile,
- [{overlay_vars, [OverlayVars1, OverlayVars2]},
+ [{overlay_vars, [OverlayVars1, OverlayVars2, OverlayVars4]},
{overlay, [{mkdir, "{{target_dir}}/fooo"},
{copy, OverlayVars1,
"{{target_dir}}/{{foo_dir}}/vars1.config"},
{copy, OverlayVars1,
"{{target_dir}}/{{yahoo}}/"},
+ {link, OverlayVars4,
+ "{{target_dir}}/{{yahoo}}/vars4.config"},
{copy, TestDirFull,
"{{target_dir}}/"++SecondTestDir++"/"},
{template, Template,
@@ -562,6 +689,10 @@ overlay_release(Config) ->
rlx_test_utils:write_config(VarsFile3, [{google, "yahoo"},
{yahoo4, "{{yahoo}}/{{yahoo2}}4"}]),
+ VarsFile4 = filename:join([LibDir1, "vars4.config"]),
+ rlx_test_utils:write_config(VarsFile4, [{prop1, "val1"},
+ {prop2, 2}]),
+
ok = rlx_util:mkdir_p(TestDirFull),
ok = file:write_file(TestFileFull, rlx_test_utils:test_template_contents()),
@@ -614,7 +745,11 @@ overlay_release(Config) ->
?assertEqual("foo_yahoo",
proplists:get_value(foo_yahoo, TemplateData)),
?assertEqual("yahoo",
- proplists:get_value(google, TemplateData)).
+ proplists:get_value(google, TemplateData)),
+ ?assertEqual("val1",
+ proplists:get_value(prop1, TemplateData)),
+ ?assertEqual(2,
+ proplists:get_value(prop2, TemplateData)).
make_goalless_release(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -1036,6 +1171,82 @@ make_release_twice_dev_mode(Config) ->
?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs1)),
?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs1)).
+make_erts_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [kernel,stdlib], []),
+
+ ErtsVsn = erlang:system_info(version),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"}, {erts, ErtsVsn},
+ [goal_app_1]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assertEqual(ErtsVsn, rlx_release:erts(Release)).
+
+make_erts_config_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [kernel,stdlib], []),
+
+ ErtsVsn = erlang:system_info(version),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"}, {erts, ErtsVsn},
+ [goal_app_1],
+ [{some, config}]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assertEqual(ErtsVsn, rlx_release:erts(Release)),
+ ?assertEqual([{some, config}], rlx_release:config(Release)).
+
+make_included_nodetool_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+
+ rlx_test_utils:create_app(LibDir1, "goal_app_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "lib_dep_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "goal_app_2", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_1", "0.0.1", [kernel,stdlib], []),
+ rlx_test_utils:create_app(LibDir1, "non_goal_2", "0.0.1", [kernel,stdlib], []),
+
+ ErtsVsn = erlang:system_info(version),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ rlx_test_utils:write_config(ConfigFile,
+ [{release, {foo, "0.0.1"}, {erts, ErtsVsn},
+ [goal_app_1]},
+ {extended_start_script, true},
+ {include_nodetool, true}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 3,
+ OutputDir, ConfigFile),
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
+ AppSpecs = rlx_release:applications(Release),
+ ?assert(lists:keymember(stdlib, 1, AppSpecs)),
+ ?assert(lists:keymember(kernel, 1, AppSpecs)),
+ ?assertEqual(ErtsVsn, rlx_release:erts(Release)).
+
%%%===================================================================
%%% Helper Functions
%%%===================================================================
diff --git a/test/rlx_test_utils.erl b/test/rlx_test_utils.erl
index b26e143..279a887 100644
--- a/test/rlx_test_utils.erl
+++ b/test/rlx_test_utils.erl
@@ -76,7 +76,9 @@ test_template_contents() ->
"{yahoo, \"{{yahoo}}\"}.\n"
"{foo_dir, \"{{foo_dir}}\"}.\n"
"{foo_yahoo, \"{{foo_yahoo}}\"}.\n"
- "{google, \"{{google}}\"}.\n".
+ "{google, \"{{google}}\"}.\n"
+ "{prop1, \"{{prop1}}\"}.\n"
+ "{prop2, {{prop2}}}.\n".
-ifdef(rand_module).
random_uniform(N) ->