From 6e9038f942dbe5f7968c2f6467f3d85a7fe458a2 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 19 Dec 2012 16:05:08 +0100 Subject: [common_test] Stop cover on slave node after node is terminated Before terminating slave nodes, common_test calls cover:flush/1 to fetch data from the node without actually stopping cover on this node. If cover is not stopped for the node and a new node with the same name is started, then cover will be started on the new node. To avoid this common_test now calls cover:stop/1 after the slave node is terminated. --- lib/common_test/src/ct_slave.erl | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'lib/common_test/src/ct_slave.erl') diff --git a/lib/common_test/src/ct_slave.erl b/lib/common_test/src/ct_slave.erl index 58633b7de6..1fd8c04f8b 100644 --- a/lib/common_test/src/ct_slave.erl +++ b/lib/common_test/src/ct_slave.erl @@ -449,15 +449,29 @@ wait_for_node_alive(Node, N) -> % call init:stop on a remote node do_stop(ENode) -> - case test_server:is_cover() of - true -> - MainCoverNode = cover:get_main_node(), - rpc:call(MainCoverNode,cover,flush,[ENode]); - false -> - ok + {Cover,MainCoverNode} = + case test_server:is_cover() of + true -> + Main = cover:get_main_node(), + rpc:call(Main,cover,flush,[ENode]), + {true,Main}; + false -> + {false,undefined} end, spawn(ENode, init, stop, []), - wait_for_node_dead(ENode, 5). + case wait_for_node_dead(ENode, 5) of + {ok,ENode} -> + if Cover -> + %% To avoid that cover is started again if a node + %% with the same name is started later. + rpc:call(MainCoverNode,cover,stop,[ENode]); + true -> + ok + end, + {ok,ENode}; + Error -> + Error + end. % wait N seconds until node is disconnected wait_for_node_dead(Node, 0) -> -- cgit v1.2.3