diff options
-rw-r--r-- | rebar.config | 2 | ||||
-rw-r--r-- | rebar.lock | 4 | ||||
-rw-r--r-- | src/cth_retry.erl | 4 | ||||
-rw-r--r-- | src/rebar_prv_common_test.erl | 2 | ||||
-rw-r--r-- | src/rebar_utils.erl | 21 |
5 files changed, 22 insertions, 11 deletions
diff --git a/rebar.config b/rebar.config index 8877e73..6ffdfd5 100644 --- a/rebar.config +++ b/rebar.config @@ -10,7 +10,7 @@ {bbmustache, "1.6.1"}, {relx, "3.33.0"}, {cf, "0.2.2"}, - {cth_readable, "1.4.5"}, + {cth_readable, "1.4.6"}, {eunit_formatters, "0.5.0"}]}. {post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", @@ -2,7 +2,7 @@ [{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.6.1">>},0}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},0}, {<<"cf">>,{pkg,<<"cf">>,<<"0.2.2">>},0}, - {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.4.5">>},0}, + {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.4.6">>},0}, {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"1.3.1">>},0}, {<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.5.0">>},0}, {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0}, @@ -15,7 +15,7 @@ {<<"bbmustache">>, <<"9FB63FA60BD53AFBF47F02E6D8BD6B2BEAFC068E02E20975254DC7461FD4F397">>}, {<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>}, {<<"cf">>, <<"7F2913FFF90ABCABD0F489896CFEB0B0674F6C8DF6C10B17A83175448029896C">>}, - {<<"cth_readable">>, <<"BE3765763F9BEA87320F03F33B578875F8B3A4E8BD970EAE198AFF8A3F1AB38F">>}, + {<<"cth_readable">>, <<"29DF6430584389B30D14B7D68D0EB7BC837ED31E2DF6E9D93598D4EC63B1E3BD">>}, {<<"erlware_commons">>, <<"0CE192AD69BC6FD0880246D852D0ECE17631E234878011D1586E053641ED4C04">>}, {<<"eunit_formatters">>, <<"6A9133943D36A465D804C1C5B6E6839030434B8879C5600D7DDB5B3BAD4CCB59">>}, {<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}, diff --git a/src/cth_retry.erl b/src/cth_retry.erl index 7056c71..b745c35 100644 --- a/src/cth_retry.erl +++ b/src/cth_retry.erl @@ -94,7 +94,7 @@ on_tc_skip(Suite, TC, {tc_auto_skip, _}, State=#state{suite=Suite, groups=Groups {end_per_group, _} -> Acc; init_per_suite -> Acc; end_per_suite -> Acc; - {_Group, Case} -> [{Suite, Groups, Case}|Acc]; + {Case, _Group} -> [{Suite, Groups, Case}|Acc]; TC -> [{Suite, Groups, TC}|Acc] end, State#state{suite=Suite, acc=NewAcc}; @@ -111,7 +111,7 @@ on_tc_skip(TC, {tc_auto_skip, _}, State=#state{suite=Suite, groups=Groups, acc=A {end_per_group, _} -> Acc; init_per_suite -> Acc; end_per_suite -> Acc; - {_Group, Case} -> [{Suite, Groups, Case}|Acc]; + {Case, _Group} -> [{Suite, Groups, Case}|Acc]; TC -> [{Suite, Groups, TC}|Acc] end, State#state{acc=NewAcc}; diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index c31c060..ea1477e 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -261,7 +261,7 @@ select_tests(State, ProjectApps, CmdOpts, CfgOpts) -> %% to our best ability. rebar_paths:set_paths([deps, plugins], State), [application:load(Application) || Config <- Configs, {Application, _} <- Config], - rebar_utils:reread_config(Configs), + rebar_utils:reread_config(Configs, [update_logger]), Opts = merge_opts(CmdOpts,CfgOpts), discover_tests(State, ProjectApps, Opts). diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 5c7da92..7b267e3 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -502,15 +502,26 @@ reread_logger_config() -> Primary = #{level => LogLvlPrimary, filter_default => FilterDefault, filters => Filters}, - %% Load the correct handlers based on their individual config. - [case Id of - default -> logger:update_handler_config(Id, Cfg); - _ -> logger:add_handler(Id, Mod, Cfg) - end || {handler, Id, Mod, Cfg} <- LogCfg], + lists:foreach(fun maybe_reset_logger_handler/1, LogCfg), logger:set_primary_config(Primary), ok end. +%% @private add or update handlers based on their individual config, +%% also remove default handler if needed. +maybe_reset_logger_handler({handler, Id, Mod, Cfg}) -> + case logger:add_handler(Id, Mod, Cfg) of + {error, {already_exist, Id}} -> + logger:update_handler_config(Id, Cfg); + _ -> + ok + end; +maybe_reset_logger_handler({handler, default, undefined}) -> + _ = logger:remove_handler(default), + ok; +maybe_reset_logger_handler(_) -> + ok. + %% @doc Given env. variable `FOO' we want to expand all references to %% it in `InStr'. References can have two forms: `$FOO' and `${FOO}' |