aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2013-02-06 17:23:19 +0100
committerSiri Hansen <[email protected]>2013-02-07 11:59:36 +0100
commitdc6996d047f6284ceb58d26240300ddfc98f03ac (patch)
tree3065507752f8a2875f588d28f46898fe066a0610
parenteccb4b5b7d7a7a3aa7bb8f7e541a9d8c4257ca9f (diff)
downloadotp-dc6996d047f6284ceb58d26240300ddfc98f03ac.tar.gz
otp-dc6996d047f6284ceb58d26240300ddfc98f03ac.tar.bz2
otp-dc6996d047f6284ceb58d26240300ddfc98f03ac.zip
[test_server] Add error printouts in case writing to test case html log fails
Errors are printed to unexpected_io log.
-rw-r--r--lib/test_server/src/test_server_gl.erl23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/test_server/src/test_server_gl.erl b/lib/test_server/src/test_server_gl.erl
index 0ab0d58040..766a4537a2 100644
--- a/lib/test_server/src/test_server_gl.erl
+++ b/lib/test_server/src/test_server_gl.erl
@@ -159,7 +159,15 @@ handle_call({print,Detail,Msg,Printer}, {From,_}, St) ->
handle_cast(stop, St) ->
{stop,normal,St}.
-handle_info({'DOWN',Ref,process,_,_}, #st{minor_monitor=Ref}=St) ->
+handle_info({'DOWN',Ref,process,_,Reason}=D, #st{minor_monitor=Ref}=St) ->
+ case Reason of
+ normal -> ok;
+ _ ->
+ Data = io_lib:format("=== WARNING === TC: ~w\n"
+ "Got down from minor Fd ~w: ~w\n\n",
+ [St#st.tc,St#st.minor,D]),
+ test_server_io:print(xxxFrom, unexpected_io, Data)
+ end,
{noreply,St#st{minor=none,minor_monitor=none}};
handle_info({permit_io,Pid}, #st{permit_io=P}=St) ->
{noreply,St#st{permit_io=gb_sets:add(Pid, P)}};
@@ -253,12 +261,19 @@ output_to_file(minor, Data0, From, #st{tc={M,F,A},minor=none}) ->
Data = [io_lib:format("=== ~w:~w/~w\n", [M,F,A]),Data0],
test_server_io:print(From, unexpected_io, Data),
ok;
-output_to_file(minor, Data, From, #st{minor=Fd}) ->
+output_to_file(minor, Data, From, #st{tc=TC,minor=Fd}) ->
try
io:put_chars(Fd, Data)
catch
- _:_ ->
- test_server_io:print(From, unexpected_io, Data)
+ Type:Reason ->
+ Data1 =
+ [io_lib:format("=== ERROR === TC: ~w\n"
+ "Failed to write to minor Fd: ~w\n"
+ "Type: ~w\n"
+ "Reason: ~w\n",
+ [TC,Fd,Type,Reason]),
+ Data,"\n"],
+ test_server_io:print(From, unexpected_io, Data1)
end;
output_to_file(Detail, Data, From, _) ->
test_server_io:print(From, Detail, Data).