From 4336a65b7e2580866c20fa6646209212dcaeb122 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 9 Jun 2016 13:34:28 +0200 Subject: [sasl test] Give some time and try again if nodes are not synched release_handler_SUITE:upgrade_gg (global group) sometimes fails on slow machines. This commit re-tries five times before giving up. --- lib/sasl/test/release_handler_SUITE.erl | 42 ++++++++++++--------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 8134e02221..559a63fcaf 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1761,8 +1761,6 @@ upgrade_gg(Conf) -> Nodes1 = [Gg1,Gg3,Gg4,Gg5] = start_nodes(Conf,[Gg1Sname,Gg3Sname,Gg4Sname,Gg5Sname],"upgrade_gg"), - %% Give some time to synch nodes, then check global group info. - timer:sleep(1000), [check_gg_info(Node,Nodes1,[],Nodes1--[Node]) || Node <- Nodes1], %% register a process on each of the nodes @@ -2449,37 +2447,27 @@ write_term_file(File,Term) -> ok = file:write_file(File,io_lib:format("~p.~n",[Term])). -%% Check that global group info is correct +%% Check that global group info is correct - try again for a maximum of 5 sec check_gg_info(Node,OtherAlive,OtherDead,Synced) -> + check_gg_info(Node,OtherAlive,OtherDead,Synced,5). + +check_gg_info(Node,OtherAlive,OtherDead,Synced,N) -> GGI = rpc:call(Node, global_group, info, []), GI = rpc:call(Node, global, info,[]), try do_check_gg_info(OtherAlive,OtherDead,Synced,GGI,GI) - catch _:E -> - ?t:format("~ncheck_gg_info failed for ~p: ~p~nwhen GGI was: ~p~n" - "and GI was: ~p~n", - [Node,E,GGI,GI]), - %% An attempt to find out if it is only a timing issue - %% that makes this fail every now and then: - try_again_check(Node,GGI,GI,1), - ?t:fail("check_gg_info failed") - end. - -try_again_check(_Node,_GGI,_GI,6) -> - ok; -try_again_check(Node,GGI,GI,N) -> - timer:sleep(1000), - case {rpc:call(Node,global_group,info,[]), - rpc:call(Node,global,info,[])} of - {GGI,GI} -> - ?t:format("~nAfter one more sek, GGI and GI are still the same"), - try_again_check(Node,GGI,GI,N+1); - {NewGGI,NewGI} -> - ?t:format("~nAfter one more sek:~nNew GGI: ~p~nNew GI: ~p~n", - [NewGGI,NewGI]), - try_again_check(Node,NewGGI,NewGI,N+1) + catch _:E when N==0 -> + ?t:format("~nERROR: check_gg_info failed for ~p:~n~p~n" + "when GGI was: ~p~nand GI was: ~p~n", + [Node,{E,erlang:get_stacktrace()},GGI,GI]), + ?t:fail("check_gg_info failed"); + _:E -> + ?t:format("~nWARNING: check_gg_info failed for ~p:~n~p~n" + "when GGI was: ~p~nand GI was: ~p~n", + [Node,{E,erlang:get_stacktrace()},GGI,GI]), + timer:sleep(1000), + check_gg_info(Node,OtherAlive,OtherDead,Synced,N-1) end. - do_check_gg_info(OtherAlive,OtherDead,Synced,GGI,GI) -> {_,gg1} = lists:keyfind(own_group_name,1,GGI), {_,synced} = lists:keyfind(state,1,GGI), -- cgit v1.2.3 From 7176e321c085cbcdd044f2dfc2b02bbba2c50e7b Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 3 Jun 2016 14:32:54 +0200 Subject: [sasl test] Do GC before measuring and comparing time release_handler_SUITE:otp_9395_*_many_mods sometimes fail on slow machines. This commit adds an explicit GC before each 'install_release' so GC during test is avoided. --- lib/sasl/test/release_handler_SUITE.erl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 559a63fcaf..ad58bb6b7b 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1103,6 +1103,7 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,garbage_collect,[]), rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), @@ -1129,6 +1130,7 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> %% Finally install release after check and purge, and check that %% this install was faster than the first. rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,garbage_collect,[]), rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), @@ -1200,6 +1202,7 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,garbage_collect,[]), rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), @@ -1226,6 +1229,7 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> %% Finally install release after check and purge, and check that %% this install was faster than the first. rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,garbage_collect,[]), rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), -- cgit v1.2.3 From e61d7eb7ed8a1425daf8948ae0ba882cebc4946f Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 17 Jun 2016 09:46:02 +0200 Subject: [ct test] Catch call to ssh:start/0 The ssh application is not installed on all test hosts. Catching the call to ssh:start/0 allows the the netconf tests to be nicely skipped if ssh does not exist. --- lib/common_test/test/ct_netconfc_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common_test/test/ct_netconfc_SUITE.erl b/lib/common_test/test/ct_netconfc_SUITE.erl index 2919f01605..8932f930d1 100644 --- a/lib/common_test/test/ct_netconfc_SUITE.erl +++ b/lib/common_test/test/ct_netconfc_SUITE.erl @@ -55,7 +55,7 @@ check_crypto_and_ssh() -> (catch code:load_file(crypto)), case code:is_loaded(crypto) of {file,_} -> - case ssh:start() of + case catch ssh:start() of Ok when Ok==ok; Ok=={error,{already_started,ssh}} -> ct:log("ssh started",[]), ok; -- cgit v1.2.3