aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_logs.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2013-06-28 16:26:24 +0200
committerPeter Andersson <[email protected]>2013-06-28 16:26:24 +0200
commitac887c1fab12ab3c2502489cb747b08daa2214ea (patch)
tree981024b2cab647513dc31320e6c93f91bf2ebd86 /lib/common_test/src/ct_logs.erl
parent1151a45d49e90383931c92433b15b754156b833d (diff)
downloadotp-ac887c1fab12ab3c2502489cb747b08daa2214ea.tar.gz
otp-ac887c1fab12ab3c2502489cb747b08daa2214ea.tar.bz2
otp-ac887c1fab12ab3c2502489cb747b08daa2214ea.zip
Make the CT logger print to stdout if test_server is not running
OTP-11176
Diffstat (limited to 'lib/common_test/src/ct_logs.erl')
-rw-r--r--lib/common_test/src/ct_logs.erl22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl
index d80de889ca..bd37b690b6 100644
--- a/lib/common_test/src/ct_logs.erl
+++ b/lib/common_test/src/ct_logs.erl
@@ -692,14 +692,15 @@ logger_loop(State) ->
false ->
%% Group leader is dead, so write to the
%% CtLog or unexpected_io log instead
- unexpected_io(Pid,Category,List,State),
+ unexpected_io(Pid,Category,Importance,
+ List,State),
logger_loop(State)
end;
{ct_log,_Fd,TCGLs} ->
%% If category is ct_internal then write
%% to ct_log, else write to unexpected_io
%% log
- unexpected_io(Pid,Category,List,State),
+ unexpected_io(Pid,Category,Importance,List,State),
logger_loop(State#logger_state{
tc_groupleaders = TCGLs})
end;
@@ -800,7 +801,7 @@ print_to_log(sync, FromPid, Category, TCGL, List, State) ->
IoFun = create_io_fun(FromPid, State),
io:format(TCGL,"~ts", [lists:foldl(IoFun, [], List)]);
true ->
- unexpected_io(FromPid,Category,List,State)
+ unexpected_io(FromPid,Category,?MAX_IMPORTANCE,List,State)
end,
State;
@@ -816,7 +817,8 @@ print_to_log(async, FromPid, Category, TCGL, List, State) ->
end;
true ->
fun() ->
- unexpected_io(FromPid,Category,List,State)
+ unexpected_io(FromPid,Category,?MAX_IMPORTANCE,
+ List,State)
end
end,
case State#logger_state.async_print_jobs of
@@ -3068,18 +3070,20 @@ html_encoding(latin1) ->
html_encoding(utf8) ->
"utf-8".
-unexpected_io(Pid,ct_internal,List,#logger_state{ct_log_fd=Fd}=State) ->
+unexpected_io(Pid,ct_internal,_Importance,List,State) ->
IoFun = create_io_fun(Pid,State),
- io:format(Fd, "~ts", [lists:foldl(IoFun, [], List)]);
-unexpected_io(Pid,_Category,List,State) ->
+ io:format(State#logger_state.ct_log_fd, "~ts",
+ [lists:foldl(IoFun, [], List)]);
+unexpected_io(Pid,Category,Importance,List,State) ->
IoFun = create_io_fun(Pid,State),
Data = io_lib:format("~ts", [lists:foldl(IoFun, [], List)]),
%% if unexpected io comes in during startup or shutdown, test_server
- %% might not be running - if so (noproc exit), simply ignore the printout
+ %% might not be running - if so (noproc exit), simply print to
+ %% stdout instead (will result in double printouts when pal is used)
try test_server_io:print_unexpected(Data) of
_ ->
ok
catch
- _:{noproc,_} -> ok;
+ _:{noproc,_} -> tc_print(Category,Importance,Data,[]);
_:Reason -> exit(Reason)
end.