aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_util.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_util.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_util.erl')
-rw-r--r--lib/common_test/src/ct_util.erl15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index 68e76c2396..abda87c2cd 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -286,14 +286,23 @@ get_start_dir() ->
%% handle verbosity outside ct_util_server (let the client read
%% the verbosity table) to avoid possible deadlock situations
set_verbosity(Elem = {_Category,_Level}) ->
- ets:insert(?verbosity_table, Elem),
- ok.
+ try ets:insert(?verbosity_table, Elem) of
+ _ ->
+ ok
+ catch
+ _:Reason ->
+ {error,Reason}
+ end.
+
get_verbosity(Category) ->
- case ets:lookup(?verbosity_table, Category) of
+ try ets:lookup(?verbosity_table, Category) of
[{Category,Level}] ->
Level;
_ ->
undefined
+ catch
+ _:Reason ->
+ {error,Reason}
end.
loop(Mode,TestData,StartDir) ->