From 9096e827547c1d79968ed352f49fc934f9e8b7ac Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 9 Oct 2020 14:57:06 +0000 Subject: [PATCH] Adjust tests-related DEBUG output Mostly changing the format of debug messages, fixing one URL that was bad in a warning. --- src/rebar_prv_common_test.erl | 9 +++++---- src/rebar_prv_cover.erl | 1 + src/rebar_prv_eunit.erl | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index c27c1bfb..fd437b3f 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -90,7 +90,7 @@ run_tests(State, Opts) -> T = translate_paths(State, Opts), Opts1 = setup_logdir(State, T), Opts2 = turn_off_auto_compile(Opts1), - ?DEBUG("ct_opts ~p", [Opts2]), + ?DEBUG("Running tests with {ct_opts, ~p}.", [Opts2]), {RawOpts, _} = rebar_state:command_parsed_args(State), Result = case proplists:get_value(verbose, RawOpts, false) of true -> run_test_verbose(Opts2); @@ -145,7 +145,7 @@ symlink_to_last_ct_logs(State, Opts) -> %% and make a new updated one rebar_file_utils:rm_rf(Target), rebar_file_utils:symlink_or_copy(Existing, Target); - Reason -> ?DEBUG("Warning, couldn't make a symlink to ~ts, reason: ~p.", [Target, Reason]) + Reason -> ?DIAGNOSTIC("Warning, couldn't make a symlink to ~ts, reason: ~p.", [Target, Reason]) end end. @@ -235,7 +235,7 @@ cfgopts(State) -> ensure_opts([], Acc) -> lists:reverse(Acc); ensure_opts([{cover, _}|Rest], Acc) -> - ?WARN("Cover specs not supported. See http://www.rebar3.org/docs/running-tests#common-test", []), + ?WARN("Cover specs not supported. See https://www.rebar3.org/docs/testing/ct/", []), ensure_opts(Rest, Acc); ensure_opts([{auto_compile, _}|Rest], Acc) -> ?WARN("Auto compile not supported", []), @@ -389,6 +389,7 @@ compile(State, {ok, _} = Tests) -> compile(_State, Error) -> Error. do_compile(State) -> + ?DEBUG("Re-compiling the project under the test profile with CT options injected...", []), {ok, S} = rebar_prv_compile:do(State), ok = maybe_cover_compile(S), {ok, S}. @@ -704,7 +705,7 @@ handle_keep_logs(LogDir, N) -> SortedDirs = lists:reverse(lists:sort(Dirs)), %% sort the log dirs and keep the N - 1 newest {_Keep, Discard} = lists:split(N - 1, SortedDirs), - ?DEBUG("Removing the following directories because keep_logs option was found: ~p", [Discard]), + ?DEBUG("Removing the following directories because keep_logs is in ct_opts: ~p", [Discard]), [rebar_file_utils:rm_rf(filename:join([LogDir, Dir])) || Dir <- Discard], ok; %% we still dont have enough log run directories as to crash diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl index 1acf4f82..611795d9 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -326,6 +326,7 @@ cover_compile(State, Dirs) -> %% redirect cover output true = redirect_cover_output(State, CoverPid), ExclMods = rebar_state:get(State, cover_excl_mods, []), + ?DEBUG("Ignoring cover compilation of modules in {cover_excl_mods, ~p}", [ExclMods]), lists:foreach(fun(Dir) -> case file:list_dir(Dir) of {ok, Files} -> diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 47644392..399d88c6 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -81,8 +81,8 @@ do(State, Tests) -> run_tests(State, Tests) -> T = translate_paths(State, Tests), EUnitOpts = resolve_eunit_opts(State), - ?DEBUG("eunit_tests ~p", [T]), - ?DEBUG("eunit_opts ~p", [EUnitOpts]), + ?DEBUG("finding tests in:~n\t{eunit_tests, ~p}.", [T]), + ?DEBUG("with options:~n\t{eunit_opts, ~p}.", [EUnitOpts]), try eunit:test(T, EUnitOpts) of Result -> ok = maybe_write_coverdata(State),