Skip to content

Commit d3f5438

Browse files
committed
CT: disable cth_readable_failonly hook when verbose option is set
1 parent b3d35a2 commit d3f5438

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apps/rebar/src/rebar_prv_common_test.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,22 @@ add_hooks(Opts, State) ->
273273
true -> [cth_fail_fast];
274274
false -> []
275275
end,
276+
% cth_readable_failonly hides all ct:pal for successful tests.
277+
% When user asks for verbose operation, show these logs
278+
{RawOpts, _} = rebar_state:command_parsed_args(State),
279+
FailOnlyHook = case proplists:get_value(verbose, RawOpts, false) of
280+
true -> [];
281+
false -> [cth_readable_failonly]
282+
end,
276283
case {readable(State), lists:keyfind(ct_hooks, 1, Opts)} of
277284
{false, _} ->
278285
Opts;
279286
{Other, false} ->
280-
[{ct_hooks, [cth_readable_failonly, readable_shell_type(Other),
287+
[{ct_hooks, FailOnlyHook ++ [readable_shell_type(Other),
281288
cth_retry] ++ FailFast ++ cth_log_redirect()} | Opts];
282289
{Other, {ct_hooks, Hooks}} ->
283290
%% Make sure hooks are there once only and add wanted hooks that are not defined yet
284-
ReadableHooks = [cth_readable_failonly, readable_shell_type(Other),
291+
ReadableHooks = FailOnlyHook ++ [readable_shell_type(Other),
285292
cth_retry] ++ FailFast,
286293
NewHooks = Hooks ++ [ReadableHook ||
287294
ReadableHook <- ReadableHooks,

0 commit comments

Comments
 (0)