Skip to content

Commit 6584def

Browse files
committed
Merge pull request basho#406 from stwind/master
Fix deps path check in rebar_ct:collect_glob/3
2 parents 3a0c547 + a83c80d commit 6584def

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

THANKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,4 @@ Drew Varner
130130
Roberto Aloi
131131
Luis Rascao
132132
Vlad Dumitrescu
133+
stwind

inttest/ct2/ct2_rt.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ files() ->
99
[{create, "ebin/foo.app", app(foo)},
1010
{copy, "../../rebar", "rebar"},
1111
{copy, "foo.test.spec", "foo.test.spec"},
12+
{copy, "deps/bar.test.spec", "deps/bar.test.spec"},
1213
{copy, "foo_SUITE.erl", "test/foo_SUITE.erl"}].
1314

1415
run(_Dir) ->
15-
{ok, _} = retest:sh("./rebar compile ct -vvv"),
16+
Ref = retest:sh("./rebar compile ct -vvv", [async]),
17+
{ok, [[CTRunCmd]]} = retest:sh_expect(Ref, "^\"ct_run.*",
18+
[global, {capture, first, binary}]),
19+
{match, _} = re:run(CTRunCmd, "foo.test.spec", [global]),
20+
%% deps/bar.test.spec should be ignored by rebar_ct:collect_glob/3
21+
nomatch = re:run(CTRunCmd, "bar.test.spec", [global]),
1622
ok.
1723

1824
%%

inttest/ct2/deps/bar.test.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%% this test spec should be ignored

src/rebar_ct.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,14 @@ get_cover_config(Config, Cwd) ->
291291

292292
collect_glob(Config, Cwd, Glob) ->
293293
{true, Deps} = rebar_deps:get_deps_dir(Config),
294+
DepsDir = filename:basename(Deps),
294295
CwdParts = filename:split(Cwd),
295296
filelib:fold_files(Cwd, Glob, true, fun(F, Acc) ->
296297
%% Ignore any specs under the deps/ directory. Do this pulling
297298
%% the dirname off the F and then splitting it into a list.
298299
Parts = filename:split(filename:dirname(F)),
299300
Parts2 = remove_common_prefix(Parts, CwdParts),
300-
case lists:member(Deps, Parts2) of
301+
case lists:member(DepsDir, Parts2) of
301302
true ->
302303
Acc; % There is a directory named "deps" in path
303304
false ->

0 commit comments

Comments
 (0)