diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-02-26 09:11:59 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-02-28 09:56:19 -0600 |
commit | ae9c83fb4bafd3f2faf849c931ba440053f5cb97 (patch) | |
tree | 8311b5df10f10afeb23b8ac9284f7ca4340ab92a /test | |
parent | d4c2332aabb4337b49bb3ef03793408c58afd5d4 (diff) |
copy project apps to deps output dir for compilation
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_compile_SUITE.erl | 14 | ||||
-rw-r--r-- | test/rebar_test_utils.erl | 19 | ||||
-rw-r--r-- | test/rebar_xref_SUITE.erl | 5 |
3 files changed, 20 insertions, 18 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 8dfb7ad..157c2df 100644 --- a/test/rebar_test_utils.erl +++ b/test/rebar_test_utils.erl @@ -146,12 +146,13 @@ check_results(AppDir, Expected) -> 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], + + 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), @@ -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} -> 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. |