aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_logs.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2013-06-27 23:29:16 +0200
committerPeter Andersson <[email protected]>2013-06-27 23:29:16 +0200
commit8a0a09ef168210326b29273b20520aee339aaf40 (patch)
tree8708c9dec7e6e94e563a2aaead204777c7108510 /lib/common_test/src/ct_logs.erl
parent4c3b306184d886678d08949bcbe0186af8f984b1 (diff)
downloadotp-8a0a09ef168210326b29273b20520aee339aaf40.tar.gz
otp-8a0a09ef168210326b29273b20520aee339aaf40.tar.bz2
otp-8a0a09ef168210326b29273b20520aee339aaf40.zip
Allow calls to ct:pal and ct:print even if CT is not running
Also make sure calls to ct:log and ct:pal don't cause crash if test_server is not running (could happen during startup or shutdown of CT). OTP-11176
Diffstat (limited to 'lib/common_test/src/ct_logs.erl')
-rw-r--r--lib/common_test/src/ct_logs.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl
index f5355bfefe..d80de889ca 100644
--- a/lib/common_test/src/ct_logs.erl
+++ b/lib/common_test/src/ct_logs.erl
@@ -446,6 +446,8 @@ tc_print(Category,Importance,Format,Args) ->
ct_util:get_verbosity('$unspecified');
{error,bad_invocation} ->
?MAX_VERBOSITY;
+ {error,_Failure} ->
+ ?MAX_VERBOSITY;
Val ->
Val
end,
@@ -3072,4 +3074,12 @@ unexpected_io(Pid,ct_internal,List,#logger_state{ct_log_fd=Fd}=State) ->
unexpected_io(Pid,_Category,List,State) ->
IoFun = create_io_fun(Pid,State),
Data = io_lib:format("~ts", [lists:foldl(IoFun, [], List)]),
- test_server_io:print_unexpected(Data).
+ %% if unexpected io comes in during startup or shutdown, test_server
+ %% might not be running - if so (noproc exit), simply ignore the printout
+ try test_server_io:print_unexpected(Data) of
+ _ ->
+ ok
+ catch
+ _:{noproc,_} -> ok;
+ _:Reason -> exit(Reason)
+ end.