aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/cth_log_redirect.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2012-02-17 22:33:49 +0100
committerPeter Andersson <[email protected]>2012-02-21 22:15:03 +0100
commitf1956846b7c8b42f51ff10467f28aee1bffb711f (patch)
tree84ccdfce5aad88e7bc3e6a3ac64ceedd3252bfe1 /lib/common_test/src/cth_log_redirect.erl
parent8d59a1fc518719c8c445d9d94b23c173c18b4438 (diff)
downloadotp-f1956846b7c8b42f51ff10467f28aee1bffb711f.tar.gz
otp-f1956846b7c8b42f51ff10467f28aee1bffb711f.tar.bz2
otp-f1956846b7c8b42f51ff10467f28aee1bffb711f.zip
Implement asynchronous call to print to test case log file
In order to avoid possible deadlock when the cth_log_redirect hook prints via ct_logs to the test case log file, the print call must be made by a separate (temporary) process, instead of ct_logs.
Diffstat (limited to 'lib/common_test/src/cth_log_redirect.erl')
-rw-r--r--lib/common_test/src/cth_log_redirect.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/common_test/src/cth_log_redirect.erl b/lib/common_test/src/cth_log_redirect.erl
index 14663b7738..e43ff875b3 100644
--- a/lib/common_test/src/cth_log_redirect.erl
+++ b/lib/common_test/src/cth_log_redirect.erl
@@ -38,15 +38,15 @@ id(_Opts) ->
init(?MODULE, _Opts) ->
error_logger:add_report_handler(?MODULE),
- tc_log.
+ tc_log_async.
-post_init_per_group(Group, Config, Result, tc_log) ->
+post_init_per_group(Group, Config, Result, tc_log_async) ->
case lists:member(parallel,proplists:get_value(
tc_group_properties,Config,[])) of
true ->
{Result, {set_log_func(ct_log),Group}};
false ->
- {Result, tc_log}
+ {Result, tc_log_async}
end;
post_init_per_group(_Group, _Config, Result, State) ->
{Result, State}.
@@ -58,14 +58,14 @@ post_end_per_testcase(_TC, _Config, Result, State) ->
{Result, State}.
pre_end_per_group(Group, Config, {ct_log, Group}) ->
- {Config, set_log_func(tc_log)};
+ {Config, set_log_func(tc_log_async)};
pre_end_per_group(_Group, Config, State) ->
{Config, State}.
%% Copied and modified from sasl_report_tty_h.erl
init(_Type) ->
- {ok, tc_log}.
+ {ok, tc_log_async}.
handle_event({_Type, GL, _Msg}, State) when node(GL) /= node() ->
{ok, State};