From 7fd5a2d630ab196702222e7b51bd32a55dad210c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 30 Aug 2013 18:10:17 +0900 Subject: Fix a format of a debug output --- src/rebar_ct.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index f3ed29f..91cd1c3 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -280,7 +280,7 @@ get_cover_config(Config, Cwd) -> ?DEBUG("No cover spec found: ~s~n", [Cwd]), ""; [Spec] -> - ?DEBUG("Found cover file ~w~n", [Spec]), + ?DEBUG("Found cover file ~s~n", [Spec]), " -cover " ++ Spec; Specs -> ?ABORT("Multiple cover specs found: ~p~n", [Specs]) -- cgit v1.1 From 9713dafcb509eb39e9dddd8bba2d9591c77e7455 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 30 Aug 2013 18:16:09 +0900 Subject: 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/". --- src/rebar_ct.erl | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src') 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"), -- cgit v1.1 From ad588a70b736162626cbe75671ca2ab785d85428 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 30 May 2014 14:38:39 +0900 Subject: fix double "the" in a comment noted by @tuncer --- src/rebar_ct.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index b96bb99..4a6f11e 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -291,7 +291,7 @@ collect_glob(Cwd, Glob) -> 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. + %% 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 -- cgit v1.1 From 5e91322e4ab0383068463844ead85ff15c0fba9e Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 30 May 2014 14:48:15 +0900 Subject: use the effective deps dir instead of hardcoding "deps" suggested by @tuncer --- src/rebar_ct.erl | 13 +++++++------ src/rebar_deps.erl | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index 4a6f11e..c075e8c 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -210,7 +210,7 @@ make_cmd(TestDir, RawLogDir, Config) -> CodeDirs = [io_lib:format("\"~s\"", [Dir]) || Dir <- [EbinDir|NonLibCodeDirs]], CodePathString = string:join(CodeDirs, " "), - Cmd = case get_ct_specs(Cwd) of + Cmd = case get_ct_specs(Config, Cwd) of undefined -> ?FMT("~s" " -pa ~s" @@ -260,8 +260,8 @@ build_name(Config) -> get_extra_params(Config) -> rebar_config:get_local(Config, ct_extra_params, ""). -get_ct_specs(Cwd) -> - case collect_glob(Cwd, ".*\.test\.spec\$") of +get_ct_specs(Config, Cwd) -> + case collect_glob(Config, Cwd, ".*\.test\.spec\$") of [] -> undefined; [Spec] -> " -spec " ++ Spec; @@ -275,7 +275,7 @@ get_cover_config(Config, Cwd) -> false -> ""; true -> - case collect_glob(Cwd, ".*cover\.spec\$") of + case collect_glob(Config, Cwd, ".*cover\.spec\$") of [] -> ?DEBUG("No cover spec found: ~s~n", [Cwd]), ""; @@ -287,14 +287,15 @@ get_cover_config(Config, Cwd) -> end end. -collect_glob(Cwd, Glob) -> +collect_glob(Config, Cwd, Glob) -> + {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 + case lists:member(Deps, Parts2) of true -> Acc; % There is a directory named "deps" in path false -> diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 43bde04..68fb40c 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -40,6 +40,7 @@ %% for internal use only -export([info/2]). +-export([get_deps_dir/1]). -record(dep, { dir, app, -- cgit v1.1