summaryrefslogtreecommitdiff
path: root/src/rebar_ct.erl
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>2013-08-30 18:16:09 +0900
committerYAMAMOTO Takashi <yamt@netbsd.org>2014-05-30 14:37:37 +0900
commit9713dafcb509eb39e9dddd8bba2d9591c77e7455 (patch)
tree405450015e7b73b403d1286ef6dd0365fed2ea76 /src/rebar_ct.erl
parent7fd5a2d630ab196702222e7b51bd32a55dad210c (diff)
Fix spec file look up
When trying to skip spec files under deps/ directory, ignore "deps" component which is also included in Cwd. For example, "/home/deps/src/myapp/test/cover.spec" contains "deps" component but should not be skipped if Cwd is "/home/deps/src/myapp/".
Diffstat (limited to 'src/rebar_ct.erl')
-rw-r--r--src/rebar_ct.erl30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl
index 91cd1c3..b96bb99 100644
--- a/src/rebar_ct.erl
+++ b/src/rebar_ct.erl
@@ -288,18 +288,24 @@ get_cover_config(Config, Cwd) ->
end.
collect_glob(Cwd, Glob) ->
- filelib:fold_files(Cwd, Glob, true, fun collect_files/2, []).
-
-collect_files(F, Acc) ->
- %% Ignore any specs under the deps/ directory. Do this pulling
- %% the dirname off the the F and then splitting it into a list.
- Parts = filename:split(filename:dirname(F)),
- 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.
+ 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 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, []).
+
+remove_common_prefix([H1|T1], [H1|T2]) ->
+ remove_common_prefix(T1, T2);
+remove_common_prefix(L1, _) ->
+ L1.
get_ct_config_file(TestDir) ->
Config = filename:join(TestDir, "test.config"),