diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rlx_command_SUITE.erl | 12 | ||||
-rw-r--r-- | test/rlx_depsolver_tester.erl | 1 | ||||
-rw-r--r-- | test/rlx_discover_SUITE.erl | 7 | ||||
-rw-r--r-- | test/rlx_release_SUITE.erl | 43 |
4 files changed, 35 insertions, 28 deletions
diff --git a/test/rlx_command_SUITE.erl b/test/rlx_command_SUITE.erl index 5ea4769..c34ed88 100644 --- a/test/rlx_command_SUITE.erl +++ b/test/rlx_command_SUITE.erl @@ -61,15 +61,17 @@ normal_passing_case(Config) -> "-n", RelName, "-v", RelVsn, "-o", Outdir], {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine), {ok, State} = rlx_cmd_args:args2state(Opts, Targets), + {ConfigProvider, {ok, State1}} = rlx_provider:new(rlx_prv_config, State), + {ok, State2} = rlx_provider:do(ConfigProvider, State1), ?assertMatch([Lib1, Lib2], - rlx_state:lib_dirs(State)), - ?assertMatch(Outdir, rlx_state:output_dir(State)), + rlx_state:lib_dirs(State2)), + ?assertMatch(Outdir, rlx_state:base_output_dir(State2)), ?assertMatch([{app1,{{33,33},{[],[<<"build4">>]}},lte}, {app2, {{33,22},{[],[]}}, {{45,22},{[],[<<"build">>,21]}}, between}], - rlx_state:goals(State)). + rlx_state:goals(State2)). lib_expansion_case(Config) -> DataDir = proplists:get_value(data_dir, Config), @@ -81,8 +83,10 @@ lib_expansion_case(Config) -> CmdLine = ["-l", filename:join(DataDir, "*")], {ok, {Opts, Targets}} = getopt:parse(relx:opt_spec_list(), CmdLine), {ok, State} = rlx_cmd_args:args2state(Opts, Targets), + {ConfigProvider, {ok, State1}} = rlx_provider:new(rlx_prv_config, State), + {ok, State2} = rlx_provider:do(ConfigProvider, State1), ?assertMatch([Lib1, Lib2], - rlx_state:lib_dirs(State)). + rlx_state:lib_dirs(State2)). lib_fail_case(Config) -> DataDir = proplists:get_value(data_dir, Config), diff --git a/test/rlx_depsolver_tester.erl b/test/rlx_depsolver_tester.erl index 2dddf76..b441a1e 100644 --- a/test/rlx_depsolver_tester.erl +++ b/test/rlx_depsolver_tester.erl @@ -365,7 +365,6 @@ fix_rebar_brokenness(Filename) -> true -> Alt2; false -> - io:format("~p~n", [Alt2]), erlang:throw(unable_to_find_data_files) end end. diff --git a/test/rlx_discover_SUITE.erl b/test/rlx_discover_SUITE.erl index 8ea95c4..7e7015c 100644 --- a/test/rlx_discover_SUITE.erl +++ b/test/rlx_discover_SUITE.erl @@ -48,10 +48,12 @@ init_per_testcase(_, Config) -> LibDir2 = filename:join([DataDir, create_random_name("lib_dir2_")]), ok = rlx_util:mkdir_p(LibDir1), ok = rlx_util:mkdir_p(LibDir2), - State = rlx_state:new([{lib_dirs, [LibDir1, LibDir2]}], [release]), + State = rlx_state:new([], [{lib_dirs, [LibDir1, LibDir2]}], [release]), + {ConfigProvider, {ok, State1}} = rlx_provider:new(rlx_prv_config, State), + {ok, State2} = rlx_provider:do(ConfigProvider, State1), [{lib1, LibDir1}, {lib2, LibDir2}, - {state, State} | Config]. + {state, State2} | Config]. all() -> @@ -78,6 +80,7 @@ normal_case(Config) -> default_libs, false), {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, rlx_state:available_apps(State2))) end, Apps1), diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index 8f27050..6f067dc 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -60,9 +60,11 @@ init_per_testcase(_, Config) -> DataDir = proplists:get_value(data_dir, Config), LibDir1 = filename:join([DataDir, create_random_name("lib_dir1_")]), ok = rlx_util:mkdir_p(LibDir1), - State = rlx_state:new([{lib_dirs, [LibDir1]}], [release]), + State = rlx_state:new([], [{lib_dirs, [LibDir1]}], [release]), + {ConfigProvider, {ok, State1}} = rlx_provider:new(rlx_prv_config, State), + {ok, State2} = rlx_provider:do(ConfigProvider, State1), [{lib1, LibDir1}, - {state, State} | Config]. + {state, State2} | Config]. all() -> [make_release, make_extend_release, make_scriptless_release, @@ -220,7 +222,6 @@ make_scriptless_release(Config) -> ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)). - make_overridden_release(Config) -> DataDir = proplists:get_value(data_dir, Config), OverrideDir1 = filename:join([DataDir, create_random_name("override_dir_")]), @@ -267,7 +268,7 @@ make_overridden_release(Config) -> ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), ?assert(lists:member({OverrideAppName, OverrideVsn}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)), - {ok, Real} = file:read_link(filename:join([OutputDir, "lib", + {ok, Real} = file:read_link(filename:join([OutputDir, "foo", "lib", OverrideApp ++ "-" ++ OverrideVsn])), ?assertMatch(OverrideAppDir, Real). @@ -485,7 +486,7 @@ make_rerun_overridden_release(Config) -> ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), ?assert(lists:member({OverrideAppName, OverrideVsn}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)), - {ok, Real} = file:read_link(filename:join([OutputDir, "lib", + {ok, Real} = file:read_link(filename:join([OutputDir, "foo", "lib", OverrideApp ++ "-" ++ OverrideVsn])), ?assertMatch(OverrideAppDir, Real). @@ -563,19 +564,19 @@ overlay_release(Config) -> ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)), - ?assert(ec_file:exists(filename:join(OutputDir, "fooo"))), - ?assert(ec_file:exists(filename:join([OutputDir, "foodir", "vars1.config"]))), - ?assert(ec_file:exists(filename:join([OutputDir, "yahoo", "vars1.config"]))), - io:format("DirFile ~p~n", [filename:join([OutputDir, SecondTestDir, TestDir, TestFile])]), - ?assert(ec_file:exists(filename:join([OutputDir, SecondTestDir, TestDir, TestFile]))), + ?assert(ec_file:exists(filename:join([OutputDir, "foo", "fooo"]))), + ?assert(ec_file:exists(filename:join([OutputDir, "foo", "foodir", "vars1.config"]))), + ?assert(ec_file:exists(filename:join([OutputDir, "foo", "yahoo", "vars1.config"]))), + ?assert(ec_file:exists(filename:join([OutputDir, "foo", SecondTestDir, TestDir, TestFile]))), - TemplateData = case file:consult(filename:join([OutputDir, "test_template_resolved"])) of + TemplateData = case file:consult(filename:join([OutputDir, "foo", "test_template_resolved"])) of {ok, Details} -> Details; Error -> erlang:throw({failed_to_consult, Error}) end, - {ok, ReadFileInfo} = file:read_file_info(filename:join([OutputDir, "test_template_resolved"])), + + {ok, ReadFileInfo} = file:read_file_info(filename:join([OutputDir, "foo", "test_template_resolved"])), ?assertEqual(8#100777, ReadFileInfo#file_info.mode), ?assertEqual(erlang:system_info(version), @@ -610,9 +611,9 @@ overlay_release(Config) -> proplists:get_value(lib_dep_1_link, TemplateData)), ?assertEqual("(3:debug)", proplists:get_value(log, TemplateData)), - ?assertEqual(OutputDir, + ?assertEqual(filename:join(OutputDir, "foo"), proplists:get_value(output_dir, TemplateData)), - ?assertEqual(OutputDir, + ?assertEqual(filename:join(OutputDir, "foo"), proplists:get_value(target_dir, TemplateData)), ?assertEqual([], proplists:get_value(overridden, TemplateData)), @@ -917,14 +918,14 @@ make_dev_mode_release(Config) -> OutputDir, ConfigFile), [{{foo, "0.0.1"}, _Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "lib", "non_goal_1-0.0.1"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "lib", "non_goal_2-0.0.1"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "lib", "goal_app_1-0.0.1"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "lib", "goal_app_2-0.0.1"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "lib", "lib_dep_1-0.0.1"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "releases", "0.0.1", + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "lib", "non_goal_1-0.0.1"]))), + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "lib", "non_goal_2-0.0.1"]))), + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "lib", "goal_app_1-0.0.1"]))), + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "lib", "goal_app_2-0.0.1"]))), + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "lib", "lib_dep_1-0.0.1"]))), + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "releases", "0.0.1", "sys.config"]))), - ?assert(ec_file:is_symlink(filename:join([OutputDir, "releases", "0.0.1", + ?assert(ec_file:is_symlink(filename:join([OutputDir, "foo", "releases", "0.0.1", "vm.args"]))). |