mirror of
https://github.com/correl/rebar.git
synced 2024-11-14 19:19:30 +00:00
commit
37cf470ae9
2 changed files with 25 additions and 17 deletions
|
@ -210,7 +210,7 @@ make_cmd(TestDir, RawLogDir, Config) ->
|
||||||
CodeDirs = [io_lib:format("\"~s\"", [Dir]) ||
|
CodeDirs = [io_lib:format("\"~s\"", [Dir]) ||
|
||||||
Dir <- [EbinDir|NonLibCodeDirs]],
|
Dir <- [EbinDir|NonLibCodeDirs]],
|
||||||
CodePathString = string:join(CodeDirs, " "),
|
CodePathString = string:join(CodeDirs, " "),
|
||||||
Cmd = case get_ct_specs(Cwd) of
|
Cmd = case get_ct_specs(Config, Cwd) of
|
||||||
undefined ->
|
undefined ->
|
||||||
?FMT("~s"
|
?FMT("~s"
|
||||||
" -pa ~s"
|
" -pa ~s"
|
||||||
|
@ -260,8 +260,8 @@ build_name(Config) ->
|
||||||
get_extra_params(Config) ->
|
get_extra_params(Config) ->
|
||||||
rebar_config:get_local(Config, ct_extra_params, "").
|
rebar_config:get_local(Config, ct_extra_params, "").
|
||||||
|
|
||||||
get_ct_specs(Cwd) ->
|
get_ct_specs(Config, Cwd) ->
|
||||||
case collect_glob(Cwd, ".*\.test\.spec\$") of
|
case collect_glob(Config, Cwd, ".*\.test\.spec\$") of
|
||||||
[] -> undefined;
|
[] -> undefined;
|
||||||
[Spec] ->
|
[Spec] ->
|
||||||
" -spec " ++ Spec;
|
" -spec " ++ Spec;
|
||||||
|
@ -275,31 +275,38 @@ get_cover_config(Config, Cwd) ->
|
||||||
false ->
|
false ->
|
||||||
"";
|
"";
|
||||||
true ->
|
true ->
|
||||||
case collect_glob(Cwd, ".*cover\.spec\$") of
|
case collect_glob(Config, Cwd, ".*cover\.spec\$") of
|
||||||
[] ->
|
[] ->
|
||||||
?DEBUG("No cover spec found: ~s~n", [Cwd]),
|
?DEBUG("No cover spec found: ~s~n", [Cwd]),
|
||||||
"";
|
"";
|
||||||
[Spec] ->
|
[Spec] ->
|
||||||
?DEBUG("Found cover file ~w~n", [Spec]),
|
?DEBUG("Found cover file ~s~n", [Spec]),
|
||||||
" -cover " ++ Spec;
|
" -cover " ++ Spec;
|
||||||
Specs ->
|
Specs ->
|
||||||
?ABORT("Multiple cover specs found: ~p~n", [Specs])
|
?ABORT("Multiple cover specs found: ~p~n", [Specs])
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
collect_glob(Cwd, Glob) ->
|
collect_glob(Config, Cwd, Glob) ->
|
||||||
filelib:fold_files(Cwd, Glob, true, fun collect_files/2, []).
|
{true, Deps} = rebar_deps:get_deps_dir(Config),
|
||||||
|
CwdParts = filename:split(Cwd),
|
||||||
|
filelib:fold_files(Cwd, Glob, true, fun(F, Acc) ->
|
||||||
|
%% Ignore any specs under the deps/ directory. Do this pulling
|
||||||
|
%% the dirname off the F and then splitting it into a list.
|
||||||
|
Parts = filename:split(filename:dirname(F)),
|
||||||
|
Parts2 = remove_common_prefix(Parts, CwdParts),
|
||||||
|
case lists:member(Deps, Parts2) of
|
||||||
|
true ->
|
||||||
|
Acc; % There is a directory named "deps" in path
|
||||||
|
false ->
|
||||||
|
[F | Acc] % No "deps" directory in path
|
||||||
|
end
|
||||||
|
end, []).
|
||||||
|
|
||||||
collect_files(F, Acc) ->
|
remove_common_prefix([H1|T1], [H1|T2]) ->
|
||||||
%% Ignore any specs under the deps/ directory. Do this pulling
|
remove_common_prefix(T1, T2);
|
||||||
%% the dirname off the the F and then splitting it into a list.
|
remove_common_prefix(L1, _) ->
|
||||||
Parts = filename:split(filename:dirname(F)),
|
L1.
|
||||||
case lists:member("deps", Parts) of
|
|
||||||
true ->
|
|
||||||
Acc; % There is a directory named "deps" in path
|
|
||||||
false ->
|
|
||||||
[F | Acc] % No "deps" directory in path
|
|
||||||
end.
|
|
||||||
|
|
||||||
get_ct_config_file(TestDir) ->
|
get_ct_config_file(TestDir) ->
|
||||||
Config = filename:join(TestDir, "test.config"),
|
Config = filename:join(TestDir, "test.config"),
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
%% for internal use only
|
%% for internal use only
|
||||||
-export([info/2]).
|
-export([info/2]).
|
||||||
|
-export([get_deps_dir/1]).
|
||||||
|
|
||||||
-record(dep, { dir,
|
-record(dep, { dir,
|
||||||
app,
|
app,
|
||||||
|
|
Loading…
Reference in a new issue