Browse Source

Adjust tests-related DEBUG output

Mostly changing the format of debug messages, fixing one URL that was
bad in a warning.
pull/2393/head
Fred Hebert 4 years ago
parent
commit
9096e82754
3 changed files with 8 additions and 6 deletions
  1. +5
    -4
      src/rebar_prv_common_test.erl
  2. +1
    -0
      src/rebar_prv_cover.erl
  3. +2
    -2
      src/rebar_prv_eunit.erl

+ 5
- 4
src/rebar_prv_common_test.erl View File

@ -90,7 +90,7 @@ run_tests(State, Opts) ->
T = translate_paths(State, Opts), T = translate_paths(State, Opts),
Opts1 = setup_logdir(State, T), Opts1 = setup_logdir(State, T),
Opts2 = turn_off_auto_compile(Opts1), 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), {RawOpts, _} = rebar_state:command_parsed_args(State),
Result = case proplists:get_value(verbose, RawOpts, false) of Result = case proplists:get_value(verbose, RawOpts, false) of
true -> run_test_verbose(Opts2); true -> run_test_verbose(Opts2);
@ -145,7 +145,7 @@ symlink_to_last_ct_logs(State, Opts) ->
%% and make a new updated one %% and make a new updated one
rebar_file_utils:rm_rf(Target), rebar_file_utils:rm_rf(Target),
rebar_file_utils:symlink_or_copy(Existing, 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
end. end.
@ -235,7 +235,7 @@ cfgopts(State) ->
ensure_opts([], Acc) -> lists:reverse(Acc); ensure_opts([], Acc) -> lists:reverse(Acc);
ensure_opts([{cover, _}|Rest], 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(Rest, Acc);
ensure_opts([{auto_compile, _}|Rest], Acc) -> ensure_opts([{auto_compile, _}|Rest], Acc) ->
?WARN("Auto compile not supported", []), ?WARN("Auto compile not supported", []),
@ -389,6 +389,7 @@ compile(State, {ok, _} = Tests) ->
compile(_State, Error) -> Error. compile(_State, Error) -> Error.
do_compile(State) -> do_compile(State) ->
?DEBUG("Re-compiling the project under the test profile with CT options injected...", []),
{ok, S} = rebar_prv_compile:do(State), {ok, S} = rebar_prv_compile:do(State),
ok = maybe_cover_compile(S), ok = maybe_cover_compile(S),
{ok, S}. {ok, S}.
@ -704,7 +705,7 @@ handle_keep_logs(LogDir, N) ->
SortedDirs = lists:reverse(lists:sort(Dirs)), SortedDirs = lists:reverse(lists:sort(Dirs)),
%% sort the log dirs and keep the N - 1 newest %% sort the log dirs and keep the N - 1 newest
{_Keep, Discard} = lists:split(N - 1, SortedDirs), {_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], [rebar_file_utils:rm_rf(filename:join([LogDir, Dir])) || Dir <- Discard],
ok; ok;
%% we still dont have enough log run directories as to crash %% we still dont have enough log run directories as to crash

+ 1
- 0
src/rebar_prv_cover.erl View File

@ -326,6 +326,7 @@ cover_compile(State, Dirs) ->
%% redirect cover output %% redirect cover output
true = redirect_cover_output(State, CoverPid), true = redirect_cover_output(State, CoverPid),
ExclMods = rebar_state:get(State, cover_excl_mods, []), ExclMods = rebar_state:get(State, cover_excl_mods, []),
?DEBUG("Ignoring cover compilation of modules in {cover_excl_mods, ~p}", [ExclMods]),
lists:foreach(fun(Dir) -> lists:foreach(fun(Dir) ->
case file:list_dir(Dir) of case file:list_dir(Dir) of
{ok, Files} -> {ok, Files} ->

+ 2
- 2
src/rebar_prv_eunit.erl View File

@ -81,8 +81,8 @@ do(State, Tests) ->
run_tests(State, Tests) -> run_tests(State, Tests) ->
T = translate_paths(State, Tests), T = translate_paths(State, Tests),
EUnitOpts = resolve_eunit_opts(State), 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 try eunit:test(T, EUnitOpts) of
Result -> Result ->
ok = maybe_write_coverdata(State), ok = maybe_write_coverdata(State),

Loading…
Cancel
Save