summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_common_test.erl20
-rw-r--r--test/rebar_ct_SUITE.erl11
2 files changed, 19 insertions, 12 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index f6fee9a..4be50d8 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -381,11 +381,9 @@ maybe_inject_test_dir(State, AppAcc, [App|Rest], Dir) ->
%% suite exists in but if the suite is in the app root directory
%% the current compiler tries to compile all subdirs including priv
%% instead copy only files ending in `.erl' and directories
- %% ending in `_SUITE_data' into the `_build/PROFILE/extras' dir
- {ok, RelAppDir} = rebar_file_utils:path_from_ancestor(rebar_app_info:dir(App), rebar_state:dir(State)),
- ExtrasDir = filename:join([rebar_dir:base_dir(State), "extras", RelAppDir]),
- ok = copy_bare_suites(Dir, ExtrasDir),
- Opts = inject_test_dir(rebar_state:opts(State), ExtrasDir),
+ %% ending in `_SUITE_data' into the `_build/PROFILE/lib/APP' dir
+ ok = copy_bare_suites(Dir, rebar_app_info:out_dir(App)),
+ Opts = inject_test_dir(rebar_state:opts(State), rebar_app_info:out_dir(App)),
{rebar_state:opts(State, Opts), AppAcc ++ [App]};
{ok, Path} ->
Opts = inject_test_dir(rebar_app_info:opts(App), Path),
@@ -450,15 +448,23 @@ translate_suites(_State, [], Acc) -> lists:reverse(Acc);
translate_suites(State, [{suite, Suite}|Rest], Acc) when is_integer(hd(Suite)) ->
%% single suite
Apps = rebar_state:project_apps(State),
- translate_suites(State, Rest, [{suite, translate(State, Apps, Suite)}|Acc]);
+ translate_suites(State, Rest, [{suite, translate_suite(State, Apps, Suite)}|Acc]);
translate_suites(State, [{suite, Suites}|Rest], Acc) ->
%% multiple suites
Apps = rebar_state:project_apps(State),
- NewSuites = {suite, lists:map(fun(Suite) -> translate(State, Apps, Suite) end, Suites)},
+ NewSuites = {suite, lists:map(fun(Suite) -> translate_suite(State, Apps, Suite) end, Suites)},
translate_suites(State, Rest, [NewSuites|Acc]);
translate_suites(State, [Test|Rest], Acc) ->
translate_suites(State, Rest, [Test|Acc]).
+translate_suite(State, Apps, Suite) ->
+ Dirname = filename:dirname(Suite),
+ Basename = filename:basename(Suite),
+ case Dirname of
+ "." -> Suite;
+ _ -> filename:join([translate(State, Apps, Dirname), Basename])
+ end.
+
translate(State, [App|Rest], Path) ->
case rebar_file_utils:path_from_ancestor(Path, rebar_app_info:dir(App)) of
{ok, P} -> filename:join([rebar_app_info:out_dir(App), P]);
diff --git a/test/rebar_ct_SUITE.erl b/test/rebar_ct_SUITE.erl
index 183a1d0..94ab690 100644
--- a/test/rebar_ct_SUITE.erl
+++ b/test/rebar_ct_SUITE.erl
@@ -681,25 +681,26 @@ suite_at_app_root(Config) ->
Opts = rebar_prv_common_test:translate_paths(NewState, T),
Suite = proplists:get_value(suite, Opts),
- Expected = filename:join([AppDir, "_build", "test", "extras", "apps", Name2, "app_root_SUITE"]),
+ Expected = filename:join([AppDir, "_build", "test", "lib", Name2, "app_root_SUITE"]),
[Expected] = Suite,
- TestHrl = filename:join([AppDir, "_build", "test", "extras", "apps", Name2, "app_root_SUITE.hrl"]),
+ TestHrl = filename:join([AppDir, "_build", "test", "lib", Name2, "app_root_SUITE.hrl"]),
true = filelib:is_file(TestHrl),
- TestBeam = filename:join([AppDir, "_build", "test", "extras", "apps", Name2, "app_root_SUITE.beam"]),
+ TestBeam = filename:join([AppDir, "_build", "test", "lib", Name2, "app_root_SUITE.beam"]),
true = filelib:is_file(TestBeam),
- DataDir = filename:join([AppDir, "_build", "test", "extras", "apps", Name2, "app_root_SUITE_data"]),
+ DataDir = filename:join([AppDir, "_build", "test", "lib", Name2, "app_root_SUITE_data"]),
true = filelib:is_dir(DataDir),
- DataFile = filename:join([AppDir, "_build", "test", "extras", "root_SUITE_data", "some_data.txt"]),
+ DataFile = filename:join([AppDir, "_build", "test", "lib", Name2, "app_root_SUITE_data", "some_data.txt"]),
true = filelib:is_file(DataFile).
%% this test probably only fails when this suite is run via rebar3 with the --cover flag
data_dir_correct(Config) ->
DataDir = ?config(data_dir, Config),
Parts = filename:split(DataDir),
+ ct:pal(Parts),
["rebar_ct_SUITE_data","test","rebar","lib","test","_build"|_] = lists:reverse(Parts).
cmd_label(Config) ->