summaryrefslogtreecommitdiff
path: root/lib/common_test
diff options
context:
space:
mode:
authorSiri Hansen <siri@erlang.org>2012-07-11 11:14:23 +0200
committerSiri Hansen <siri@erlang.org>2012-08-17 11:16:21 +0200
commit06ea28e87e2edf8c26cd27de9c913a7dbf615d29 (patch)
tree2a474ea573197553e376bbed0c4e495c7bc8e665 /lib/common_test
parent1bf4656b1f7802af453f46085946ddea53119559 (diff)
downloaderlang-06ea28e87e2edf8c26cd27de9c913a7dbf615d29.tar.gz
[common_test] Don't abort test if opening of connection fails
When opening a connection, the connection process would link itself to ct_util_server before calling the init callback, e.g. in ct_netconfc, ct_telnet etc. If the init callback failed, then ct_util_server would get the 'EXIT'. ct_util looks up the pid in the connection table, but since the connection is not yet registered it is not found. ct_util does not know which process it is and will thus die - aborting the complete test run. This commit moves the link(CtUtilServer) after the init callback, so a crash in the init callback will not be detected by ct_util_server - the caller process, however, will get a 'DOWN' message due to monitoring and ct_gen_conn:start will give an error return.
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_gen_conn.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/common_test/src/ct_gen_conn.erl b/lib/common_test/src/ct_gen_conn.erl
index 72937e747c..5df9127725 100644
--- a/lib/common_test/src/ct_gen_conn.erl
+++ b/lib/common_test/src/ct_gen_conn.erl
@@ -278,8 +278,6 @@ return({To,Ref},Result) ->
init_gen(Parent,Opts) ->
process_flag(trap_exit,true),
- CtUtilServer = whereis(ct_util_server),
- link(CtUtilServer),
put(silent,false),
try (Opts#gen_opts.callback):init(Opts#gen_opts.name,
Opts#gen_opts.address,
@@ -287,6 +285,8 @@ init_gen(Parent,Opts) ->
{ok,ConnPid,State} when is_pid(ConnPid) ->
link(ConnPid),
put(conn_pid,ConnPid),
+ CtUtilServer = whereis(ct_util_server),
+ link(CtUtilServer),
Parent ! {connected,self()},
loop(Opts#gen_opts{conn_pid=ConnPid,
cb_state=State,