diff options
author | Siri Hansen <[email protected]> | 2012-07-02 17:56:24 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2012-08-17 11:15:49 +0200 |
commit | b26f1ce4ba088efa7538122680f828b3f92f57d8 (patch) | |
tree | 822f516a7aa988eed91c745eea30e418187a9314 /lib/common_test/src/ct_util.erl | |
parent | cfff69a3a181f2092bc4a085ca677b1b5735bda7 (diff) | |
download | otp-b26f1ce4ba088efa7538122680f828b3f92f57d8.tar.gz otp-b26f1ce4ba088efa7538122680f828b3f92f57d8.tar.bz2 otp-b26f1ce4ba088efa7538122680f828b3f92f57d8.zip |
[common_test] Don't abort test run if connection process crashes
Earlier ct_util_server would terminate and thus abort the complete
test run if a connection process (ct_gen_conn) crashed. This is now
changed so that ct_util will only print an error report (in the test
case log) and continue the rest of the test.
Diffstat (limited to 'lib/common_test/src/ct_util.erl')
-rw-r--r-- | lib/common_test/src/ct_util.erl | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl index 9d6ee3c8b9..66ecb142ca 100644 --- a/lib/common_test/src/ct_util.erl +++ b/lib/common_test/src/ct_util.erl @@ -369,11 +369,23 @@ loop(Mode,TestData,StartDir) -> {'EXIT',_Pid,normal} -> loop(Mode,TestData,StartDir); {'EXIT',Pid,Reason} -> - %% Let process crash in case of error, this shouldn't happen! - io:format("\n\nct_util_server got EXIT from ~p: ~p\n\n", - [Pid,Reason]), - file:set_cwd(StartDir), - exit(Reason) + case ets:lookup(?conn_table,Pid) of + [#conn{address=A,callback=CB}] -> + %% A connection crashed - remove the connection but don't die + ct_logs:tc_log_async(ct_error_notify, + "Connection process died: " + "Pid: ~p, Address: ~p, Callback: ~p\n" + "Reason: ~p\n\n", + [Pid,A,CB,Reason]), + catch CB:close(Pid), + loop(Mode,TestData,StartDir); + _ -> + %% Let process crash in case of error, this shouldn't happen! + io:format("\n\nct_util_server got EXIT from ~p: ~p\n\n", + [Pid,Reason]), + file:set_cwd(StartDir), + exit(Reason) + end end. |