summaryrefslogtreecommitdiff
path: root/src/rebar_prv_common_test.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_common_test.erl')
-rw-r--r--src/rebar_prv_common_test.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 893f373..d4370de 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -38,6 +38,8 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
?INFO("Running Common Test suites...", []),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
+
%% Run ct provider prehooks
Providers = rebar_state:providers(State),
Cwd = rebar_dir:get_cwd(),
@@ -47,11 +49,14 @@ do(State) ->
{ok, State1} = Result ->
%% Run ct provider posthooks
rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State1),
+ rebar_utils:cleanup_code_path(rebar_state:code_paths(State1, default)),
Result;
?PRV_ERROR(_) = Error ->
+ rebar_utils:cleanup_code_path(rebar_state:code_paths(State, default)),
Error
catch
throw:{error, Reason} ->
+ rebar_utils:cleanup_code_path(rebar_state:code_paths(State, default)),
?PRV_ERROR(Reason)
end.
@@ -242,7 +247,7 @@ copy_and_compile_test_suites(State, Opts) ->
Dirs = find_suite_dirs(AllSuites),
lists:foreach(fun(S) ->
NewPath = copy(State, S),
- compile_dir(State, NewPath)
+ compile_dir(State, S, NewPath)
end, Dirs),
NewSuites = lists:map(fun(S) -> retarget_path(State, S) end, AllSuites),
[{suite, NewSuites}|lists:keydelete(suite, 1, Opts)]
@@ -254,12 +259,12 @@ copy_and_compile_test_dirs(State, Opts) ->
%% dir is a single directory
Dir when is_list(Dir), is_integer(hd(Dir)) ->
NewPath = copy(State, Dir),
- [{dir, compile_dir(State, NewPath)}|lists:keydelete(dir, 1, Opts)];
+ [{dir, compile_dir(State, Dir, NewPath)}|lists:keydelete(dir, 1, Opts)];
%% dir is a list of directories
Dirs when is_list(Dirs) ->
NewDirs = lists:map(fun(Dir) ->
NewPath = copy(State, Dir),
- compile_dir(State, NewPath)
+ compile_dir(State, Dir, NewPath)
end, Dirs),
[{dir, NewDirs}|lists:keydelete(dir, 1, Opts)]
end.
@@ -296,11 +301,11 @@ copy(State, Dir) ->
Target
end.
-compile_dir(State, Dir) ->
+compile_dir(State, Dir, OutDir) ->
NewState = replace_src_dirs(State, [Dir]),
- ok = rebar_erlc_compiler:compile(NewState, rebar_dir:base_dir(State), Dir),
+ ok = rebar_erlc_compiler:compile(NewState, rebar_dir:base_dir(State), OutDir),
ok = maybe_cover_compile(State, Dir),
- Dir.
+ OutDir.
retarget_path(State, Path) ->
ProjectApps = rebar_state:project_apps(State),