aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJordan Wilberding <[email protected]>2013-05-14 20:59:32 -0700
committerJordan Wilberding <[email protected]>2013-05-14 20:59:32 -0700
commit834fc00544e4222e5fe1713c33d16e5192de33fe (patch)
tree1ae9a327feeb420983f9a85fdb6c800900369480 /test
parentd2698281ff1b0a46b2bcf6c2579cc811a3f62500 (diff)
parentc5f0a8c9175b2d152c69f72da15e7ceff411f86b (diff)
downloadrelx-834fc00544e4222e5fe1713c33d16e5192de33fe.tar.gz
relx-834fc00544e4222e5fe1713c33d16e5192de33fe.tar.bz2
relx-834fc00544e4222e5fe1713c33d16e5192de33fe.zip
Merge pull request #2 from ericbmerritt/rename-to-relx
Relup + rename support
Diffstat (limited to 'test')
-rw-r--r--test/rlx_command_SUITE.erl (renamed from test/rclt_command_SUITE.erl)26
-rw-r--r--test/rlx_depsolver_tester.erl (renamed from test/rcl_depsolver_tester.erl)18
-rw-r--r--test/rlx_depsolver_tests.erl (renamed from test/rcl_depsolver_tests.erl)106
-rw-r--r--test/rlx_discover_SUITE.erl (renamed from test/rclt_discover_SUITE.erl)30
-rw-r--r--test/rlx_goal_tests.erl (renamed from test/rclt_goal.erl)38
-rw-r--r--test/rlx_release_SUITE.erl (renamed from test/rclt_release_SUITE.erl)278
6 files changed, 306 insertions, 190 deletions
diff --git a/test/rclt_command_SUITE.erl b/test/rlx_command_SUITE.erl
index 9c96005..6f726b4 100644
--- a/test/rclt_command_SUITE.erl
+++ b/test/rlx_command_SUITE.erl
@@ -17,7 +17,7 @@
%%%-------------------------------------------------------------------
%%% @author Eric Merrit <[email protected]>
%%% @copyright (C) 2012, Eric Merrit
--module(rclt_command_SUITE).
+-module(rlx_command_SUITE).
-export([suite/0,
init_per_suite/1,
@@ -48,8 +48,8 @@ normal_passing_case(Config) ->
Lib1 = filename:join([DataDir, <<"lib1">>]),
Lib2 = filename:join([DataDir, <<"lib2">>]),
Outdir = filename:join([DataDir, "outdir"]),
- ok = rcl_util:mkdir_p(Lib1),
- ok = rcl_util:mkdir_p(Lib2),
+ ok = rlx_util:mkdir_p(Lib1),
+ ok = rlx_util:mkdir_p(Lib2),
Goal1 = "app1<=33.33+build4",
Goal2 = "app2:btwn:33.22,45.22+build.21",
@@ -58,36 +58,40 @@ normal_passing_case(Config) ->
RelVsn = "33.222",
CmdLine = ["-V", LogLevel, "-g",Goal1,"-g",Goal2, "-l", Lib1, "-l", Lib2,
"-n", RelName, "-v", RelVsn, "-o", Outdir],
- {ok, State} = rcl_cmd_args:args2state(getopt:parse(relcool:opt_spec_list(), CmdLine)),
+ {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine),
+ {ok, State} = rlx_cmd_args:args2state(Opts, Targets),
?assertMatch([Lib1, Lib2],
- rcl_state:lib_dirs(State)),
- ?assertMatch(Outdir, rcl_state:output_dir(State)),
+ rlx_state:lib_dirs(State)),
+ ?assertMatch(Outdir, rlx_state:output_dir(State)),
?assertMatch([{app1,{{33,33},{[],[<<"build4">>]}},lte},
{app2,
{{33,22},{[],[]}},
{{45,22},{[],[<<"build">>,21]}}, between}],
- rcl_state:goals(State)).
+ rlx_state:goals(State)).
lib_fail_case(Config) ->
DataDir = proplists:get_value(data_dir, Config),
Lib1 = filename:join([DataDir, "lib1"]),
Lib2 = filename:join([DataDir, "lib3333"]),
- ok = rcl_util:mkdir_p(Lib1),
+ ok = rlx_util:mkdir_p(Lib1),
CmdLine = ["-l", Lib1, "-l", Lib2],
+ {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine),
?assertMatch({error, {_, {not_directory, Lib2}}},
- rcl_cmd_args:args2state(getopt:parse(relcool:opt_spec_list(), CmdLine))).
+ rlx_cmd_args:args2state(Opts, Targets)).
spec_parse_fail_case(_Config) ->
Spec = "aaeu:3333:33.22a44",
CmdLine = ["-g", Spec],
+ {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine),
?assertMatch({error, {_, {failed_to_parse, _Spec}}},
- rcl_cmd_args:args2state(getopt:parse(relcool:opt_spec_list(), CmdLine))).
+ rlx_cmd_args:args2state(Opts, Targets)).
config_fail_case(_Config) ->
ConfigFile = "does-not-exist",
CmdLine = ["-c", ConfigFile],
+ {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine),
?assertMatch({error, {_, {invalid_config_file, ConfigFile}}},
- rcl_cmd_args:args2state(getopt:parse(relcool:opt_spec_list(), CmdLine))).
+ rlx_cmd_args:args2state(Opts, Targets)).
diff --git a/test/rcl_depsolver_tester.erl b/test/rlx_depsolver_tester.erl
index 53f5ac0..2dddf76 100644
--- a/test/rcl_depsolver_tester.erl
+++ b/test/rlx_depsolver_tester.erl
@@ -23,7 +23,7 @@
%% Additional testing for depsolver
%% @end
%%-------------------------------------------------------------------
--module(rcl_depsolver_tester).
+-module(rlx_depsolver_tester).
-export([run_data/1, run_log/1]).
-include_lib("eunit/include/eunit.hrl").
@@ -352,7 +352,7 @@ log_ea2d264b_test() ->
versionify(X) when erlang:is_list(X) ->
lists:map(fun versionify/1, X);
versionify({K, V}) ->
- {erlang:list_to_binary(K), rcl_depsolver:parse_version(V)}.
+ {erlang:list_to_binary(K), rlx_depsolver:parse_version(V)}.
fix_rebar_brokenness(Filename) ->
Alt1 = filename:join(["./test", "data", Filename]),
@@ -372,7 +372,7 @@ fix_rebar_brokenness(Filename) ->
run_data_file(Device) ->
Constraints = get_constraints(io:get_line(Device, "")),
- rcl_depsolver:solve(process_packages(read_packages(Device)), Constraints).
+ rlx_depsolver:solve(process_packages(read_packages(Device)), Constraints).
goble_lines(_Device, eof, Acc) ->
lists:reverse(Acc);
@@ -385,14 +385,14 @@ goble_lines(Device) ->
goble_lines(Device, io:get_line(Device, ""), []).
run_log_file(Device) ->
- State0 = rcl_depsolver:new_graph(),
+ State0 = rlx_depsolver:new_graph(),
{Goals, State2} =
lists:foldl(fun(Line, Data) ->
process_add_goal(Line,
process_add_constraint(Line,
process_add_package(Line, Data)))
end, {[], State0}, goble_lines(Device)),
- rcl_depsolver:solve(State2, Goals).
+ rlx_depsolver:solve(State2, Goals).
read_packages(Device) ->
process_line(Device, io:get_line(Device, ""), []).
@@ -424,8 +424,8 @@ process_line(Device, Pkg, Acc) ->
process_packages(Pkgs) ->
lists:foldl(fun({Pkg, Vsn, Constraints}, Dom0) ->
- rcl_depsolver:add_package_version(Dom0, Pkg, Vsn, Constraints)
- end, rcl_depsolver:new_graph(), Pkgs).
+ rlx_depsolver:add_package_version(Dom0, Pkg, Vsn, Constraints)
+ end, rlx_depsolver:new_graph(), Pkgs).
get_constraints(ConLine) ->
AppVsns = string:tokens(ConLine, " \n"),
@@ -446,7 +446,7 @@ process_add_package(Line, {Goals, State0}) ->
{match, [_All, _InstNumber, PkgName, _PkgCount, VersionCount]} ->
{Goals,
lists:foldl(fun(PkgVsn, State1) ->
- rcl_depsolver:add_package_version(State1,
+ rlx_depsolver:add_package_version(State1,
PkgName,
erlang:integer_to_list(PkgVsn),
[])
@@ -460,7 +460,7 @@ process_add_constraint(Line, {Goals, State0}) ->
case re:run(Line, ?ADD_VC, [{capture, all, list}]) of
{match, [_All, _InstNumber, Pkg, Vsn, Dep, _Ignore, DepVsn]} ->
{Goals,
- rcl_depsolver:add_package_version(State0, Pkg, Vsn, [{Dep, DepVsn}])};
+ rlx_depsolver:add_package_version(State0, Pkg, Vsn, [{Dep, DepVsn}])};
_ ->
{Goals, State0}
end.
diff --git a/test/rcl_depsolver_tests.erl b/test/rlx_depsolver_tests.erl
index eae31a4..7cbe831 100644
--- a/test/rcl_depsolver_tests.erl
+++ b/test/rlx_depsolver_tests.erl
@@ -20,7 +20,7 @@
%%
%% @author Eric Merritt <[email protected]>
%%-------------------------------------------------------------------
--module(rcl_depsolver_tests).
+-module(rlx_depsolver_tests).
-include_lib("eunit/include/eunit.hrl").
@@ -29,7 +29,7 @@
%%============================================================================
first_test() ->
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.2+build.33"},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.2+build.33"},
{app3, "0.2", '>='}]},
{"0.2", []},
{"0.3", []}]},
@@ -41,7 +41,7 @@ first_test() ->
{"0.3", []}]}]),
- case rcl_depsolver:solve(Dom0, [{app1, "0.1"}]) of
+ case rlx_depsolver:solve(Dom0, [{app1, "0.1"}]) of
{ok,[{app3,{{0,3},{[],[]}}},
{app2,{{0,2},{[],[<<"build">>,33]}}},
{app1,{{0,1},{[],[]}}}]} ->
@@ -52,7 +52,7 @@ first_test() ->
second_test() ->
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.1", '>='},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.1", '>='},
{app4, "0.2"},
{app3, "0.2", '>='}]},
{"0.2", []},
@@ -68,7 +68,7 @@ second_test() ->
{app3, "0.3"}]},
{"0.3", []}]}]),
- X = rcl_depsolver:solve(Dom0, [{app1, "0.1"},
+ X = rlx_depsolver:solve(Dom0, [{app1, "0.1"},
{app2, "0.3"}]),
?assertMatch({ok, [{app3,{{0,3},{[],[]}}},
@@ -86,7 +86,7 @@ third_test() ->
Pkg3Deps = [{app5, "2.0.0", '>='}],
Pkg4Deps = [app5],
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
{"0.2", Pkg1Deps},
{"3.0", Pkg1Deps}]},
{app2, [{"0.0.1", Pkg2Deps},
@@ -112,7 +112,7 @@ third_test() ->
{app4,{{6,0,0},{[],[]}}},
{app2,{{3,0},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [{app1, "3.0"}])),
+ rlx_depsolver:solve(Dom0, [{app1, "3.0"}])),
?assertMatch({ok, [{app5,{{6,0,0},{[],[]}}},
@@ -120,10 +120,10 @@ third_test() ->
{app4,{{6,0,0},{[],[]}}},
{app2,{{3,0},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [app1])).
+ rlx_depsolver:solve(Dom0, [app1])).
fail_test() ->
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(),
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(),
[{app1, [{"0.1", [{app2, "0.2"},
{app3, "0.2", gte}]},
{"0.2", []},
@@ -135,9 +135,9 @@ fail_test() ->
{"0.2", []},
{"0.3", []}]}]),
- Ret = rcl_depsolver:solve(Dom0, [{app1, "0.1"}]),
+ Ret = rlx_depsolver:solve(Dom0, [{app1, "0.1"}]),
%% We do this to make sure all errors can be formated.
- _ = rcl_depsolver:format_error(Ret),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,
[{[{[{app1,{{0,1},{[],[]}}}],
[{app1,{{0,1},{[],[]}}},[[{app2,{{0,2},{[],[]}}}]]]}],
@@ -154,7 +154,7 @@ conflicting_passing_test() ->
Pkg2Deps = [{app4, "3.0.0", gte}],
Pkg3Deps = [{app5, "2.0.0", '>='}],
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
{"0.1.0", Pkg1Deps},
{"0.2", Pkg1Deps},
{"3.0", Pkg1Deps}]},
@@ -181,23 +181,23 @@ conflicting_passing_test() ->
{app4,{{5,0,0},{[],[]}}},
{app2,{{3,0},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [{app1, "3.0"}])),
+ rlx_depsolver:solve(Dom0, [{app1, "3.0"}])),
?assertMatch({ok, [{app5,{{2,0,0},{[],[]}}},
{app3,{{0,1,3},{[],[]}}},
{app4,{{5,0,0},{[],[]}}},
{app2,{{3,0},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [app1, app2, app5])).
+ rlx_depsolver:solve(Dom0, [app1, app2, app5])).
circular_dependencies_test() ->
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1.0", [app2]}]},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1.0", [app2]}]},
{app2, [{"0.0.1", [app1]}]}]),
?assertMatch({ok, [{app1,{{0,1,0},{[],[]}}},{app2,{{0,0,1},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [{app1, "0.1.0"}])).
+ rlx_depsolver:solve(Dom0, [{app1, "0.1.0"}])).
conflicting_failing_test() ->
Pkg1Deps = [app2,
@@ -208,14 +208,14 @@ conflicting_failing_test() ->
Pkg3Deps = [{app5, "6.0.0"}],
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"3.0", Pkg1Deps}]},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"3.0", Pkg1Deps}]},
{app2, [{"0.0.1", Pkg2Deps}]},
{app3, [{"0.1.0", Pkg3Deps}]},
{app4, [{"5.0.0", [{app5, "2.0.0"}]}]},
{app5, [{"2.0.0", []},
{"6.0.0", []}]}]),
- Ret = rcl_depsolver:solve(Dom0, [app1, app3]),
- _ = rcl_depsolver:format_error(Ret),
+ Ret = rlx_depsolver:solve(Dom0, [app1, app3]),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,
[{[{[app1],
[{app1,{{3,0},{[],[]}}},
@@ -237,7 +237,7 @@ pessimistic_major_minor_patch_test() ->
Pkg3Deps = [{app5, "2.0.0", '>='}],
Pkg4Deps = [app5],
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
{"0.2", Pkg1Deps},
{"3.0", Pkg1Deps}]},
{app2, [{"0.0.1", Pkg2Deps},
@@ -264,7 +264,7 @@ pessimistic_major_minor_patch_test() ->
{app4,{{6,0,0},{[],[]}}},
{app2,{{2,1,5},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [{app1, "3.0"}])).
+ rlx_depsolver:solve(Dom0, [{app1, "3.0"}])).
pessimistic_major_minor_test() ->
@@ -275,7 +275,7 @@ pessimistic_major_minor_test() ->
Pkg3Deps = [{app5, "2.0.0", '>='}],
Pkg4Deps = [app5],
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1.0", Pkg1Deps},
{"0.2", Pkg1Deps},
{"3.0", Pkg1Deps}]},
{app2, [{"0.0.1", Pkg2Deps},
@@ -302,7 +302,7 @@ pessimistic_major_minor_test() ->
{app4,{{6,0,0},{[],[]}}},
{app2,{{2,2},{[],[]}}},
{app1,{{3,0},{[],[]}}}]},
- rcl_depsolver:solve(Dom0, [{app1, "3.0"}])).
+ rlx_depsolver:solve(Dom0, [{app1, "3.0"}])).
filter_versions_test() ->
@@ -347,18 +347,18 @@ filter_versions_test() ->
{app4,"6.0.0"},
{app5,"2.0.0"},
{app5,"6.0.0"}]},
- rcl_depsolver:filter_packages(Packages, Cons)),
+ rlx_depsolver:filter_packages(Packages, Cons)),
- Ret = rcl_depsolver:filter_packages(Packages,
+ Ret = rlx_depsolver:filter_packages(Packages,
[{"foo", "1.0.0", '~~~~'} | Cons]),
- _ = rcl_depsolver:format_error(Ret),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error, {invalid_constraints, [{<<"foo">>,{{1,0,0},{[],[]}},'~~~~'}]}}, Ret).
-spec missing_test() -> ok.
missing_test() ->
- Dom0 = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.2"},
+ Dom0 = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), [{app1, [{"0.1", [{app2, "0.2"},
{app3, "0.2", '>='},
{app4, "0.2", '='}]},
{"0.2", [{app4, "0.2"}]},
@@ -369,12 +369,12 @@ missing_test() ->
{app3, [{"0.1", []},
{"0.2", []},
{"0.3", []}]}]),
- Ret1 = rcl_depsolver:solve(Dom0, [{app4, "0.1"}, {app3, "0.1"}]),
- _ = rcl_depsolver:format_error(Ret1),
+ Ret1 = rlx_depsolver:solve(Dom0, [{app4, "0.1"}, {app3, "0.1"}]),
+ _ = rlx_depsolver:format_error(Ret1),
?assertMatch({error,{unreachable_package,app4}}, Ret1),
- Ret2 = rcl_depsolver:solve(Dom0, [{app1, "0.1"}]),
- _ = rcl_depsolver:format_error(Ret2),
+ Ret2 = rlx_depsolver:solve(Dom0, [{app1, "0.1"}]),
+ _ = rlx_depsolver:format_error(Ret2),
?assertMatch({error,{unreachable_package,app4}},
Ret2).
@@ -383,11 +383,11 @@ binary_test() ->
World = [{<<"foo">>, [{<<"1.2.3">>, [{<<"bar">>, <<"2.0.0">>, gt}]}]},
{<<"bar">>, [{<<"2.0.0">>, [{<<"foo">>, <<"3.0.0">>, gt}]}]}],
- Ret = rcl_depsolver:solve(rcl_depsolver:add_packages(rcl_depsolver:new_graph(),
+ Ret = rlx_depsolver:solve(rlx_depsolver:add_packages(rlx_depsolver:new_graph(),
World),
[<<"foo">>]),
- _ = rcl_depsolver:format_error(Ret),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,
[{[{[<<"foo">>],[{<<"foo">>,{{1,2,3},{[],[]}}}]}],
[{{<<"foo">>,{{1,2,3},{[],[]}}},
@@ -406,9 +406,9 @@ binary_test() ->
%%
doesnt_exist_test() ->
Constraints = [{<<"foo">>,[{<<"1.2.3">>, [{<<"bar">>, <<"2.0.0">>, gt}]}]}],
- World = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), Constraints),
- Ret = rcl_depsolver:solve(World, [<<"foo">>]),
- _ = rcl_depsolver:format_error(Ret),
+ World = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), Constraints),
+ Ret = rlx_depsolver:solve(World, [<<"foo">>]),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,{unreachable_package,<<"bar">>}}, Ret).
%%
@@ -426,9 +426,9 @@ not_new_enough_test() ->
Constraints = [{<<"foo">>, [{<<"1.2.3">>, [{<<"bar">>, <<"2.0.0">>, gt}]}]},
{<<"bar">>, [{<<"2.0.0">>, []}]}],
- World = rcl_depsolver:add_packages(rcl_depsolver:new_graph(), Constraints),
- Ret = rcl_depsolver:solve(World, [<<"foo">>]),
- _ = rcl_depsolver:format_error(Ret),
+ World = rlx_depsolver:add_packages(rlx_depsolver:new_graph(), Constraints),
+ Ret = rlx_depsolver:solve(World, [<<"foo">>]),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,
[{[{[<<"foo">>],[{<<"foo">>,{{1,2,3},{[],[]}}}]}],
[{{<<"foo">>,{{1,2,3},{[],[]}}},
@@ -445,11 +445,11 @@ not_new_enough_test() ->
%% "most_constrained_cookbooks:["bar = 2.0.0 -> [(foo > 3.0.0)]"]
%%
impossible_dependency_test() ->
- World = rcl_depsolver:add_packages(rcl_depsolver:new_graph(),
+ World = rlx_depsolver:add_packages(rlx_depsolver:new_graph(),
[{<<"foo">>, [{<<"1.2.3">>,[{ <<"bar">>, <<"2.0.0">>, gt}]}]},
{<<"bar">>, [{<<"2.0.0">>, [{ <<"foo">>, <<"3.0.0">>, gt}]}]}]),
- Ret = rcl_depsolver:solve(World, [<<"foo">>]),
- _ = rcl_depsolver:format_error(Ret),
+ Ret = rlx_depsolver:solve(World, [<<"foo">>]),
+ _ = rlx_depsolver:format_error(Ret),
?assertMatch({error,
[{[{[<<"foo">>],[{<<"foo">>,{{1,2,3},{[],[]}}}]}],
[{{<<"foo">>,{{1,2,3},{[],[]}}},
@@ -460,30 +460,30 @@ impossible_dependency_test() ->
%%
format_test_() ->
[{"format constraint",
- [equal_bin_string(<<"foo">>, rcl_depsolver:format_constraint(<<"foo">>)),
- equal_bin_string(<<"foo">>, rcl_depsolver:format_constraint(foo)),
- equal_bin_string(<<"(foo = 1.2.0)">>, rcl_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}})),
- equal_bin_string(<<"(foo = 1.2.0)">>, rcl_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, '='})),
+ [equal_bin_string(<<"foo">>, rlx_depsolver:format_constraint(<<"foo">>)),
+ equal_bin_string(<<"foo">>, rlx_depsolver:format_constraint(foo)),
+ equal_bin_string(<<"(foo = 1.2.0)">>, rlx_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}})),
+ equal_bin_string(<<"(foo = 1.2.0)">>, rlx_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, '='})),
equal_bin_string(<<"(foo > 1.2.0)">>,
- rcl_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, '>'})),
+ rlx_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, '>'})),
equal_bin_string(<<"(foo > 1.2.0)">>,
- rcl_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, gt})),
+ rlx_depsolver:format_constraint({<<"foo">>, {{1,2,0}, {[], []}}, gt})),
equal_bin_string(<<"(foo between 1.2.0 and 1.3.0)">>,
- rcl_depsolver:format_constraint({<<"foo">>,{{1,2,0}, {[], []}},
+ rlx_depsolver:format_constraint({<<"foo">>,{{1,2,0}, {[], []}},
{{1,3,0}, {[], []}}, between})),
equal_bin_string(<<"(foo > 1.2.0-alpha.1+build.36)">>,
- rcl_depsolver:format_constraint({<<"foo">>,
+ rlx_depsolver:format_constraint({<<"foo">>,
{{1,2,0}, {["alpha", 1], ["build", 36]}}, gt}))
]
},
{"format roots",
[equal_bin_string(<<"(bar = 1.2.0)">>,
- rcl_depsolver:format_roots([ [{<<"bar">>, {{1,2,0},{[],[]}}}] ])),
+ rlx_depsolver:format_roots([ [{<<"bar">>, {{1,2,0},{[],[]}}}] ])),
equal_bin_string(<<"(bar = 1.2.0), foo">>,
- rcl_depsolver:format_roots([[<<"foo">>,
+ rlx_depsolver:format_roots([[<<"foo">>,
{<<"bar">>, {{1,2,0},{[],[]}}}]])),
equal_bin_string(<<"(bar = 1.2.0), foo">>,
- rcl_depsolver:format_roots([[<<"foo">>], [{<<"bar">>, {{1,2,0},{[],[]}}}]]))
+ rlx_depsolver:format_roots([[<<"foo">>], [{<<"bar">>, {{1,2,0},{[],[]}}}]]))
]
}
].
diff --git a/test/rclt_discover_SUITE.erl b/test/rlx_discover_SUITE.erl
index e3a2861..d225ee6 100644
--- a/test/rclt_discover_SUITE.erl
+++ b/test/rlx_discover_SUITE.erl
@@ -17,7 +17,7 @@
%%%-------------------------------------------------------------------
%%% @author Eric Merrit <[email protected]>
%%% @copyright (C) 2012, Eric Merrit
--module(rclt_discover_SUITE).
+-module(rlx_discover_SUITE).
-export([suite/0,
init_per_suite/1,
@@ -44,9 +44,9 @@ init_per_testcase(_, Config) ->
DataDir = proplists:get_value(data_dir, Config),
LibDir1 = filename:join([DataDir, create_random_name("lib_dir1_")]),
LibDir2 = filename:join([DataDir, create_random_name("lib_dir2_")]),
- ok = rcl_util:mkdir_p(LibDir1),
- ok = rcl_util:mkdir_p(LibDir2),
- State = rcl_state:new([{lib_dirs, [LibDir1, LibDir2]}], release),
+ ok = rlx_util:mkdir_p(LibDir1),
+ ok = rlx_util:mkdir_p(LibDir2),
+ State = rlx_state:new([{lib_dirs, [LibDir1, LibDir2]}], release),
[{lib1, LibDir1},
{lib2, LibDir2},
{state, State} | Config].
@@ -72,20 +72,20 @@ normal_case(Config) ->
|| App <-
[{create_random_name("lib_app2_"), create_random_vsn()}
|| _ <- lists:seq(1, 100)]],
- State0 = rcl_state:put(proplists:get_value(state, Config),
+ State0 = rlx_state:put(proplists:get_value(state, Config),
disable_default_libs, true),
- {DiscoverProvider, {ok, State1}} = rcl_provider:new(rcl_prv_discover, State0),
- {ok, State2} = rcl_provider:do(DiscoverProvider, State1),
+ {DiscoverProvider, {ok, State1}} = rlx_provider:new(rlx_prv_discover, State0),
+ {ok, State2} = rlx_provider:do(DiscoverProvider, State1),
lists:foreach(fun(App) ->
- ?assertMatch(true, lists:member(App, rcl_state:available_apps(State2)))
+ ?assertMatch(true, lists:member(App, rlx_state:available_apps(State2)))
end, Apps1),
lists:foreach(fun(App) ->
- ?assertMatch(true, lists:member(App, rcl_state:available_apps(State2)))
+ ?assertMatch(true, lists:member(App, rlx_state:available_apps(State2)))
end, Apps2),
Length = erlang:length(Apps2) +
erlang:length(Apps2),
- ?assertMatch(Length, erlang:length(rcl_state:available_apps(State2))).
+ ?assertMatch(Length, erlang:length(rlx_state:available_apps(State2))).
no_beam_case(Config) ->
%% We silently ignore apps with no beams
@@ -110,10 +110,10 @@ no_beam_case(Config) ->
AppDir = filename:join([LibDir2, BadName]),
write_app_file(AppDir, BadName, BadVsn),
State0 = proplists:get_value(state, Config),
- {DiscoverProvider, {ok, State1}} = rcl_provider:new(rcl_prv_discover, State0),
+ {DiscoverProvider, {ok, State1}} = rlx_provider:new(rlx_prv_discover, State0),
EbinDir = filename:join([LibDir2, BadName, <<"ebin">>]),
?assertMatch({error, {_, [{no_beam_files, EbinDir}]}},
- rcl_provider:do(DiscoverProvider, State1)).
+ rlx_provider:do(DiscoverProvider, State1)).
bad_ebin_case(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -140,9 +140,9 @@ bad_ebin_case(Config) ->
ok = ec_file:write_term(Filename, get_bad_app_metadata(BadName, BadVsn)),
write_beam_file(AppDir, BadName),
State0 = proplists:get_value(state, Config),
- {DiscoverProvider, {ok, State1}} = rcl_provider:new(rcl_prv_discover, State0),
+ {DiscoverProvider, {ok, State1}} = rlx_provider:new(rlx_prv_discover, State0),
?assertMatch({error, {_, [{invalid_app_file, Filename}]}},
- rcl_provider:do(DiscoverProvider, State1)).
+ rlx_provider:do(DiscoverProvider, State1)).
%%%===================================================================
@@ -152,7 +152,7 @@ create_app(Dir, Name, Vsn) ->
AppDir = filename:join([Dir, Name]),
write_app_file(AppDir, Name, Vsn),
write_beam_file(AppDir, Name),
- {ok, App} = rcl_app_info:new(erlang:list_to_atom(Name), Vsn,
+ {ok, App} = rlx_app_info:new(erlang:list_to_atom(Name), Vsn,
erlang:iolist_to_binary(AppDir),
[kernel, stdlib], []),
App.
diff --git a/test/rclt_goal.erl b/test/rlx_goal_tests.erl
index 20fb5e5..9a99bcb 100644
--- a/test/rclt_goal.erl
+++ b/test/rlx_goal_tests.erl
@@ -18,46 +18,46 @@
%%% @author Eric Merritt <[email protected]>
%%% @copyright (C) 2012 Erlware, LLC.
%%% @doc test for target spec parsing
--module(rclt_goal).
+-module(rlx_goal_tests).
-include_lib("eunit/include/eunit.hrl").
parse_test() ->
?assertMatch({ok, getopt},
- rcl_goal:parse("getopt")),
+ rlx_goal:parse("getopt")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
- rcl_goal:parse("getopt=0.5.1")),
+ rlx_goal:parse("getopt=0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
- rcl_goal:parse("getopt:0.5.1")),
+ rlx_goal:parse("getopt:0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
- rcl_goal:parse("getopt-0.5.1")),
+ rlx_goal:parse("getopt-0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gte}},
- rcl_goal:parse("getopt >= 0.5.1")),
+ rlx_goal:parse("getopt >= 0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gte}},
- rcl_goal:parse("getopt:gte:0.5.1")),
+ rlx_goal:parse("getopt:gte:0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gt}},
- rcl_goal:parse("getopt>0.5.1")),
+ rlx_goal:parse("getopt>0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gt}},
- rcl_goal:parse("getopt:gt:0.5.1")),
+ rlx_goal:parse("getopt:gt:0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lte}},
- rcl_goal:parse("getopt<= 0.5.1")),
+ rlx_goal:parse("getopt<= 0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lte}},
- rcl_goal:parse("getopt:lte:0.5.1")),
+ rlx_goal:parse("getopt:lte:0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lt}},
- rcl_goal:parse("getopt<0.5.1")),
+ rlx_goal:parse("getopt<0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, pes}},
- rcl_goal:parse("getopt ~>0.5.1")),
+ rlx_goal:parse("getopt ~>0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, pes}},
- rcl_goal:parse("getopt: pes:0.5.1")),
+ rlx_goal:parse("getopt: pes:0.5.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
- rcl_goal:parse("getopt:btwn:0.5.1,0.6.1")),
+ rlx_goal:parse("getopt:btwn:0.5.1,0.6.1")),
?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
- rcl_goal:parse("getopt:between :0.5.1,0.6.1")).
+ rlx_goal:parse("getopt:between :0.5.1,0.6.1")).
fail_test() ->
?assertMatch({fail,_},
- rcl_goal:parse("got:")),
+ rlx_goal:parse("got:")),
?assertMatch({fail,_},
- rcl_goal:parse("between:btwn:0.5")),
+ rlx_goal:parse("between:btwn:0.5")),
?assertMatch({fail,_},
- rcl_goal:parse("between:btwn:0.5,")).
+ rlx_goal:parse("between:btwn:0.5,")).
diff --git a/test/rclt_release_SUITE.erl b/test/rlx_release_SUITE.erl
index f0446d6..ea4b20d 100644
--- a/test/rclt_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -17,7 +17,7 @@
%%%-------------------------------------------------------------------
%%% @author Eric Merrit <[email protected]>
%%% @copyright (C) 2012, Eric Merrit
--module(rclt_release_SUITE).
+-module(rlx_release_SUITE).
-export([suite/0,
init_per_suite/1,
@@ -35,6 +35,7 @@
make_depfree_release/1,
make_invalid_config_release/1,
make_relup_release/1,
+ make_relup_release2/1,
make_one_app_top_level_release/1]).
-include_lib("common_test/include/ct.hrl").
@@ -54,8 +55,8 @@ end_per_suite(_Config) ->
init_per_testcase(_, Config) ->
DataDir = proplists:get_value(data_dir, Config),
LibDir1 = filename:join([DataDir, create_random_name("lib_dir1_")]),
- ok = rcl_util:mkdir_p(LibDir1),
- State = rcl_state:new([{lib_dirs, [LibDir1]}], release),
+ ok = rlx_util:mkdir_p(LibDir1),
+ State = rlx_state:new([{lib_dirs, [LibDir1]}], release),
[{lib1, LibDir1},
{state, State} | Config].
@@ -64,7 +65,7 @@ all() ->
make_skip_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_invalid_config_release, make_relup_release, make_relup_release2,
make_one_app_top_level_release].
make_release(Config) ->
@@ -83,17 +84,17 @@ make_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1,
goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -118,15 +119,15 @@ make_invalid_config_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
ok = ec_file:write(ConfigFile,
"{release, {foo, \"0.0.1\"},
[goal_app_1,
goal_app_2,]}"),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- {error, {rcl_prv_config,
- {consult, _, _}}} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ {error, {rlx_prv_config,
+ {consult, _, _}}} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile).
make_scriptless_release(Config) ->
@@ -145,22 +146,22 @@ make_scriptless_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{generate_start_script, false},
{release, {foo, "0.0.1"},
[goal_app_1,
goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile),
?assert(not ec_file:exists(filename:join([OutputDir, "bin", "foo"]))),
?assert(not ec_file:exists(filename:join([OutputDir, "bin", "foo-0.0.1"]))),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -194,20 +195,20 @@ make_overridden_release(Config) ->
create_app(OverrideDir1, OverrideApp, OverrideVsn, [stdlib,kernel], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1,
erlang:list_to_atom(OverrideApp),
goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
{ok, Cwd} = file:get_cwd(),
- {ok, State} = relcool:do(Cwd, undefined, undefined, [], [LibDir1], 2,
+ {ok, State} = relx:do(Cwd, undefined, undefined, [], [LibDir1], 2,
OutputDir, [{OverrideAppName, OverrideAppDir}],
ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -243,20 +244,20 @@ make_skip_app_release(Config) ->
create_empty_app(SkipAppDir1, SkipAppApp, SkipAppVsn, [stdlib,kernel], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ 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)]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
{ok, Cwd} = file:get_cwd(),
- {ok, State} = relcool:do(Cwd, undefined, undefined, [], [LibDir1], 2,
+ {ok, State} = relx:do(Cwd, undefined, undefined, [], [LibDir1], 2,
OutputDir, [],
ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -284,20 +285,20 @@ make_implicit_config_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1,
goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
ok = file:set_cwd(FooRoot),
{ok, FooRoot} = file:get_cwd(),
- {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, undefined),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
+ [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)),
?assert(ec_file:exists(OutputDir)),
- AppSpecs = rcl_release:applications(Release),
+ 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)),
@@ -331,26 +332,26 @@ make_rerun_overridden_release(Config) ->
create_app(OverrideDir1, OverrideApp, OverrideVsn, [stdlib,kernel], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1,
erlang:list_to_atom(OverrideApp),
goal_app_2]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
{ok, Cwd} = file:get_cwd(),
- {ok, _} = relcool:do(Cwd, undefined, undefined, [], [LibDir1], 2,
+ {ok, _} = relx:do(Cwd, undefined, undefined, [], [LibDir1], 2,
OutputDir, [{OverrideAppName, OverrideAppDir}],
ConfigFile),
%% Now we run it again to see if it fails.
- {ok, State} = relcool:do(Cwd,undefined, undefined, [], [LibDir1], 2,
+ {ok, State} = relx:do(Cwd,undefined, undefined, [], [LibDir1], 2,
OutputDir, [{OverrideAppName, OverrideAppDir}],
ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -379,7 +380,7 @@ overlay_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
OverlayVars = filename:join([LibDir1, "vars.config"]),
Template = filename:join([LibDir1, "test_template"]),
write_config(ConfigFile,
@@ -407,13 +408,13 @@ overlay_release(Config) ->
ok = file:write_file_info(TemplateFile, FileInfo#file_info{mode=8#00777}),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
- {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)),
@@ -513,14 +514,14 @@ make_goalless_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], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- ?assertMatch({error,{rcl_prv_release,no_goals_specified}},
- relcool:do(undefined, undefined, [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ ?assertMatch({error,{rlx_prv_release,no_goals_specified}},
+ relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile)).
make_depfree_release(Config) ->
@@ -539,16 +540,16 @@ make_depfree_release(Config) ->
create_app(LibDir1, "non_goal_1", "0.0.1", [kernel,stdlib], []),
create_app(LibDir1, "non_goal_2", "0.0.1", [kernel,stdlib], []),
- ConfigFile = filename:join([LibDir1, "relcool.config"]),
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[goal_app_1]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ {ok, State} = relx:do(undefined, undefined, [], [LibDir1], 2,
OutputDir, ConfigFile),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)).
@@ -564,48 +565,150 @@ make_relup_release(Config) ->
create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
create_app(LibDir1, "goal_app_1", "0.0.2", [stdlib,kernel,non_goal_1], []),
- create_app(LibDir1, "goal_app_1", "0.0.3", [stdlib,kernel,non_goal_1], []),
+ {ok, GA1} = create_app(LibDir1, "goal_app_1", "0.0.3", [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, "goal_app_2", "0.0.2", [stdlib,kernel,goal_app_1,non_goal_2], []),
- create_app(LibDir1, "goal_app_2", "0.0.3", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ {ok, GA2} = create_app(LibDir1, "goal_app_2", "0.0.3", [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, "relcool.config"]),
+ write_appup_file(GA1, "0.0.2"),
+ write_appup_file(GA2, "0.0.2"),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
- [{goal_app_1, "0.0.1"},
+ [sasl,
+ {goal_app_1, "0.0.1"},
{goal_app_2, "0.0.1"}]},
{release, {foo, "0.0.2"},
- [{goal_app_1, "0.0.2"},
+ [sasl,
+ {goal_app_1, "0.0.2"},
{goal_app_2, "0.0.2"}]},
{release, {foo, "0.0.3"},
- [{goal_app_1, "0.0.3"},
+ [sasl,
+ {goal_app_1, "0.0.3"},
{goal_app_2, "0.0.3"}]}]),
OutputDir = filename:join([proplists:get_value(data_dir, Config),
- create_random_name("relcool-output")]),
- {ok, _} = relcool:do(foo, "0.0.1", [], [LibDir1], 2,
+ create_random_name("relx-output")]),
+ {ok, _} = relx:do(foo, "0.0.1", [], [LibDir1], 2,
OutputDir, ConfigFile),
- {ok, _} = relcool:do(foo, "0.0.2", [], [LibDir1], 2,
+ {ok, _} = relx:do(foo, "0.0.2", [], [LibDir1], 2,
OutputDir, ConfigFile),
- {ok, State} = relcool:do(foo, "0.0.3", [], [LibDir1], 2,
- OutputDir, ConfigFile),
+ {ok, State} = relx:do([{relname, foo},
+ {relvsn, "0.0.3"},
+ {goals, []},
+ {lib_dirs, [LibDir1]},
+ {log_level, 2},
+ {output_dir, OutputDir},
+ {config, ConfigFile}], ["relup"]),
+
+ %% we should have one 'resolved' release and three discovered realized_releases.
+ ?assertMatch([{foo, "0.0.1"},
+ {foo, "0.0.2"},
+ {foo, "0.0.3"}],
+ lists:sort(ec_dictionary:keys(rlx_state:realized_releases(State)))),
+ Release = ec_dictionary:get({foo, "0.0.3"}, rlx_state:realized_releases(State)),
+ ?assert(rlx_release:realized(Release)),
+ ?assert(not rlx_release:realized(ec_dictionary:get({foo, "0.0.2"},
+ rlx_state:realized_releases(State)))),
+ ?assert(not rlx_release:realized(ec_dictionary:get({foo, "0.0.1"},
+ rlx_state:realized_releases(State)))),
+
+ ?assertMatch({ok, [{"0.0.3",
+ [{"0.0.2",[],[point_of_no_return]}],
+ [{"0.0.2",[],[point_of_no_return]}]}]},
+ file:consult(filename:join(filename:dirname(rlx_release:relfile(Release)),
+ filename:basename(rlx_release:relfile(Release), ".rel") ++
+ ".relup"))),
+
+ ?assertMatch(foo, rlx_release:name(Release)),
+ ?assertMatch("0.0.3", rlx_release:vsn(Release)),
+ 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.3"}, AppSpecs)),
+ ?assert(lists:member({goal_app_2, "0.0.3"}, AppSpecs)),
+ ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)).
+
+
+make_relup_release2(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)]],
- %% we should have one 'resolved' release and three discovered releases.
+ create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []),
+ create_app(LibDir1, "goal_app_1", "0.0.2", [stdlib,kernel,non_goal_1], []),
+ {ok, GA1} = create_app(LibDir1, "goal_app_1", "0.0.3", [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, "goal_app_2", "0.0.2", [stdlib,kernel,goal_app_1,non_goal_2], []),
+ {ok, GA2} = create_app(LibDir1, "goal_app_2", "0.0.3", [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], []),
+
+ write_appup_file(GA1, "0.0.1"),
+ write_appup_file(GA2, "0.0.1"),
+
+ ConfigFile = filename:join([LibDir1, "relx.config"]),
+ write_config(ConfigFile,
+ [{release, {foo, "0.0.1"},
+ [sasl,
+ {goal_app_1, "0.0.1"},
+ {goal_app_2, "0.0.1"}]},
+ {release, {foo, "0.0.2"},
+ [sasl,
+ {goal_app_1, "0.0.2"},
+ {goal_app_2, "0.0.2"}]},
+ {release, {foo, "0.0.3"},
+ [sasl,
+ {goal_app_1, "0.0.3"},
+ {goal_app_2, "0.0.3"}]}]),
+ OutputDir = filename:join([proplists:get_value(data_dir, Config),
+ create_random_name("relx-output")]),
+ {ok, _} = relx:do(foo, "0.0.1", [], [LibDir1], 2,
+ OutputDir, ConfigFile),
+ {ok, _} = relx:do(foo, "0.0.2", [], [LibDir1], 2,
+ OutputDir, ConfigFile),
+ {ok, State} = relx:do([{relname, foo},
+ {relvsn, "0.0.3"},
+ {upfrom, "0.0.1"},
+ {goals, []},
+ {lib_dirs, [LibDir1]},
+ {log_level, 2},
+ {output_dir, OutputDir},
+ {config, ConfigFile}], ["relup"]),
+
+ %% we should have one 'resolved' release and three discovered realized_releases.
?assertMatch([{foo, "0.0.1"},
{foo, "0.0.2"},
{foo, "0.0.3"}],
- lists:sort(ec_dictionary:keys(rcl_state:releases(State)))),
- Release = ec_dictionary:get({foo, "0.0.3"}, rcl_state:releases(State)),
- ?assert(rcl_release:realized(Release)),
- ?assert(not rcl_release:realized(ec_dictionary:get({foo, "0.0.2"},
- rcl_state:releases(State)))),
- ?assert(not rcl_release:realized(ec_dictionary:get({foo, "0.0.1"},
- rcl_state:releases(State)))),
- ?assertMatch(foo, rcl_release:name(Release)),
- ?assertMatch("0.0.3", rcl_release:vsn(Release)),
- AppSpecs = rcl_release:applications(Release),
+ lists:sort(ec_dictionary:keys(rlx_state:realized_releases(State)))),
+ Release = ec_dictionary:get({foo, "0.0.3"}, rlx_state:realized_releases(State)),
+ ?assert(rlx_release:realized(Release)),
+ ?assert(not rlx_release:realized(ec_dictionary:get({foo, "0.0.2"},
+ rlx_state:realized_releases(State)))),
+ ?assert(not rlx_release:realized(ec_dictionary:get({foo, "0.0.1"},
+ rlx_state:realized_releases(State)))),
+
+ ?assertMatch({ok, [{"0.0.3",
+ [{"0.0.1",[],[point_of_no_return]}],
+ [{"0.0.1",[],[point_of_no_return]}]}]},
+ file:consult(filename:join(filename:dirname(rlx_release:relfile(Release)),
+ filename:basename(rlx_release:relfile(Release), ".rel") ++
+ ".relup"))),
+
+ ?assertMatch(foo, rlx_release:name(Release)),
+ ?assertMatch("0.0.3", rlx_release:vsn(Release)),
+ 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)),
@@ -618,22 +721,22 @@ make_relup_release(Config) ->
make_one_app_top_level_release(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
{ok, AppInfo} = create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel], []),
- AppDir = rcl_app_info:dir(AppInfo),
- ConfigFile = filename:join([AppDir, "relcool.config"]),
+ AppDir = rlx_app_info:dir(AppInfo),
+ ConfigFile = filename:join([AppDir, "relx.config"]),
write_config(ConfigFile,
[{release, {foo, "0.0.1"},
[{goal_app_1, "0.0.1"}]}]),
OutputDir = filename:join([AppDir,
- create_random_name("relcool-output")]),
+ create_random_name("relx-output")]),
{ok, Cwd} = file:get_cwd(),
ok = file:set_cwd(AppDir),
- {ok, State} = relcool:do(undefined, undefined, [], [], 2,
+ {ok, State} = relx:do(undefined, undefined, [], [], 2,
OutputDir, ConfigFile),
ok = file:set_cwd(Cwd),
- [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)),
- AppSpecs = rcl_release:applications(Release),
+ [{{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)).
@@ -642,17 +745,18 @@ make_one_app_top_level_release(Config) ->
%%%===================================================================
%%% Helper Functions
%%%===================================================================
+
create_app(Dir, Name, Vsn, Deps, LibDeps) ->
AppDir = filename:join([Dir, Name ++ "-" ++ Vsn]),
write_app_file(AppDir, Name, Vsn, Deps, LibDeps),
write_beam_file(AppDir, Name),
- rcl_app_info:new(erlang:list_to_atom(Name), Vsn, AppDir,
+ rlx_app_info:new(erlang:list_to_atom(Name), Vsn, AppDir,
Deps, []).
create_empty_app(Dir, Name, Vsn, Deps, LibDeps) ->
AppDir = filename:join([Dir, Name ++ "-" ++ Vsn]),
write_app_file(AppDir, Name, Vsn, Deps, LibDeps),
- rcl_app_info:new(erlang:list_to_atom(Name), Vsn, AppDir,
+ rlx_app_info:new(erlang:list_to_atom(Name), Vsn, AppDir,
Deps, []).
write_beam_file(Dir, Name) ->
@@ -660,6 +764,14 @@ write_beam_file(Dir, Name) ->
ok = filelib:ensure_dir(Beam),
ok = ec_file:write_term(Beam, testing_purposes_only).
+write_appup_file(AppInfo, DownVsn) ->
+ Dir = rlx_app_info:dir(AppInfo),
+ Name = rlx_util:to_string(rlx_app_info:name(AppInfo)),
+ Vsn = rlx_app_info:vsn_as_string(AppInfo),
+ Filename = filename:join([Dir, "ebin", Name ++ ".appup"]),
+ ok = filelib:ensure_dir(Filename),
+ ok = ec_file:write_term(Filename, {Vsn, [{DownVsn, []}], [{DownVsn, []}]}).
+
write_app_file(Dir, Name, Version, Deps, LibDeps) ->
Filename = filename:join([Dir, "ebin", Name ++ ".app"]),
ok = filelib:ensure_dir(Filename),