From 4374999d9567acf93fbd3515aa19319c4e502390 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 18 Apr 2015 11:56:51 -0500 Subject: real bootstrapping --- test/rebar_eunit_SUITE.erl | 12 ++++++------ test/rebar_profiles_SUITE.erl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/rebar_eunit_SUITE.erl b/test/rebar_eunit_SUITE.erl index 4ec92f2..ac74146 100644 --- a/test/rebar_eunit_SUITE.erl +++ b/test/rebar_eunit_SUITE.erl @@ -164,8 +164,8 @@ test_basic_defines(Config) -> AppOpts = proplists:get_value(options, App:module_info(compile), []), SuiteOpts = proplists:get_value(options, Suite:module_info(compile), []), Expect = [{d, some_define}], - lists:foreach(fun(Expect) -> true = lists:member(Expect, AppOpts) end, Expect), - lists:foreach(fun(Expect) -> true = lists:member(Expect, SuiteOpts) end, Expect). + lists:foreach(fun(E) -> true = lists:member(E, AppOpts) end, Expect), + lists:foreach(fun(E) -> true = lists:member(E, SuiteOpts) end, Expect). test_multi_defines(Config) -> AppDir = ?config(apps, Config), @@ -198,10 +198,10 @@ test_multi_defines(Config) -> AppOpts2 = proplists:get_value(options, App2:module_info(compile), []), SuiteOpts2 = proplists:get_value(options, Suite2:module_info(compile), []), Expect = [{d, some_define}], - lists:foreach(fun(Expect) -> true = lists:member(Expect, AppOpts1) end, Expect), - lists:foreach(fun(Expect) -> true = lists:member(Expect, SuiteOpts1) end, Expect), - lists:foreach(fun(Expect) -> true = lists:member(Expect, AppOpts2) end, Expect), - lists:foreach(fun(Expect) -> true = lists:member(Expect, SuiteOpts2) end, Expect). + lists:foreach(fun(E) -> true = lists:member(E, AppOpts1) end, Expect), + lists:foreach(fun(E) -> true = lists:member(E, SuiteOpts1) end, Expect), + lists:foreach(fun(E) -> true = lists:member(E, AppOpts2) end, Expect), + lists:foreach(fun(E) -> true = lists:member(E, SuiteOpts2) end, Expect). test_single_app_flag(Config) -> AppDir = ?config(apps, Config), diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl index 72969d3..f0d1c48 100644 --- a/test/rebar_profiles_SUITE.erl +++ b/test/rebar_profiles_SUITE.erl @@ -160,7 +160,7 @@ profiles_remain_applied_with_config_present(Config) -> rebar_test_utils:create_config(AppDir, RebarConfig), - {ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, + rebar_test_utils:run_and_check(Config, RebarConfig, ["as", "not_ok", "compile"], {ok, [{app, Name}]}), Path = filename:join([AppDir, "_build", "not_ok", "lib", Name, "ebin"]), -- cgit v1.1 From 16e9b3ffa2ddd81e26238530fd1e25a54a42b7dc Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 22 Apr 2015 21:43:59 -0500 Subject: fix tracking of all profiles dep paths --- test/rebar_profiles_SUITE.erl | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl index f0d1c48..59c65e9 100644 --- a/test/rebar_profiles_SUITE.erl +++ b/test/rebar_profiles_SUITE.erl @@ -7,6 +7,7 @@ all/0, profile_new_key/1, profile_merge_keys/1, + all_deps_code_paths/1, profile_merges/1, add_to_profile/1, add_to_existing_profile/1, @@ -21,7 +22,7 @@ -include_lib("kernel/include/file.hrl"). all() -> - [profile_new_key, profile_merge_keys, profile_merges, + [profile_new_key, profile_merge_keys, all_deps_code_paths, profile_merges, add_to_profile, add_to_existing_profile, profiles_remain_applied_with_config_present, test_profile_applied_at_completion, @@ -95,6 +96,40 @@ profile_merge_keys(Config) -> ,{dep, "a", "1.0.0"} ,{dep, "b", "2.0.0"}]}). +all_deps_code_paths(Config) -> + AppDir = ?config(apps, Config), + + AllDeps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} + ,{"b", "2.0.0", []}]), + mock_git_resource:mock([{deps, rebar_test_utils:flat_deps(AllDeps)}]), + + Name = rebar_test_utils:create_random_name("all_deps_code_paths"), + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), + + Deps = rebar_test_utils:top_level_deps( + rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}])), + ProfileDeps = rebar_test_utils:top_level_deps( + rebar_test_utils:expand_deps(git, [{"b", "2.0.0", []}])), + + RebarConfig = [{deps, Deps}, + {profiles, + [{all_deps_test, + [{deps, ProfileDeps}]}]}], + os:putenv("REBAR_PROFILE", "all_deps_test"), + {ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, + ["compile"], {ok, [{app, Name} + ,{dep, "a", "1.0.0"} + ,{dep, "b", "2.0.0"}]}), + os:unsetenv("REBAR_PROFILE"), + + Paths = rebar_state:code_paths(State, all_deps), + Path = lists:reverse(["_build", "all_deps_test", "lib", "b", "ebin"]), + ?assert(lists:any(fun(X) -> + Path =:= lists:sublist(lists:reverse(filename:split(X)), 5) + end, Paths)). + + profile_merges(_Config) -> RebarConfig = [{test1, [{key1, 1, 2}, key2]}, {test2, "hello"}, @@ -164,7 +199,7 @@ profiles_remain_applied_with_config_present(Config) -> ["as", "not_ok", "compile"], {ok, [{app, Name}]}), Path = filename:join([AppDir, "_build", "not_ok", "lib", Name, "ebin"]), - code:add_path(Path), + code:add_patha(Path), Mod = list_to_atom("not_a_real_src_" ++ Name), -- cgit v1.1 From e5988f69e0fc577f9c759f0907bd8b6840851035 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 22 Apr 2015 21:51:11 -0500 Subject: R15 support, replace unsetenv with putenv empty string --- test/rebar_profiles_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl index 59c65e9..2d03432 100644 --- a/test/rebar_profiles_SUITE.erl +++ b/test/rebar_profiles_SUITE.erl @@ -121,7 +121,7 @@ all_deps_code_paths(Config) -> ["compile"], {ok, [{app, Name} ,{dep, "a", "1.0.0"} ,{dep, "b", "2.0.0"}]}), - os:unsetenv("REBAR_PROFILE"), + os:putenv("REBAR_PROFILE", ""), Paths = rebar_state:code_paths(State, all_deps), Path = lists:reverse(["_build", "all_deps_test", "lib", "b", "ebin"]), -- cgit v1.1