Skip to content

Commit 0946ffe

Browse files
author
Brett Hazen
authored
Merge pull request #1253 from basho/patch-apply-traces
Allow redbug to be enabled from the config file
2 parents 821c56e + 0b2200d commit 0946ffe

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/riak_test_escript.erl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,6 @@ parse_command_line_tests(ParsedArgs) ->
211211
[] -> [undefined];
212212
UpgradeList -> UpgradeList
213213
end,
214-
%% this is a little ugly, the process that creates the ets table to store
215-
%% the tracing state cannot shutdown or the table will be gc'ed, so create
216-
%% a dummy proc that doens't die
217-
rt_redbug:new(),
218214
rt_redbug:set_tracing_applied(proplists:is_defined(apply_traces, ParsedArgs)),
219215
%% Parse Command Line Tests
220216
{CodePaths, SpecificTests} =

src/rt_redbug.erl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,26 @@
2626
-module(rt_redbug).
2727

2828
-export([is_tracing_applied/0]).
29-
-export([new/0]).
3029
-export([set_tracing_applied/1]).
3130
-export([stop/1]).
3231
-export([trace/2, trace/3]).
3332

34-
%% Create a new ets to store globally whether we're tracing or not.
35-
new() ->
36-
ok.
37-
3833
set_tracing_applied(TracingApplied) when is_boolean(TracingApplied) ->
39-
lager:info("Setting apply tracing to ~p", [TracingApplied]),
40-
rt_config:set(apply_traces, TracingApplied).
34+
%% Enable redbug tracing if enabled via command-line or config file
35+
Enabled = case TracingApplied of
36+
true -> TracingApplied;
37+
_ -> rt_config:get(apply_traces, false)
38+
end,
39+
case Enabled of
40+
true ->
41+
lager:warning("Will enable any redbug traces contained in the test");
42+
_ ->
43+
lager:warning("Will not enable any redbug traces contained in the test")
44+
end,
45+
rt_config:set(apply_traces, Enabled).
4146

4247
is_tracing_applied() ->
43-
rt_config:get(apply_traces).
48+
rt_config:get(apply_traces, false).
4449

4550
%% Apply traces to one or more nodes using redbug tracing and syntax.
4651
%%

0 commit comments

Comments
 (0)