summaryrefslogtreecommitdiff
path: root/test/rebar_test_utils.erl
diff options
context:
space:
mode:
authorKelly McLaughlin <kelly@kelly-mclaughlin.com>2015-03-22 22:09:27 -0600
committerKelly McLaughlin <kelly@kelly-mclaughlin.com>2015-03-23 09:29:09 -0600
commit81969f1cf68f9509ee1bb18a15695b610fd33bd7 (patch)
tree201451f976f83e680128bc0ce4bccd6ef42ec212 /test/rebar_test_utils.erl
parentcafd62e10185e2fc05490c387484dfdb2b615803 (diff)
Test cases to exercise the dev_mode release option
Add one test case to verify the dev_mode option for a release and another to verify overriding the dev_mode option in a profile for a release. Verification of proper dev_mode functioning is done in the rebar_test_utils:check_results/2 function by checking if all the directories in the release lib dir are symlinks or not and comparing that result to the dev_mode expectation passed as input to the check_results function.
Diffstat (limited to 'test/rebar_test_utils.erl')
-rw-r--r--test/rebar_test_utils.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl
index 7c52a18..c035b91 100644
--- a/test/rebar_test_utils.erl
+++ b/test/rebar_test_utils.erl
@@ -217,7 +217,7 @@ check_results(AppDir, Expected) ->
?assertEqual(iolist_to_binary(Vsn),
iolist_to_binary(LockVsn))
end
- ; ({release, Name, Vsn}) ->
+ ; ({release, Name, Vsn, ExpectedDevMode}) ->
ct:pal("Release: ~p-~s", [Name, Vsn]),
{ok, Cwd} = file:get_cwd(),
try
@@ -228,6 +228,15 @@ check_results(AppDir, Expected) ->
{ok, RelxState2} = rlx_prv_app_discover:do(RelxState1),
{ok, RelxState3} = rlx_prv_rel_discover:do(RelxState2),
+ LibDir = filename:join([ReleaseDir, Name, "lib"]),
+ {ok, RelLibs} = file:list_dir(LibDir),
+ IsSymLinkFun =
+ fun(X) ->
+ ec_file:is_symlink(filename:join(LibDir, X))
+ end,
+ DevMode = lists:all(IsSymLinkFun, RelLibs),
+ ?assertEqual(ExpectedDevMode, DevMode),
+
%% throws not_found if it doesn't exist
rlx_state:get_realized_release(RelxState3, Name, Vsn)
catch