summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_cover.erl11
-rw-r--r--src/rebar_prv_shell.erl16
2 files changed, 19 insertions, 8 deletions
diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl
index 39aa212..0ee6742 100644
--- a/src/rebar_prv_cover.erl
+++ b/src/rebar_prv_cover.erl
@@ -156,9 +156,10 @@ analysis(State, Task) ->
restore_cover_paths(State) ->
lists:foreach(fun(App) ->
AppDir = rebar_app_info:out_dir(App),
- _ = code:add_path(filename:join([AppDir, "ebin"]))
+ _ = code:add_path(filename:join([AppDir, "ebin"])),
+ _ = code:add_path(filename:join([AppDir, "test"]))
end, rebar_state:project_apps(State)),
- _ = code:add_path(filename:join([rebar_dir:base_dir(State), "ebin"])),
+ _ = code:add_path(filename:join([rebar_dir:base_dir(State), "test"])),
ok.
analyze_to_file(Mod, State, Task) ->
@@ -290,10 +291,8 @@ filter_checkouts(Apps) -> filter_checkouts(Apps, []).
filter_checkouts([], Acc) -> lists:reverse(Acc);
filter_checkouts([App|Rest], Acc) ->
- AppDir = filename:absname(rebar_app_info:dir(App)),
- CheckoutsDir = filename:absname("_checkouts"),
- case lists:prefix(CheckoutsDir, AppDir) of
- true -> filter_checkouts(Rest, Acc);
+ case rebar_app_info:is_checkout(App) of
+ true -> filter_checkouts(Rest, Acc);
false -> filter_checkouts(Rest, [App|Acc])
end.
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl
index 2d6983c..ed75b30 100644
--- a/src/rebar_prv_shell.erl
+++ b/src/rebar_prv_shell.erl
@@ -57,7 +57,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(Config) ->
- shell(),
+ shell(Config),
{ok, Config}.
-spec format_error(any()) -> iolist().
@@ -71,7 +71,7 @@ format_error(Reason) ->
%% it also lacks the ctrl-c interrupt handler that `erl` features. ctrl-c will
%% immediately kill the script. ctrl-g, however, works fine
-shell() ->
+shell(State) ->
%% scan all processes for any with references to the old user and save them to
%% update later
NeedsUpdate = [Pid || Pid <- erlang:processes(),
@@ -92,6 +92,8 @@ shell() ->
%% times). removes at most the error_logger added by init and the
%% error_logger added by the tty handler
ok = remove_error_handler(3),
+ %% add test paths
+ ok = add_test_paths(State),
%% this call never returns (until user quits shell)
timer:sleep(infinity).
@@ -116,3 +118,13 @@ wait_until_user_started(Timeout) ->
undefined -> timer:sleep(100), wait_until_user_started(Timeout - 100);
_ -> ok
end.
+
+add_test_paths(State) ->
+ lists:foreach(fun(App) ->
+ AppDir = rebar_app_info:out_dir(App),
+ %% ignore errors resulting from non-existent directories
+ _ = code:add_path(filename:join([AppDir, "ebin"])),
+ _ = code:add_path(filename:join([AppDir, "test"]))
+ end, rebar_state:project_apps(State)),
+ _ = code:add_path(filename:join([rebar_dir:base_dir(State), "test"])),
+ ok.