diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-02 19:04:03 -0600 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-02 19:04:03 -0600 |
commit | baf46a861b18086131707d056ee106c9fba8da3d (patch) | |
tree | c0bc1de343e52f8385d9f1740e32df5e85dfa234 /test | |
parent | 8affde1c37ba746df41343a52fd8e239ebfe2db3 (diff) | |
parent | af0f4bb20a66f1464fa25d31f9b69784f3119493 (diff) |
Merge pull request #187 from tsloughter/profiles_dir
make base_dir for a run include the profiles in path, link to shared dep
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_compile_SUITE.erl | 14 | ||||
-rw-r--r-- | test/rebar_test_utils.erl | 25 | ||||
-rw-r--r-- | test/rebar_xref_SUITE.erl | 5 |
3 files changed, 23 insertions, 21 deletions
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 9a21986..924ce5c 100644 --- a/test/rebar_compile_SUITE.erl +++ b/test/rebar_compile_SUITE.erl @@ -77,7 +77,7 @@ build_checkout_apps(Config) -> build_checkout_deps(Config) -> AppDir = ?config(apps, Config), CheckoutsDir = ?config(checkouts, Config), - DepsDir = filename:join([AppDir, "_build", "lib"]), + DepsDir = filename:join([AppDir, "_build", "default", "lib"]), Name1 = rebar_test_utils:create_random_name("checkapp1_"), Vsn1 = rebar_test_utils:create_random_vsn(), rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]), @@ -96,7 +96,6 @@ build_checkout_deps(Config) -> recompile_when_opts_change(Config) -> AppDir = ?config(apps, Config), - EbinDir = filename:join([AppDir, "ebin"]), Name = rebar_test_utils:create_random_name("app1_"), Vsn = rebar_test_utils:create_random_vsn(), @@ -104,6 +103,7 @@ recompile_when_opts_change(Config) -> rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}), + EbinDir = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]), {ok, Files} = file:list_dir(EbinDir), ModTime = [filelib:last_modified(filename:join([EbinDir, F])) || F <- Files, filename:extension(F) == ".beam"], @@ -123,7 +123,6 @@ recompile_when_opts_change(Config) -> dont_recompile_when_opts_dont_change(Config) -> AppDir = ?config(apps, Config), - EbinDir = filename:join([AppDir, "ebin"]), Name = rebar_test_utils:create_random_name("app1_"), Vsn = rebar_test_utils:create_random_vsn(), @@ -131,6 +130,7 @@ dont_recompile_when_opts_dont_change(Config) -> rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}), + EbinDir = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]), {ok, Files} = file:list_dir(EbinDir), ModTime = [filelib:last_modified(filename:join([EbinDir, F])) || F <- Files, filename:extension(F) == ".beam"], @@ -141,20 +141,20 @@ dont_recompile_when_opts_dont_change(Config) -> {ok, NewFiles} = file:list_dir(EbinDir), NewModTime = [filelib:last_modified(filename:join([EbinDir, F])) - || F <- NewFiles, filename:extension(F) == ".beam"], + || F <- NewFiles, filename:extension(F) == ".beam"], ?assert(ModTime == NewModTime). dont_recompile_yrl_or_xrl(Config) -> AppDir = ?config(apps, Config), - + Name = rebar_test_utils:create_random_name("app1_"), Vsn = rebar_test_utils:create_random_vsn(), rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), Xrl = filename:join([AppDir, "src", "not_a_real_xrl_" ++ Name ++ ".xrl"]), ok = filelib:ensure_dir(Xrl), - XrlBody = + XrlBody = "Definitions." "\n\n" "D = [0-9]" @@ -182,4 +182,4 @@ dont_recompile_yrl_or_xrl(Config) -> NewModTime = filelib:last_modified(XrlBeam), - ?assert(ModTime == NewModTime).
\ No newline at end of file + ?assert(ModTime == NewModTime). diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl index a036619..157c2df 100644 --- a/test/rebar_test_utils.erl +++ b/test/rebar_test_utils.erl @@ -142,17 +142,18 @@ top_level_deps([{{Name, Vsn, Ref}, _} | Deps]) -> %%% Helpers %%% %%%%%%%%%%%%%%% check_results(AppDir, Expected) -> - BuildDir = filename:join([AppDir, "_build", "lib"]), + BuildDirs = filelib:wildcard(filename:join([AppDir, "_build", "*", "lib"])), CheckoutsDir = filename:join([AppDir, "_checkouts"]), LockFile = filename:join([AppDir, "rebar.lock"]), Locks = lists:flatten(rebar_config:consult_file(LockFile)), - Apps = rebar_app_discover:find_apps([AppDir]), - InvalidApps = rebar_app_discover:find_apps([AppDir], invalid), - ValidApps = rebar_app_discover:find_apps([AppDir], valid), - AppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Apps], - InvalidAppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- InvalidApps], - ValidAppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- ValidApps], - Deps = rebar_app_discover:find_apps([BuildDir], all), + + InvalidApps = rebar_app_discover:find_apps(BuildDirs, invalid), + ValidApps = rebar_app_discover:find_apps(BuildDirs, valid), + + InvalidDepsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- InvalidApps], + ValidDepsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- ValidApps], + + Deps = rebar_app_discover:find_apps(BuildDirs, all), DepsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Deps], Checkouts = rebar_app_discover:find_apps([CheckoutsDir], all), CheckoutsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Checkouts], @@ -160,7 +161,7 @@ check_results(AppDir, Expected) -> lists:foreach( fun({app, Name}) -> ct:pal("Name: ~p", [Name]), - case lists:keyfind(Name, 1, AppsNames) of + case lists:keyfind(Name, 1, DepsNames) of false -> error({app_not_found, Name}); {Name, _App} -> @@ -168,7 +169,7 @@ check_results(AppDir, Expected) -> end ; ({app, Name, invalid}) -> ct:pal("Name: ~p", [Name]), - case lists:keyfind(Name, 1, InvalidAppsNames) of + case lists:keyfind(Name, 1, InvalidDepsNames) of false -> error({app_not_found, Name}); {Name, _App} -> @@ -176,7 +177,7 @@ check_results(AppDir, Expected) -> end ; ({app, Name, valid}) -> ct:pal("Name: ~p", [Name]), - case lists:keyfind(Name, 1, ValidAppsNames) of + case lists:keyfind(Name, 1, ValidDepsNames) of false -> error({app_not_found, Name}); {Name, _App} -> @@ -217,7 +218,7 @@ check_results(AppDir, Expected) -> {ok, Cwd} = file:get_cwd(), try file:set_cwd(AppDir), - ReleaseDir = filename:join([AppDir, "_build", "rel"]), + [ReleaseDir] = filelib:wildcard(filename:join([AppDir, "_build", "*", "rel"])), RelxState = rlx_state:new("", [], []), RelxState1 = rlx_state:base_output_dir(RelxState, ReleaseDir), {ok, RelxState2} = rlx_prv_app_discover:do(RelxState1), diff --git a/test/rebar_xref_SUITE.erl b/test/rebar_xref_SUITE.erl index 067be07..1b1d6d7 100644 --- a/test/rebar_xref_SUITE.erl +++ b/test/rebar_xref_SUITE.erl @@ -57,8 +57,9 @@ end_per_testcase(_, Config) -> %% we are about to remove the directory and there may be %% subsequent test cases that error out when the code path tries %% to include one of these soon-to-be nonexistent directories. - code:del_path(AppDir ++ "/."), - true = code:del_path(rebar_dir:ebin_dir()), + Name = ?config(app_name, Config), + EbinDir = filename:join([AppDir, "_build", "default" "lib", Name, "ebin"]), + true = code:del_path(EbinDir), file:set_cwd(OrigDir), ec_file:remove(AppDir, [recursive]), ok. |