aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlexander V. Nikolaev <[email protected]>2013-05-29 15:59:26 +0300
committerTristan Sloughter <[email protected]>2013-09-16 22:17:57 -0500
commit61bc82aadad1d86a0b892d49ba0217ba01d2e088 (patch)
treef4d82e234ceb7608a024d74f9f959ac5437271ae /test
parent13e3e74c7bc84577904515d278b7a5272c25d2e5 (diff)
downloadrelx-61bc82aadad1d86a0b892d49ba0217ba01d2e088.tar.gz
relx-61bc82aadad1d86a0b892d49ba0217ba01d2e088.tar.bz2
relx-61bc82aadad1d86a0b892d49ba0217ba01d2e088.zip
Check presence of each beam listed in .app
This allow to build riak, because one of riak deps (node_package) have stuff in priv/ and valid node_package.app, but no one .beam files.
Diffstat (limited to 'test')
-rw-r--r--test/rlx_discover_SUITE.erl6
-rw-r--r--test/rlx_release_SUITE.erl54
2 files changed, 49 insertions, 11 deletions
diff --git a/test/rlx_discover_SUITE.erl b/test/rlx_discover_SUITE.erl
index d404d8c..c4455e1 100644
--- a/test/rlx_discover_SUITE.erl
+++ b/test/rlx_discover_SUITE.erl
@@ -88,7 +88,7 @@ normal_case(Config) ->
?assertMatch(Length, erlang:length(rlx_state:available_apps(State2))).
no_beam_case(Config) ->
- %% We silently ignore apps with no beams
+ %% do not ignore apps with no beam files if no modules in app file
LibDir1 = proplists:get_value(lib1, Config),
_Apps1 = [(fun({Name, Vsn}) ->
create_app(LibDir1, Name, Vsn)
@@ -111,8 +111,8 @@ no_beam_case(Config) ->
write_app_file(AppDir, BadName, BadVsn),
State0 = proplists:get_value(state, Config),
{DiscoverProvider, {ok, State1}} = rlx_provider:new(rlx_prv_discover, State0),
- EbinDir = filename:join([LibDir2, BadName, <<"ebin">>]),
- ?assertMatch({error, {_, [{no_beam_files, EbinDir}]}},
+
+ ?assertMatch({ok, _},
rlx_provider:do(DiscoverProvider, State1)).
bad_ebin_case(Config) ->
diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl
index aea28f2..b862bfa 100644
--- a/test/rlx_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -28,6 +28,7 @@
make_scriptless_release/1,
make_overridden_release/1,
make_skip_app_release/1,
+ make_auto_skip_empty_app_release/1,
make_rerun_overridden_release/1,
make_implicit_config_release/1,
overlay_release/1,
@@ -63,6 +64,7 @@ init_per_testcase(_, Config) ->
all() ->
[make_release, make_scriptless_release, make_overridden_release,
make_skip_app_release,
+ make_auto_skip_empty_app_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,
@@ -222,8 +224,45 @@ make_overridden_release(Config) ->
?assertMatch(OverrideAppDir, Real).
make_skip_app_release(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+ [(fun({Name, Vsn}) ->
+ create_app(LibDir1, Name, Vsn, [kernel, stdlib], [])
+ end)(App)
+ ||
+ App <-
+ [{create_random_name("lib_app1_"), create_random_vsn()}
+ || _ <- lists:seq(1, 100)]],
+
+ create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
+ create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
+ create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ write_config(ConfigFile,
+ [{release, {foo, "0.0.1"},
+ [goal_app_1]},
+ {skip_apps, [goal_app_2]}]),
+ OutputDir = filename:join([proplists:get_value(data_dir, Config),
+ create_random_name("relx-output")]),
+ {ok, Cwd} = file:get_cwd(),
+ {ok, State} = relx:do(Cwd, undefined, undefined, [], [LibDir1], 2,
+ 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)),
+ ?assertNot(lists:member({non_goal_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)),
+ ?assertNot(lists:member({goal_app_2, "0.0.1"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+
+make_auto_skip_empty_app_release(Config) ->
DataDir = proplists:get_value(data_dir, Config),
- SkipAppDir1 = filename:join([DataDir, create_random_name("skip_app_dir_")]),
+ EmptyAppDir1 = filename:join([DataDir, create_random_name("skip_app_dir_")]),
LibDir1 = proplists:get_value(lib1, Config),
[(fun({Name, Vsn}) ->
create_app(LibDir1, Name, Vsn, [kernel, stdlib], [])
@@ -232,9 +271,9 @@ make_skip_app_release(Config) ->
App <-
[{create_random_name("lib_app1_"), create_random_vsn()}
|| _ <- lists:seq(1, 100)]],
- SkipAppApp = create_random_name("skip_app_app"),
- SkipAppVsn = create_random_vsn(),
- SkipAppAppName = erlang:list_to_atom(SkipAppApp),
+ EmptyAppApp = create_random_name("empty_app_app"),
+ EmptyAppVsn = create_random_vsn(),
+ EmptyAppAppName = erlang:list_to_atom(EmptyAppApp),
create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []),
@@ -242,14 +281,13 @@ make_skip_app_release(Config) ->
create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]),
create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []),
- create_empty_app(SkipAppDir1, SkipAppApp, SkipAppVsn, [stdlib,kernel], []),
+ create_empty_app(EmptyAppDir1, EmptyAppApp, EmptyAppVsn, [stdlib,kernel], []),
ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1,
- goal_app_2]},
- {skip_apps, [erlang:list_to_atom(SkipAppApp)]}]),
+ goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
create_random_name("relx-output")]),
{ok, Cwd} = file:get_cwd(),
@@ -264,7 +302,7 @@ make_skip_app_release(Config) ->
?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)),
- ?assertNot(lists:member({SkipAppAppName, SkipAppVsn}, AppSpecs)),
+ ?assertNot(lists:member({EmptyAppAppName, EmptyAppVsn}, AppSpecs)),
?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
make_implicit_config_release(Config) ->