From 02e6d017104cdbd5cc8c4cf542b727ab621dad96 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 11 Apr 2013 15:53:06 +0200 Subject: [reltool] Remove erlang:port_close/1 for node port Test nodes are started with erlang:open_port/2, using the -detached option to erl. -detached causes the port returned from open_port/2 to be closed automatically. Some test cases failed occasionally with a badarg when attempting to close the port with erlang:port_close/1. To avoid this the call to port_close/1 is now removed. --- lib/reltool/test/reltool_server_SUITE.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index b1e1787f18..752037042d 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -2595,8 +2595,8 @@ start_node(Name, ErlPath, Args0) -> %io:format("open_port({spawn_executable, ~p}, [{args,~p}])~n",[ErlPath,Args]), case open_port({spawn_executable, ErlPath}, [{args,Args}]) of Port when is_port(Port) -> - unlink(Port), - erlang:port_close(Port), + %% no need to close port since node is detached (see + %% mk_node_args) so port will be closed anyway. case ping_node(FullName, 50) of ok -> {ok, FullName}; Other -> exit({failed_to_start_node, FullName, Other}) @@ -2629,7 +2629,7 @@ mk_node_args(Name, Args) -> end, {ok, Pwd} = file:get_cwd(), NameStr = atom_to_list(Name), - ["-detached", "-noinput", + ["-detached", NameSw, NameStr, "-pa", Pa, "-env", "ERL_CRASH_DUMP", Pwd ++ "/erl_crash_dump." ++ NameStr, -- cgit v1.2.3 From 5228664f1fd41fa3c6e894dd0650d79d906f951b Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 15 Apr 2013 14:54:38 +0200 Subject: [common_test] Kill slave nodes after test cases in cover_SUITE The test case cover_SUITE:slave_start_slave often fails on a test host (windows) due to a hanging node from an earlier test run. In the first test, the slave fails to start (boot_timeout?) and is never connected to the test node. The attempt at cleaning up used nodes() to find which slaves to kill - so in the case where the slave was never connected it was never killed. This is no changed so each slave is explicitly killed by name - no matter if it is pingable or not. --- .../test/ct_cover_SUITE_data/cover_SUITE.erl | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl index d967590c72..8142bf14dc 100644 --- a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl +++ b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl @@ -52,11 +52,10 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. end_per_testcase(Case, Config) -> - %% try apply(?MODULE,Case,[cleanup,Config]) - %% catch error:undef -> ok - %% end, + try apply(?MODULE,Case,[cleanup,Config]) + catch error:undef -> ok + end, - kill_slaves(Case,nodes()), Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -67,12 +66,12 @@ break(_Config) -> test_server:break(""), ok. -default(Config) -> +default(_Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), ok. -slave(Config) -> +slave(_Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), N1 = nodename(slave,1), @@ -81,8 +80,10 @@ slave(Config) -> rpc:call(Node,cover_test_mod,foo,[]), {ok,Node} = ct_slave:stop(N1), ok. +slave(cleanup,_Config) -> + kill_slaves([nodename(slave,1)]). -slave_start_slave(Config) -> +slave_start_slave(_Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), N1 = nodename(slave_start_slave,1), @@ -95,8 +96,11 @@ slave_start_slave(Config) -> {ok,Node2} = rpc:call(Node,ct_slave,stop,[N2]), {ok,Node} = ct_slave:stop(N1), ok. +slave_start_slave(cleanup,_Config) -> + kill_slaves([nodename(slave_start_slave,1), + nodename(slave_start_slave,2)]). -cover_node_option(Config) -> +cover_node_option(_Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), Node = fullname(existing_node_1), @@ -104,7 +108,7 @@ cover_node_option(Config) -> rpc:call(Node,cover_test_mod,foo,[]), ok. -ct_cover_add_remove_nodes(Config) -> +ct_cover_add_remove_nodes(_Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), Node = fullname(existing_node_2), @@ -143,16 +147,10 @@ fullname(Name) -> {ok,Host} = inet:gethostname(), list_to_atom(atom_to_list(Name) ++ "@" ++ Host). -kill_slaves(Case, [Node|Nodes]) -> - Prefix = nodeprefix(Case), - case lists:prefix(Prefix,atom_to_list(Node)) of - true -> - rpc:call(Node,erlang,halt,[]); - _ -> - ok - end, - kill_slaves(Case,Nodes); -kill_slaves(_,[]) -> +kill_slaves([Name|Names]) -> + _ = rpc:call(fullname(Name),erlang,halt,[]), + kill_slaves(Names); +kill_slaves([]) -> ok. start_slave(Name) -> -- cgit v1.2.3 From d5b8652679a978afbadce9982442e605a3162790 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 16 Apr 2013 10:09:47 +0200 Subject: [sasl] Remove compiler warning in release_handler_SUITE --- lib/sasl/test/release_handler_SUITE.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 97ba70c9bd..a56924d5ca 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1112,10 +1112,10 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> true = rpc:call(Node,erlang,check_old_code,[m10]), %% Run check_install_release with purge before install this time - {TCheck,{ok, _RelVsn1, []}} = + {_TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), -% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[_TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. @@ -1209,10 +1209,10 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> true = rpc:call(Node,erlang,check_old_code,[m10]), %% Run check_install_release with purge before install this time - {TCheck,{ok, _RelVsn1, []}} = + {_TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), -% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[_TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. -- cgit v1.2.3 From 61ed085d5015e3e2eb387567cd6c5d188a351ff0 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 16 Apr 2013 11:30:40 +0200 Subject: [common_test] Extend timer in cover_SUITE for slow test host --- lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl index 8142bf14dc..83d368c53d 100644 --- a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl +++ b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl @@ -91,7 +91,7 @@ slave_start_slave(_Config) -> {ok,Node} = start_slave(N1), cover_compiled = rpc:call(Node,code,which,[cover_test_mod]), rpc:call(Node,cover_test_mod,foo,[]), - {ok,Node2} = rpc:call(Node,ct_slave,start,[N2]), + {ok,Node2} = start_slave(Node,N2), % start slave N2 from node Node rpc:call(Node2,cover_test_mod,foo,[]), {ok,Node2} = rpc:call(Node,ct_slave,stop,[N2]), {ok,Node} = ct_slave:stop(N1), @@ -154,9 +154,13 @@ kill_slaves([]) -> ok. start_slave(Name) -> + start_slave(node(),Name). + +start_slave(FromNode,Name) -> {ok, HostStr}=inet:gethostname(), Host = list_to_atom(HostStr), - ct_slave:start(Host,Name, - [{boot_timeout,10}, % extending some timers for slow test hosts - {init_timeout,10}, - {startup_timeout,10}]). + rpc:call(FromNode,ct_slave,start, + [Host,Name, + [{boot_timeout,15}, % extending some timers for slow test hosts + {init_timeout,15}, + {startup_timeout,15}]]). -- cgit v1.2.3 From afb553a6d776ff751311b950a96b2708a9ee292b Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 16 Apr 2013 11:37:44 +0200 Subject: [common_test] Adjusted timers in ct_repeat_testrun_SUITE This is to allow slower test hosts. --- lib/common_test/test/ct_repeat_testrun_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/common_test/test/ct_repeat_testrun_SUITE.erl b/lib/common_test/test/ct_repeat_testrun_SUITE.erl index 7ec384c932..35d67a10f2 100644 --- a/lib/common_test/test/ct_repeat_testrun_SUITE.erl +++ b/lib/common_test/test/ct_repeat_testrun_SUITE.erl @@ -51,8 +51,8 @@ %% least 20 seconds (10 sec for each r1_SUITE:tc1) %% -define(t1,30). % time shall expire during second run of r1_SUITE --define(t2,6). % time shall expire during first run of tc1 --define(t3,16). % time shall expire during second run of tc1 +-define(t2,9). % time shall expire during first run of tc1 +-define(t3,19). % time shall expire during second run of tc1 %%-------------------------------------------------------------------- -- cgit v1.2.3