aboutsummaryrefslogtreecommitdiffstats
path: root/test/rlx_release_SUITE.erl
diff options
context:
space:
mode:
authorLuis Rascao <[email protected]>2016-11-20 22:19:08 +0000
committerLuis Rascao <[email protected]>2016-11-21 00:24:37 +0000
commit81369d99a9b6ee5caae6b5e6a5faffb8a65fb588 (patch)
tree8b3e2acce5896f977bd264fb1cf66a9ffe6e6fd6 /test/rlx_release_SUITE.erl
parentc305c89713abf48570e2db152b367f00ac641893 (diff)
downloadrelx-81369d99a9b6ee5caae6b5e6a5faffb8a65fb588.tar.gz
relx-81369d99a9b6ee5caae6b5e6a5faffb8a65fb588.tar.bz2
relx-81369d99a9b6ee5caae6b5e6a5faffb8a65fb588.zip
Provide a new config directive that allows per-app module exclusion
By introducing a new entry in the config file allow excluding specific modules from a given app, they will not be copied onto the final release and their reference removed from the .app file. The new entry takes on the following form: {exclude_modules, [ {App :: atom(), [Module :: atom()]} ]}
Diffstat (limited to 'test/rlx_release_SUITE.erl')
-rw-r--r--test/rlx_release_SUITE.erl45
1 files changed, 43 insertions, 2 deletions
diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl
index a017297..c9430fd 100644
--- a/test/rlx_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -55,7 +55,8 @@
make_included_nodetool_release/1,
make_not_included_nodetool_release/1,
make_src_release/1,
- make_excluded_src_release/1]).
+ make_excluded_src_release/1,
+ make_exclude_modules_release/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@@ -91,7 +92,7 @@ all() ->
make_config_script_release, make_release_twice, make_release_twice_dev_mode,
make_erts_release, make_erts_config_release,
make_included_nodetool_release, make_not_included_nodetool_release,
- make_src_release, make_excluded_src_release].
+ make_src_release, make_excluded_src_release, make_exclude_modules_release].
add_providers(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -1401,6 +1402,46 @@ make_excluded_src_release(Config) ->
?assert(not ec_file:exists(filename:join([OutputDir, "foo", "lib",
"goal_app_1-0.0.1", "src"]))).
+%% Test to ensure that excluded modules don't end up in the release
+make_exclude_modules_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, "non_goal_1", "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]},
+ {exclude_modules, [{non_goal_1, [a_real_beamnon_goal_1]}]}]),
+ OutputDir = filename:join([proplists:get_value(priv_dir, Config),
+ rlx_test_utils:create_random_name("relx-output")]),
+ {ok, Cwd} = file:get_cwd(),
+ {ok, State} = relx:do(Cwd, 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({goal_app_1, "0.0.1"}, AppSpecs)),
+ %% ensure that the excluded module beam file didn't get copied
+ ?assert(not ec_file:exists(filename:join([OutputDir, "foo", "lib",
+ "non_goal_1-0.0.1", "ebin",
+ "a_real_beamnon_goal_1.beam"]))),
+
+ ?assertMatch({ok, [{application,non_goal_1,
+ [{description,[]},
+ {vsn,"0.0.1"},
+ {modules,[]},
+ {included_applications,[]},
+ {registered,[]},
+ {applications,[stdlib,kernel]}]}]},
+ file:consult(filename:join([OutputDir, "foo", "lib",
+ "non_goal_1-0.0.1", "ebin",
+ "non_goal_1.app"]))).
+
+
%%%===================================================================
%%% Helper Functions
%%%===================================================================