aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-10-12 15:49:22 +0200
committerSiri Hansen <[email protected]>2012-10-30 11:17:57 +0100
commit8179e41007922c059b8f9441f563edf694b8b315 (patch)
tree5aa16454a445071af2f981ffd53c4f17b8bfeef3 /lib/tools/src
parent6b57abc785818bccf8ee615d3071dc24fa54daca (diff)
downloadotp-8179e41007922c059b8f9441f563edf694b8b315.tar.gz
otp-8179e41007922c059b8f9441f563edf694b8b315.tar.bz2
otp-8179e41007922c059b8f9441f563edf694b8b315.zip
[cover] Add support for test_server
OTP-10523 * Added cover:flush(Nodes), which will fetch data from remote nodes without stopping cover on those nodes. * Added cover:get_main_node(), which returns the node name of the main node. This is used by test_server to avoid {error,not_main_node} when a slave starts another slave (e.g. in test_server's own tests).
Diffstat (limited to 'lib/tools/src')
-rw-r--r--lib/tools/src/cover.erl31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index e21bd1b88c..fb65206938 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -81,8 +81,9 @@
export/1, export/2, import/1,
modules/0, imported/0, imported_modules/0, which_nodes/0, is_compiled/1,
reset/1, reset/0,
+ flush/1,
stop/0, stop/1]).
--export([remote_start/1]).
+-export([remote_start/1,get_main_node/0]).
%-export([bump/5]).
-export([transform/4]). % for test purposes
@@ -497,6 +498,19 @@ stop(Node) when is_atom(Node) ->
stop(Nodes) ->
call({stop,remove_myself(Nodes,[])}).
+%% flush(Nodes) -> ok | {error,not_main_node}
+%% Nodes = [Node] | Node
+%% Node = atom()
+%% Error = {not_cover_compiled,Module}
+flush(Node) when is_atom(Node) ->
+ flush([Node]);
+flush(Nodes) ->
+ call({flush,remove_myself(Nodes,[])}).
+
+%% Used by test_server only. Not documented.
+get_main_node() ->
+ call(get_main_node).
+
%% bump(Module, Function, Arity, Clause, Line)
%% Module = Function = atom()
%% Arity = Clause = Line = integer()
@@ -710,6 +724,11 @@ main_process_loop(State) ->
State1 = State#main_state{nodes=State#main_state.nodes--Nodes},
main_process_loop(State1);
+ {From, {flush,Nodes}} ->
+ remote_collect('_',Nodes,false),
+ reply(From, ok),
+ main_process_loop(State);
+
{From, stop} ->
lists:foreach(
fun(Node) ->
@@ -796,6 +815,10 @@ main_process_loop(State) ->
State1 = State#main_state{nodes=State#main_state.nodes--[node(Pid)]},
main_process_loop(State1);
+ {From, get_main_node} ->
+ reply(From, node()),
+ main_process_loop(State);
+
get_status ->
io:format("~p~n",[State]),
main_process_loop(State)
@@ -852,6 +875,10 @@ remote_process_loop(State) ->
unregister(?SERVER),
remote_reply(State#remote_state.main_node, ok);
+ {From, get_main_node} ->
+ reply(From, State#remote_state.main_node),
+ remote_process_loop(State);
+
get_status ->
io:format("~p~n",[State]),
remote_process_loop(State);