diff options
author | Siri Hansen <[email protected]> | 2012-10-12 15:58:42 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2012-10-30 11:18:40 +0100 |
commit | deaae761fb03ba2a49ac6ed2459acf577698d57d (patch) | |
tree | 2e153e1985079e1edc7e55834807cbc428466093 /lib | |
parent | 8179e41007922c059b8f9441f563edf694b8b315 (diff) | |
download | otp-deaae761fb03ba2a49ac6ed2459acf577698d57d.tar.gz otp-deaae761fb03ba2a49ac6ed2459acf577698d57d.tar.bz2 otp-deaae761fb03ba2a49ac6ed2459acf577698d57d.zip |
[test_server] Don't stop cover after test is finished
This commit removes all calls to cover:stop from test_server. This is
to avoid crash in some processes due to old code.
The correction shall be further refined for general use. There will,
for instance, be an option to turn off cover:stop/0 after completed
test run, so the default behaviour is backwards compatible.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_server/src/test_server.erl | 28 | ||||
-rw-r--r-- | lib/test_server/test/test_server_test_lib.erl | 4 |
2 files changed, 19 insertions, 13 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index bcffe896c4..fc8fe1a9ce 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -377,9 +377,7 @@ module_names(Beams) -> do_cover_compile(Modules) -> do_cover_compile1(lists:usort(Modules)). % remove duplicates -do_cover_compile1([Dont|Rest]) when Dont=:=cover; - Dont=:=test_server; - Dont=:=test_server_ctrl -> +do_cover_compile1([Dont|Rest]) when Dont=:=cover -> do_cover_compile1(Rest); do_cover_compile1([M|Rest]) -> case {code:is_sticky(M),code:is_loaded(M)} of @@ -483,9 +481,13 @@ cover_analyse(Analyse,Modules) -> {M,Err} end end, Modules), - Sticky = unstick_all_sticky(node()), - cover:stop(), - stick_all_sticky(node(),Sticky), + +%%! SIRI: This must be checked further - is it always ok not to stop +%%! cover? Will the node always terminate after this? Probably not - +%%! maybe use an option? +% Sticky = unstick_all_sticky(node()), +% cover:stop(), +% stick_all_sticky(node(),Sticky), R. pmap(Fun,List) -> @@ -503,6 +505,8 @@ pmap(Fun,List) -> end, Pids). unstick_all_sticky(Node) -> + unstick_all_sticky(node(),Node). +unstick_all_sticky(MainCoverNode,Node) -> lists:filter( fun(M) -> case code:is_sticky(M) of @@ -513,7 +517,7 @@ unstick_all_sticky(Node) -> false end end, - cover:modules()). + rpc:call(MainCoverNode,cover,modules,[])). stick_all_sticky(Node,Sticky) -> lists:foreach( @@ -2577,8 +2581,9 @@ start_node(Name, Type, Options) -> net_adm:ping(Node), case Cover of true -> - Sticky = unstick_all_sticky(Node), - cover:start(Node), + MainCoverNode = cover:get_main_node(), + Sticky = unstick_all_sticky(MainCoverNode,Node), + rpc:call(MainCoverNode,cover,start,[Node]), stick_all_sticky(Node,Sticky); _ -> ok @@ -2619,8 +2624,9 @@ stop_node(Slave) -> Nocover = is_shielded(Slave) orelse not same_version(Slave), case is_cover() of true when not Nocover -> - Sticky = unstick_all_sticky(Slave), - cover:stop(Slave), + MainCoverNode = cover:get_main_node(), + Sticky = unstick_all_sticky(MainCoverNode,Slave), + rpc:call(MainCoverNode,cover,flush,[Slave]), stick_all_sticky(Slave,Sticky); _ -> ok diff --git a/lib/test_server/test/test_server_test_lib.erl b/lib/test_server/test/test_server_test_lib.erl index 8a808c5360..0dabc17173 100644 --- a/lib/test_server/test/test_server_test_lib.erl +++ b/lib/test_server/test/test_server_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-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 @@ -83,7 +83,7 @@ start_slave(Config,_Level) -> post_end_per_testcase(_TC, Config, Return, State) -> Node = proplists:get_value(node, Config), - cover:stop(Node), + cover:flush(Node), slave:stop(Node), {Return, State}. |