aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-11-13 17:04:54 +0100
committerSiri Hansen <[email protected]>2012-11-14 11:07:12 +0100
commit2145697ca8263f7afe5824dcf2cf4539dab5fa59 (patch)
tree14f439c55290cb8b776e5e909d4e685c0c48d5fd
parent27e544f51c93c058153444876ea5cc0c7516f3fd (diff)
downloadotp-2145697ca8263f7afe5824dcf2cf4539dab5fa59.tar.gz
otp-2145697ca8263f7afe5824dcf2cf4539dab5fa59.tar.bz2
otp-2145697ca8263f7afe5824dcf2cf4539dab5fa59.zip
[common_test] Ensure process down after ct_netconf:close_session
OTP-10510 When starting a named netconf connection directly after stopping one with the same name, it sometimes failed with 'connection_exists'. This has been corrected.
-rw-r--r--lib/common_test/src/ct_netconfc.erl21
-rw-r--r--lib/common_test/test/ct_netconfc_SUITE.erl2
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/common_test/src/ct_netconfc.erl b/lib/common_test/src/ct_netconfc.erl
index 52fe9599ce..28480ed983 100644
--- a/lib/common_test/src/ct_netconfc.erl
+++ b/lib/common_test/src/ct_netconfc.erl
@@ -968,7 +968,7 @@ close_session(Client) ->
%% @end
%%----------------------------------------------------------------------
close_session(Client, Timeout) ->
- call(Client,{send_rpc_op, close_session, [], Timeout}).
+ call(Client,{send_rpc_op, close_session, [], Timeout}, true).
%%----------------------------------------------------------------------
@@ -1121,17 +1121,26 @@ close(Client) ->
%% Internal functions
%%----------------------------------------------------------------------
call(Client, Msg) ->
- call(Client, Msg, infinity).
-call(Client, Msg, Timeout) ->
+ call(Client, Msg, infinity, false).
+call(Client, Msg, Timeout) when is_integer(Timeout); Timeout==infinity ->
+ call(Client, Msg, Timeout, false);
+call(Client, Msg, WaitStop) when is_boolean(WaitStop) ->
+ call(Client, Msg, infinity, WaitStop).
+call(Client, Msg, Timeout, WaitStop) ->
case get_handle(Client) of
{ok,Pid} ->
case ct_gen_conn:call(Pid,Msg,Timeout) of
- {error,{process_down,Client,noproc}} ->
+ {error,{process_down,Pid,noproc}} ->
{error,no_such_client};
- {error,{process_down,Client,normal}} ->
+ {error,{process_down,Pid,normal}} ->
{error,closed};
- {error,{process_down,Client,Reason}} ->
+ {error,{process_down,Pid,Reason}} ->
{error,{closed,Reason}};
+ Other when WaitStop ->
+ MRef = erlang:monitor(process,Pid),
+ receive {'DOWN',MRef,process,_,_} -> Other
+ after Timeout -> {error,{timeout,Other}}
+ end;
Other ->
Other
end;
diff --git a/lib/common_test/test/ct_netconfc_SUITE.erl b/lib/common_test/test/ct_netconfc_SUITE.erl
index 30084a6228..3042a924fe 100644
--- a/lib/common_test/test/ct_netconfc_SUITE.erl
+++ b/lib/common_test/test/ct_netconfc_SUITE.erl
@@ -113,7 +113,7 @@ reformat(Events, EH) ->
%%%-----------------------------------------------------------------
%%% TEST EVENTS
%%%-----------------------------------------------------------------
-events_to_check(Test,Config) ->
+events_to_check(default,Config) ->
{module,_} = code:load_abs(filename:join(?config(data_dir,Config),
netconfc1_SUITE)),
TCs = netconfc1_SUITE:all(),