From 9870d22b2401b60221aa42c78bdb7ec4a812e9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 2 Mar 2016 16:10:02 +0100 Subject: Modernize timetraps --- lib/kernel/test/global_group_SUITE.erl | 41 ++++++---------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index e7d321418c..410ade37e6 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -36,7 +36,9 @@ -define(UNTIL(Seq), loop_until_true(fun() -> Seq end)). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [start_gg_proc, no_gg_proc, no_gg_proc_sync, compatible, @@ -79,13 +81,11 @@ end_per_suite(_Config) -> -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). -init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(5)), - [{?TESTCASE, Case}, {watchdog, Dog}|Config]. +init_per_testcase(Case, Config) -> + Config. -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). +end_per_testcase(_Func, _Config) -> + ok. %%----------------------------------------------------------------- %% Test suites for global groups. @@ -97,8 +97,6 @@ end_per_testcase(_Func, Config) -> start_gg_proc(suite) -> []; start_gg_proc(doc) -> ["Check that the global_group processes are started automatically. "]; start_gg_proc(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(120)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd}=file:open(File, [write]), @@ -123,7 +121,6 @@ start_gg_proc(Config) when is_list(Config) -> stop_node(Cp3), ?line ?UNTIL(undefined =:= global:whereis_name(test)), - ?line test_server:timetrap_cancel(Dog), ok. @@ -132,8 +129,6 @@ no_gg_proc(suite) -> []; no_gg_proc(doc) -> ["Start a system without global groups. Nodes are not " "synced at start (sync_nodes_optional is not defined)"]; no_gg_proc(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(200)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -294,7 +289,6 @@ no_gg_proc(Config) when is_list(Config) -> stop_node(Cpz), ?line ?UNTIL(undefined =:= global:whereis_name(test)), - ?line test_server:timetrap_cancel(Dog), ok. @@ -305,8 +299,6 @@ no_gg_proc_sync(doc) -> ["Start a system without global groups, but syncing the nodes by using " "sync_nodes_optional."]; no_gg_proc_sync(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(200)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group_sync.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -469,7 +461,6 @@ no_gg_proc_sync(Config) when is_list(Config) -> stop_node(Cpz), ?line ?UNTIL(undefined =:= global:whereis_name(test)), - ?line test_server:timetrap_cancel(Dog), ok. @@ -479,8 +470,6 @@ compatible(suite) -> []; compatible(doc) -> ["Check that a system without global groups is compatible with the old R4 system."]; compatible(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(200)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group_comp.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -643,7 +632,6 @@ compatible(Config) when is_list(Config) -> stop_node(Cpz), ?line ?UNTIL(undefined =:= global:whereis_name(test)), - ?line test_server:timetrap_cancel(Dog), ok. @@ -652,8 +640,6 @@ compatible(Config) when is_list(Config) -> one_grp(suite) -> []; one_grp(doc) -> ["Test a system with only one global group. "]; one_grp(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(120)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -728,7 +714,6 @@ one_grp(Config) when is_list(Config) -> stop_node(Cp1), stop_node(Cp2), - ?line test_server:timetrap_cancel(Dog), ok. @@ -739,8 +724,6 @@ one_grp_x(suite) -> []; one_grp_x(doc) -> ["Check a system with only one global group. " "Start the nodes with different time intervals. "]; one_grp_x(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(120)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -790,7 +773,6 @@ one_grp_x(Config) when is_list(Config) -> stop_node(Cp2), stop_node(Cp3), - ?line test_server:timetrap_cancel(Dog), ok. @@ -801,8 +783,6 @@ one_grp_x(Config) when is_list(Config) -> two_grp(suite) -> []; two_grp(doc) -> ["Test a two global group system. "]; two_grp(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(200)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -1093,7 +1073,6 @@ two_grp(Config) when is_list(Config) -> stop_node(Cpy), stop_node(Cpz), - ?line test_server:timetrap_cancel(Dog), ok. @@ -1101,8 +1080,6 @@ two_grp(Config) when is_list(Config) -> hidden_groups(suite) -> []; hidden_groups(doc) -> ["Test hidden global groups."]; hidden_groups(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(200)), - ?line Dir = ?config(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -1169,15 +1146,12 @@ hidden_groups(Config) when is_list(Config) -> stop_node(Cpz), stop_node(Cpq), - ?line test_server:timetrap_cancel(Dog), ok. test_exit(suite) -> []; test_exit(doc) -> ["Checks when the search process exits. "]; test_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(120)), - ?line NN = node_name(atom_to_list(node())), ?line Cp1nn = list_to_atom("cp1@" ++ NN), @@ -1201,7 +1175,6 @@ test_exit(Config) when is_list(Config) -> % sleep to let the nodes die test_server:sleep(1000), - ?line test_server:timetrap_cancel(Dog), ok. -- cgit v1.2.3 From 362707ca44fcfb269f9d981dee13233f1aa7cf2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:01:29 +0100 Subject: Eliminate use of ?config() macro ?config is ugly and not recommended. Use proplists:get_value/2 instead. --- lib/kernel/test/global_group_SUITE.erl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 410ade37e6..7d01a446eb 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -79,7 +79,7 @@ end_per_suite(_Config) -> ok. -define(TESTCASE, testcase_name). --define(testcase, ?config(?TESTCASE, Config)). +-define(testcase, proplists:get_value(?TESTCASE, Config)). init_per_testcase(Case, Config) -> Config. @@ -97,7 +97,7 @@ end_per_testcase(_Func, _Config) -> start_gg_proc(suite) -> []; start_gg_proc(doc) -> ["Check that the global_group processes are started automatically. "]; start_gg_proc(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd}=file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), @@ -129,7 +129,7 @@ no_gg_proc(suite) -> []; no_gg_proc(doc) -> ["Start a system without global groups. Nodes are not " "synced at start (sync_nodes_optional is not defined)"]; no_gg_proc(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group.config"), ?line {ok, Fd} = file:open(File, [write]), ?line config_no(Fd), @@ -299,7 +299,7 @@ no_gg_proc_sync(doc) -> ["Start a system without global groups, but syncing the nodes by using " "sync_nodes_optional."]; no_gg_proc_sync(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group_sync.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -470,7 +470,7 @@ compatible(suite) -> []; compatible(doc) -> ["Check that a system without global groups is compatible with the old R4 system."]; compatible(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group_comp.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -640,7 +640,7 @@ compatible(Config) when is_list(Config) -> one_grp(suite) -> []; one_grp(doc) -> ["Test a system with only one global group. "]; one_grp(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), @@ -724,7 +724,7 @@ one_grp_x(suite) -> []; one_grp_x(doc) -> ["Check a system with only one global group. " "Start the nodes with different time intervals. "]; one_grp_x(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), @@ -783,7 +783,7 @@ one_grp_x(Config) when is_list(Config) -> two_grp(suite) -> []; two_grp(doc) -> ["Test a two global group system. "]; two_grp(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -1080,7 +1080,7 @@ two_grp(Config) when is_list(Config) -> hidden_groups(suite) -> []; hidden_groups(doc) -> ["Test hidden global groups."]; hidden_groups(Config) when is_list(Config) -> - ?line Dir = ?config(priv_dir, Config), + Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), ?line {ok, Fd} = file:open(File, [write]), @@ -1180,25 +1180,25 @@ test_exit(Config) when is_list(Config) -> start_node(Name, Config) -> Pa=filename:dirname(code:which(?MODULE)), - Dir=?config(priv_dir, Config), + Dir=proplists:get_value(priv_dir, Config), ConfFile = " -config " ++ filename:join(Dir, "global_group"), test_server:start_node(Name, slave, [{args, "-pa " ++ Pa ++ ConfFile}]). start_node_no(Name, Config) -> Pa=filename:dirname(code:which(?MODULE)), - Dir=?config(priv_dir, Config), + Dir=proplists:get_value(priv_dir, Config), ConfFile = " -config " ++ filename:join(Dir, "no_global_group"), test_server:start_node(Name, slave, [{args, "-pa " ++ Pa ++ ConfFile}]). start_node_no2(Name, Config) -> Pa=filename:dirname(code:which(?MODULE)), - Dir=?config(priv_dir, Config), + Dir=proplists:get_value(priv_dir, Config), ConfFile = " -config " ++ filename:join(Dir, "no_global_group_sync"), test_server:start_node(Name, slave, [{args, "-pa " ++ Pa ++ ConfFile}]). start_node_comp(Name, Config) -> Pa=filename:dirname(code:which(?MODULE)), - Dir=?config(priv_dir, Config), + Dir=proplists:get_value(priv_dir, Config), ConfFile = " -config " ++ filename:join(Dir, "global_group_comp"), test_server:start_node(Name, slave, [{args, "-pa " ++ Pa ++ ConfFile}]). -- cgit v1.2.3 From ca290148fbde80f1cda249c1c15562c5bc9aedaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:28:25 +0100 Subject: Eliminate use of test_server:fail/0,1 --- lib/kernel/test/global_group_SUITE.erl | 54 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 7d01a446eb..87a4aa63f8 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -203,19 +203,19 @@ no_gg_proc(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -375,19 +375,19 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -546,19 +546,19 @@ compatible(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -684,14 +684,14 @@ one_grp(Config) when is_list(Config) -> receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout1) + 2000 -> ct:fail(timeout1) end, rpc:call(Cp3, global, send, [test, {ping, self()}]), receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line rpc:call(Cp3, global, unregister_name, [test]), @@ -902,38 +902,38 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp3, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpx, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpz, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpx, global_group, send, [{node, Cp1nn}, test2, @@ -941,21 +941,21 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpy, global_group, send, [{node, Cp2nn}, test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [{node, Cp3nn}, test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpznn}, test, @@ -963,21 +963,21 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [{node, Cpxnn}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpz, global_group, send, [{node, Cpynn}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpx, global_group, send, [{group, nc1}, test2, @@ -985,14 +985,14 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [{group, nc2}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, %%------------------------------------ @@ -1410,9 +1410,9 @@ assert_loop(Cp, CpName, Name, NamePid, Loop) -> Loop -> ok; Other1 -> - test_server:fail(Other1) + ct:fail(Other1) after 5000 -> - test_server:fail(timeout) + ct:fail(timeout) end. loop_until_true(Fun) -> -- cgit v1.2.3 From 2d17815c831829af13899c23b320b884e790cf9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 3 Mar 2016 15:14:01 +0100 Subject: Eliminate use of test_server:sleep/1 --- lib/kernel/test/global_group_SUITE.erl | 56 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 87a4aa63f8..bfdcb87dc5 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -235,9 +235,9 @@ no_gg_proc(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cp1), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -247,9 +247,9 @@ no_gg_proc(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cpz), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -407,9 +407,9 @@ no_gg_proc_sync(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cp1), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -419,9 +419,9 @@ no_gg_proc_sync(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cpz), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -578,9 +578,9 @@ compatible(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cp1), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -590,9 +590,9 @@ compatible(Config) when is_list(Config) -> rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cpz), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -651,7 +651,7 @@ one_grp(Config) when is_list(Config) -> ?line {ok, Cp3} = start_node(Ncp3, Config), % sleep a while to make the global_group to sync... - test_server:sleep(1000), + ct:sleep(1000), % start a proc and register it ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), @@ -732,14 +732,14 @@ one_grp_x(Config) when is_list(Config) -> ?line {ok, Cp1} = start_node(Ncp1, Config), % sleep a while to make the global_group to sync... - test_server:sleep(1000), + ct:sleep(1000), % start a proc and register it ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), ?line {ok, Cp2} = start_node(Ncp2, Config), % sleep a while to make the global_group to sync... - test_server:sleep(1000), + ct:sleep(1000), % test that it is registered at all nodes ?line Pid = rpc:call(Cp1, global, whereis_name, [test]), @@ -747,7 +747,7 @@ one_grp_x(Config) when is_list(Config) -> ?line {ok, Cp3} = start_node(Ncp3, Config), % sleep a while to make the global_group to sync... - test_server:sleep(1000), + ct:sleep(1000), ?line Pid = rpc:call(Cp3, global, whereis_name, [test]), @@ -809,7 +809,7 @@ two_grp(Config) when is_list(Config) -> %% [{nc1, [cp1,cp2,cp3]}, {nc2, [cpx,cpy,cpz]}, {nc3, [cpq]}] % sleep a while to make the global_groups to sync... - test_server:sleep(1000), + ct:sleep(1000), % check the global group names ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), @@ -1009,9 +1009,9 @@ two_grp(Config) when is_list(Config) -> {wait_nodedown, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cp1), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodedown), @@ -1023,9 +1023,9 @@ two_grp(Config) when is_list(Config) -> {wait_nodedown, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line stop_node(Cpz), - ?line test_server:sleep(1000), + ct:sleep(1000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodedown), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -1038,9 +1038,9 @@ two_grp(Config) when is_list(Config) -> {wait_nodeup, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cp1}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line test_server:sleep(5000), + ct:sleep(5000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodeup), @@ -1053,9 +1053,9 @@ two_grp(Config) when is_list(Config) -> {wait_nodeup, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cpz}]), - ?line test_server:sleep(100), + ct:sleep(100), ?line {ok, Cpz} = start_node(Ncpz, Config), - ?line test_server:sleep(5000), + ct:sleep(5000), ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodeup), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), @@ -1097,7 +1097,7 @@ hidden_groups(Config) when is_list(Config) -> ?line {ok, Cpq} = start_node(Ncpq, Config), % sleep a while to make the global_groups to sync... - test_server:sleep(1000), + ct:sleep(1000), % check the global group names ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), @@ -1159,7 +1159,7 @@ test_exit(Config) when is_list(Config) -> ?line {ok, Cp2} = start_node(cp2, Config), ?line {ok, Cp3} = start_node(cp3, Config), - test_server:sleep(1000), + ct:sleep(1000), ?line {error, illegal_function_call} = rpc:call(Cp1, global_group, registered_names_test, [{node, Cp1nn}]), @@ -1173,7 +1173,7 @@ test_exit(Config) when is_list(Config) -> stop_node(Cp3), % sleep to let the nodes die - test_server:sleep(1000), + ct:sleep(1000), ok. -- cgit v1.2.3 From 59438cf3176f6c2d835f5aba29179f6e7ff1b0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:51:39 +0100 Subject: Eliminate use of doc and suite clauses Those clause are obsolete and never used by common_test. --- lib/kernel/test/global_group_SUITE.erl | 35 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index bfdcb87dc5..2fad1eafdd 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -94,8 +94,7 @@ end_per_testcase(_Func, _Config) -> %%----------------------------------------------------------------- -start_gg_proc(suite) -> []; -start_gg_proc(doc) -> ["Check that the global_group processes are started automatically. "]; +%% Check that the global_group processes are started automatically. . start_gg_proc(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), @@ -125,9 +124,8 @@ start_gg_proc(Config) when is_list(Config) -> -no_gg_proc(suite) -> []; -no_gg_proc(doc) -> ["Start a system without global groups. Nodes are not " - "synced at start (sync_nodes_optional is not defined)"]; +%% Start a system without global groups. Nodes are not +%% synced at start (sync_nodes_optional is not defined). no_gg_proc(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group.config"), @@ -294,10 +292,8 @@ no_gg_proc(Config) when is_list(Config) -> -no_gg_proc_sync(suite) -> []; -no_gg_proc_sync(doc) -> - ["Start a system without global groups, but syncing the nodes by using " - "sync_nodes_optional."]; +%% Start a system without global groups, but syncing the nodes by using +%% sync_nodes_optional. no_gg_proc_sync(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "no_global_group_sync.config"), @@ -466,9 +462,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> -compatible(suite) -> []; -compatible(doc) -> - ["Check that a system without global groups is compatible with the old R4 system."]; +%% Check that a system without global groups is compatible with the old R4 system. compatible(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group_comp.config"), @@ -637,8 +631,7 @@ compatible(Config) when is_list(Config) -> -one_grp(suite) -> []; -one_grp(doc) -> ["Test a system with only one global group. "]; +%% Test a system with only one global group. . one_grp(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), @@ -720,9 +713,8 @@ one_grp(Config) when is_list(Config) -> -one_grp_x(suite) -> []; -one_grp_x(doc) -> ["Check a system with only one global group. " - "Start the nodes with different time intervals. "]; +%% Check a system with only one global group. +%% Start the nodes with different time intervals. one_grp_x(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), @@ -780,8 +772,7 @@ one_grp_x(Config) when is_list(Config) -> -two_grp(suite) -> []; -two_grp(doc) -> ["Test a two global group system. "]; +%% Test a two global group system. . two_grp(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), @@ -1077,8 +1068,7 @@ two_grp(Config) when is_list(Config) -> -hidden_groups(suite) -> []; -hidden_groups(doc) -> ["Test hidden global groups."]; +%% Test hidden global groups. hidden_groups(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), ?line File = filename:join(Dir, "global_group.config"), @@ -1149,8 +1139,7 @@ hidden_groups(Config) when is_list(Config) -> ok. -test_exit(suite) -> []; -test_exit(doc) -> ["Checks when the search process exits. "]; +%% Checks when the search process exits. . test_exit(Config) when is_list(Config) -> ?line NN = node_name(atom_to_list(node())), ?line Cp1nn = list_to_atom("cp1@" ++ NN), -- cgit v1.2.3 From 73a611a3e4f8ca4ec62694d3fb70d30ee8558f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 7 Mar 2016 09:14:45 +0100 Subject: Eliminate use of the ?t macro --- lib/kernel/test/global_group_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 2fad1eafdd..7feabb570f 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -1204,7 +1204,7 @@ node_name(Name, Config) -> lists:concat([Name,U,?testcase,U,Pid,U,U,L]). stop_node(Node) -> - ?t:stop_node(Node). + test_server:stop_node(Node). wait_for_ready_net() -> -- cgit v1.2.3 From 3dfdf35c65b8985a3abe21ef83f27cc8e82ba11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 9 Mar 2016 06:34:35 +0100 Subject: Fix comments Remove out-commented code. Make sure that comments that are not at the end of a line starts with two '%' characters and not just one. That will become important later when we'll remove all ?line macros and ask Emacs to re-indent the files. --- lib/kernel/test/global_group_SUITE.erl | 120 ++++++++++++++++----------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 7feabb570f..590b90c6c0 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -28,7 +28,7 @@ -export([init_per_testcase/2, end_per_testcase/2]). -%-compile(export_all). +%%-compile(export_all). -include_lib("common_test/include/ct.hrl"). @@ -114,7 +114,7 @@ start_gg_proc(Config) when is_list(Config) -> ?line [] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), ?line [] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), @@ -164,7 +164,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), - % start a proc and register it + %% start a proc and register it ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), ?line RegNames = lists:sort([test2,test_server]), @@ -217,7 +217,7 @@ no_gg_proc(Config) when is_list(Config) -> end, - % start a proc and register it + %% start a proc and register it ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), @@ -228,7 +228,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), - % Kill node Cp1 + %% Kill node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = @@ -240,7 +240,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Kill node Cpz + %% Kill node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = @@ -252,7 +252,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cp1 + %% Restart node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), ?line PidX = @@ -265,7 +265,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cpz + %% Restart node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), ?line PidX = @@ -278,7 +278,7 @@ no_gg_proc(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), @@ -334,7 +334,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), - % start a proc and register it + %% start a proc and register it ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), ?line RegNames = lists:sort([test2,test_server]), @@ -387,7 +387,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> end, - % start a proc and register it + %% start a proc and register it ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), @@ -398,7 +398,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), - % Kill node Cp1 + %% Kill node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = @@ -410,7 +410,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Kill node Cpz + %% Kill node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = @@ -422,7 +422,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cp1 + %% Restart node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), ?line PidX = @@ -435,7 +435,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cpz + %% Restart node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), ?line PidX = @@ -448,7 +448,7 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), @@ -503,7 +503,7 @@ compatible(Config) when is_list(Config) -> ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), - % start a proc and register it + %% start a proc and register it ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), ?line RegNames = lists:sort([test2,test_server]), @@ -556,7 +556,7 @@ compatible(Config) when is_list(Config) -> end, - % start a proc and register it + %% start a proc and register it ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), @@ -567,7 +567,7 @@ compatible(Config) when is_list(Config) -> ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), - % Kill node Cp1 + %% Kill node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = @@ -579,7 +579,7 @@ compatible(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Kill node Cpz + %% Kill node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = @@ -591,7 +591,7 @@ compatible(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cp1 + %% Restart node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), ?line PidX = @@ -604,7 +604,7 @@ compatible(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % Restart node Cpz + %% Restart node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), ?line PidX = @@ -617,7 +617,7 @@ compatible(Config) when is_list(Config) -> ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), @@ -643,21 +643,21 @@ one_grp(Config) when is_list(Config) -> ?line {ok, Cp2} = start_node(Ncp2, Config), ?line {ok, Cp3} = start_node(Ncp3, Config), - % sleep a while to make the global_group to sync... + %% sleep a while to make the global_group to sync... ct:sleep(1000), - % start a proc and register it + %% start a proc and register it ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), - % test that it is registered at all nodes + %% test that it is registered at all nodes ?line Pid = rpc:call(Cp1, global, whereis_name, [test]), ?line Pid = rpc:call(Cp2, global, whereis_name, [test]), ?line Pid = rpc:call(Cp3, global, whereis_name, [test]), - % try to register the same name + %% try to register the same name ?line no = rpc:call(Cp1, global, register_name, [test, self()]), - % let process exit, check that it is unregistered automatically + %% let process exit, check that it is unregistered automatically Pid ! die, ?line ?UNTIL(begin @@ -666,13 +666,13 @@ one_grp(Config) when is_list(Config) -> (undefined =:= rpc:call(Cp3, global, whereis_name, [test])) end), - % test re_register + %% test re_register ?line {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test]), Pid3 = rpc:call(Cp3, ?MODULE, start_proc_rereg, [test]), ?line Pid3 = rpc:call(Cp3, global, whereis_name, [test]), - % test sending + %% test sending rpc:call(Cp1, global, send, [test, {ping, self()}]), receive {pong, Cp3} -> ok @@ -695,10 +695,10 @@ one_grp(Config) when is_list(Config) -> Pid3 ! die, ?line ?UNTIL(undefined =:= rpc:call(Cp3, global, whereis_name, [test])), - % register a proc + %% register a proc ?line {_, yes} = rpc:call(Cp3, ?MODULE, start_proc, [test]), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp3), ?line ?UNTIL(undefined =:= rpc:call(Cp1, global, whereis_name, [test])), @@ -723,30 +723,30 @@ one_grp_x(Config) when is_list(Config) -> ?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), ?line {ok, Cp1} = start_node(Ncp1, Config), - % sleep a while to make the global_group to sync... + %% sleep a while to make the global_group to sync... ct:sleep(1000), - % start a proc and register it + %% start a proc and register it ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), ?line {ok, Cp2} = start_node(Ncp2, Config), - % sleep a while to make the global_group to sync... + %% sleep a while to make the global_group to sync... ct:sleep(1000), - % test that it is registered at all nodes + %% test that it is registered at all nodes ?line Pid = rpc:call(Cp1, global, whereis_name, [test]), ?line Pid = rpc:call(Cp2, global, whereis_name, [test]), ?line {ok, Cp3} = start_node(Ncp3, Config), - % sleep a while to make the global_group to sync... + %% sleep a while to make the global_group to sync... ct:sleep(1000), ?line Pid = rpc:call(Cp3, global, whereis_name, [test]), - % try to register the same name + %% try to register the same name ?line no = rpc:call(Cp1, global, register_name, [test, self()]), - % let process exit, check that it is unregistered automatically + %% let process exit, check that it is unregistered automatically Pid ! die, ?line ?UNTIL(begin @@ -755,7 +755,7 @@ one_grp_x(Config) when is_list(Config) -> (undefined =:= rpc:call(Cp3, global, whereis_name, [test])) end), - % test re_register + %% test re_register ?line {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test]), @@ -799,10 +799,10 @@ two_grp(Config) when is_list(Config) -> %% The groups (cpq not started): %% [{nc1, [cp1,cp2,cp3]}, {nc2, [cpx,cpy,cpz]}, {nc3, [cpq]}] - % sleep a while to make the global_groups to sync... + %% sleep a while to make the global_groups to sync... ct:sleep(1000), - % check the global group names + %% check the global group names ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), ?line {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), ?line {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), @@ -810,7 +810,7 @@ two_grp(Config) when is_list(Config) -> ?line {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), ?line {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), - % check the global group nodes + %% check the global group nodes ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp1, global_group, own_nodes, []), ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp3, global_group, own_nodes, []), @@ -819,7 +819,7 @@ two_grp(Config) when is_list(Config) -> ?line [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpz, global_group, own_nodes, []), - % start a proc and register it + %% start a proc and register it ?line {Pid1, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), ?line Pid1 = rpc:call(Cp1, global_group, send, [test, {io, from_cp1}]), @@ -841,7 +841,7 @@ two_grp(Config) when is_list(Config) -> - % test that it is registered at all nodes + %% test that it is registered at all nodes ?line Pid1 = rpc:call(Cp1, global, whereis_name, [test]), ?line Pid1 = rpc:call(Cp2, global, whereis_name, [test]), ?line Pid1 = rpc:call(Cp3, global, whereis_name, [test]), @@ -849,10 +849,10 @@ two_grp(Config) when is_list(Config) -> ?line undefined = rpc:call(Cpy, global, whereis_name, [test]), ?line undefined = rpc:call(Cpz, global, whereis_name, [test]), - % start a proc and register it + %% start a proc and register it ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), - % test that it is registered at all nodes + %% test that it is registered at all nodes ?line Pid1 = rpc:call(Cp1, global, whereis_name, [test]), ?line Pid1 = rpc:call(Cp2, global, whereis_name, [test]), ?line Pid1 = rpc:call(Cp3, global, whereis_name, [test]), @@ -870,10 +870,10 @@ two_grp(Config) when is_list(Config) -> undefined =:= Pid end), - % start a proc and register it + %% start a proc and register it ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), - % test that it is registered at all nodes + %% test that it is registered at all nodes ?line Pid2 = rpc:call(Cp1, global, whereis_name, [test2]), ?line Pid2 = rpc:call(Cp2, global, whereis_name, [test2]), ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test2]), @@ -995,7 +995,7 @@ two_grp(Config) when is_list(Config) -> rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), - % Kill node Cp1 + %% Kill node Cp1 ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, @@ -1009,7 +1009,7 @@ two_grp(Config) when is_list(Config) -> ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, to_loop]), - % Kill node Cpz + %% Kill node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, @@ -1023,7 +1023,7 @@ two_grp(Config) when is_list(Config) -> ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, to_loop]), - % Restart node Cp1 + %% Restart node Cp1 ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), @@ -1039,7 +1039,7 @@ two_grp(Config) when is_list(Config) -> rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, to_loop]), - % Restart node Cpz + %% Restart node Cpz ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, @@ -1086,10 +1086,10 @@ hidden_groups(Config) when is_list(Config) -> ?line {ok, Cpz} = start_node(Ncpz, Config), ?line {ok, Cpq} = start_node(Ncpq, Config), - % sleep a while to make the global_groups to sync... + %% sleep a while to make the global_groups to sync... ct:sleep(1000), - % check the global group names + %% check the global group names ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), ?line {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), ?line {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), @@ -1097,7 +1097,7 @@ hidden_groups(Config) when is_list(Config) -> ?line {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), ?line {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), - % check the global group nodes + %% check the global group nodes ?line [Cp1, Cp2, Cp3] = rpc:call(Cp1, global_group, own_nodes, []), ?line [Cp1, Cp2, Cp3] = rpc:call(Cp2, global_group, own_nodes, []), ?line [Cp1, Cp2, Cp3] = rpc:call(Cp3, global_group, own_nodes, []), @@ -1106,7 +1106,7 @@ hidden_groups(Config) when is_list(Config) -> ?line [Cpx, Cpy, Cpz] = rpc:call(Cpz, global_group, own_nodes, []), ?line [Cpq] = rpc:call(Cpq, global_group, own_nodes, []), - % Make some inter group connections + %% Make some inter group connections ?line pong = rpc:call(Cp1, net_adm, ping, [Cpx]), ?line pong = rpc:call(Cpy, net_adm, ping, [Cp2]), ?line pong = rpc:call(Cp3, net_adm, ping, [Cpx]), @@ -1114,7 +1114,7 @@ hidden_groups(Config) when is_list(Config) -> ?line pong = rpc:call(Cpq, net_adm, ping, [Cp1]), ?line pong = rpc:call(Cpz, net_adm, ping, [Cpq]), - % Check that no inter group connections are visible + %% Check that no inter group connections are visible NC1Nodes = lists:sort([Cp1, Cp2, Cp3]), NC2Nodes = lists:sort([Cpx, Cpy, Cpz]), ?line NC1Nodes = lists:sort([Cp1|rpc:call(Cp1, erlang, nodes, [])]), @@ -1156,12 +1156,12 @@ test_exit(Config) when is_list(Config) -> rpc:call(Cp1, global_group, send, [king, "The message"]), ?line undefined = rpc:call(Cp1, global_group, whereis_name, [king]), - % stop the nodes, and make sure names are released. + %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), - % sleep to let the nodes die + %% sleep to let the nodes die ct:sleep(1000), ok. -- cgit v1.2.3 From 0ba20cd6d43e277593b59463d2c2959bb6db0957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 2 Mar 2016 06:50:54 +0100 Subject: Remove ?line macros While we are it, also re-ident the files. --- lib/kernel/test/global_group_SUITE.erl | 1101 ++++++++++++++++---------------- 1 file changed, 549 insertions(+), 552 deletions(-) (limited to 'lib/kernel/test/global_group_SUITE.erl') diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 590b90c6c0..8b9e1c5ae8 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -48,10 +48,10 @@ groups() -> []. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. + Config. init_per_suite(Config) -> @@ -97,186 +97,186 @@ end_per_testcase(_Func, _Config) -> %% Check that the global_group processes are started automatically. . start_gg_proc(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group.config"), - ?line {ok, Fd}=file:open(File, [write]), + File = filename:join(Dir, "global_group.config"), + {ok, Fd}=file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), - ?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), + config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), - ?line Cp1nn = node_at(Ncp1), - ?line Cp2nn = node_at(Ncp2), - ?line Cp3nn = node_at(Ncp3), + Cp1nn = node_at(Ncp1), + Cp2nn = node_at(Ncp2), + Cp3nn = node_at(Ncp3), - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), - ?line {ok, Cp3} = start_node(Ncp3, Config), + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp3} = start_node(Ncp3, Config), - ?line [] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), - ?line [] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), - ?line [] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), + [] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), + [] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), + [] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), %% stop the nodes, and make sure names are released. stop_node(Cp1), stop_node(Cp2), stop_node(Cp3), - ?line ?UNTIL(undefined =:= global:whereis_name(test)), + ?UNTIL(undefined =:= global:whereis_name(test)), ok. - + %% Start a system without global groups. Nodes are not %% synced at start (sync_nodes_optional is not defined). no_gg_proc(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "no_global_group.config"), - ?line {ok, Fd} = file:open(File, [write]), - ?line config_no(Fd), - - ?line NN = node_name(atom_to_list(node())), - ?line Cp1nn = list_to_atom("cp1@" ++ NN), - ?line Cp2nn = list_to_atom("cp2@" ++ NN), - ?line Cp3nn = list_to_atom("cp3@" ++ NN), - ?line Cpxnn = list_to_atom("cpx@" ++ NN), - ?line Cpynn = list_to_atom("cpy@" ++ NN), - ?line Cpznn = list_to_atom("cpz@" ++ NN), - - ?line {ok, Cp1} = start_node_no(cp1, Config), - ?line {ok, Cp2} = start_node_no(cp2, Config), - ?line {ok, Cp3} = start_node_no(cp3, Config), - ?line {ok, Cpx} = start_node_no(cpx, Config), - ?line {ok, Cpy} = start_node_no(cpy, Config), - ?line {ok, Cpz} = start_node_no(cpz, Config), + File = filename:join(Dir, "no_global_group.config"), + {ok, Fd} = file:open(File, [write]), + config_no(Fd), + + NN = node_name(atom_to_list(node())), + Cp1nn = list_to_atom("cp1@" ++ NN), + Cp2nn = list_to_atom("cp2@" ++ NN), + Cp3nn = list_to_atom("cp3@" ++ NN), + Cpxnn = list_to_atom("cpx@" ++ NN), + Cpynn = list_to_atom("cpy@" ++ NN), + Cpznn = list_to_atom("cpz@" ++ NN), + + {ok, Cp1} = start_node_no(cp1, Config), + {ok, Cp2} = start_node_no(cp2, Config), + {ok, Cp3} = start_node_no(cp3, Config), + {ok, Cpx} = start_node_no(cpx, Config), + {ok, Cpy} = start_node_no(cpy, Config), + {ok, Cpz} = start_node_no(cpz, Config), %% let the nodes know of each other - ?line pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), - ?line pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), - ?line pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), + pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), + pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), + pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), + pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), %% start a proc and register it - ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), + {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), - ?line RegNames = lists:sort([test2,test_server]), + RegNames = lists:sort([test2,test_server]), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}])), - ?line undefined = rpc:call(Cp3, global_group, global_groups, []), + undefined = rpc:call(Cp3, global_group, global_groups, []), - ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, - Cpxnn, Cpynn, Cpznn], - ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line [] = (Own_nodes -- Own_nodes_should), - ?line [] = (Own_nodes_should -- Own_nodes), - - ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout2) - end, - ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout3) - end, - ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout4) - end, + Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, + Cpxnn, Cpynn, Cpznn], + Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), + [] = (Own_nodes -- Own_nodes_should), + [] = (Own_nodes_should -- Own_nodes), + + Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout2) + end, + Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout3) + end, + Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout4) + end, %% start a proc and register it - ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), + {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), %%------------------------------------ %% Test monitor nodes %%------------------------------------ - ?line Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), + Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), %% Kill node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), ct:sleep(100), - ?line stop_node(Cp1), + stop_node(Cp1), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Kill node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), ct:sleep(100), - ?line stop_node(Cpz), + stop_node(Cpz), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cp1}]), - ?line {ok, Cp1} = start_node_no(cp1, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cp1} = start_node_no(cp1, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), + pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cpz}]), - ?line {ok, Cpz} = start_node_no(cpz, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cpz} = start_node_no(cpz, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% stop the nodes, and make sure names are released. stop_node(Cp1), @@ -286,9 +286,9 @@ no_gg_proc(Config) when is_list(Config) -> stop_node(Cpy), stop_node(Cpz), - ?line ?UNTIL(undefined =:= global:whereis_name(test)), + ?UNTIL(undefined =:= global:whereis_name(test)), ok. - + @@ -296,157 +296,157 @@ no_gg_proc(Config) when is_list(Config) -> %% sync_nodes_optional. no_gg_proc_sync(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "no_global_group_sync.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "no_global_group_sync.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz] = node_names([cp1,cp2,cp3,cpx,cpy,cpz], Config), - ?line config_sync(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz), - - ?line Cp1nn = node_at(Ncp1), - ?line Cp2nn = node_at(Ncp2), - ?line Cp3nn = node_at(Ncp3), - ?line Cpxnn = node_at(Ncpx), - ?line Cpynn = node_at(Ncpy), - ?line Cpznn = node_at(Ncpz), - - ?line {ok, Cp1} = start_node_no2(Ncp1, Config), - ?line {ok, Cp2} = start_node_no2(Ncp2, Config), - ?line {ok, Cp3} = start_node_no2(Ncp3, Config), - ?line {ok, Cpx} = start_node_no2(Ncpx, Config), - ?line {ok, Cpy} = start_node_no2(Ncpy, Config), - ?line {ok, Cpz} = start_node_no2(Ncpz, Config), + config_sync(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz), + + Cp1nn = node_at(Ncp1), + Cp2nn = node_at(Ncp2), + Cp3nn = node_at(Ncp3), + Cpxnn = node_at(Ncpx), + Cpynn = node_at(Ncpy), + Cpznn = node_at(Ncpz), + + {ok, Cp1} = start_node_no2(Ncp1, Config), + {ok, Cp2} = start_node_no2(Ncp2, Config), + {ok, Cp3} = start_node_no2(Ncp3, Config), + {ok, Cpx} = start_node_no2(Ncpx, Config), + {ok, Cpy} = start_node_no2(Ncpy, Config), + {ok, Cpz} = start_node_no2(Ncpz, Config), %% let the nodes know of each other - ?line pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), - ?line pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), - ?line pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), + pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), + pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), + pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), + pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), %% start a proc and register it - ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), + {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), - ?line RegNames = lists:sort([test2,test_server]), + RegNames = lists:sort([test2,test_server]), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}])), - ?line undefined = rpc:call(Cp3, global_group, global_groups, []), + undefined = rpc:call(Cp3, global_group, global_groups, []), - ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, - Cpxnn, Cpynn, Cpznn], - ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line [] = (Own_nodes -- Own_nodes_should), - ?line [] = (Own_nodes_should -- Own_nodes), - - ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout2) - end, - ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout3) - end, - ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout4) - end, + Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, + Cpxnn, Cpynn, Cpznn], + Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), + [] = (Own_nodes -- Own_nodes_should), + [] = (Own_nodes_should -- Own_nodes), + + Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout2) + end, + Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout3) + end, + Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout4) + end, %% start a proc and register it - ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), + {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), %%------------------------------------ %% Test monitor nodes %%------------------------------------ - ?line Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), + Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), %% Kill node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), ct:sleep(100), - ?line stop_node(Cp1), + stop_node(Cp1), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Kill node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), ct:sleep(100), - ?line stop_node(Cpz), + stop_node(Cpz), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cp1}]), - ?line {ok, Cp1} = start_node_no2(Ncp1, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cp1} = start_node_no2(Ncp1, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), + pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cpz}]), - ?line {ok, Cpz} = start_node_no2(Ncpz, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cpz} = start_node_no2(Ncpz, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% stop the nodes, and make sure names are released. stop_node(Cp1), @@ -456,166 +456,166 @@ no_gg_proc_sync(Config) when is_list(Config) -> stop_node(Cpy), stop_node(Cpz), - ?line ?UNTIL(undefined =:= global:whereis_name(test)), + ?UNTIL(undefined =:= global:whereis_name(test)), ok. - + %% Check that a system without global groups is compatible with the old R4 system. compatible(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group_comp.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "global_group_comp.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz] = node_names([cp1,cp2,cp3,cpx,cpy,cpz], Config), - ?line config_comp(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz), - - ?line Cp1nn = node_at(Ncp1), - ?line Cp2nn = node_at(Ncp2), - ?line Cp3nn = node_at(Ncp3), - ?line Cpxnn = node_at(Ncpx), - ?line Cpynn = node_at(Ncpy), - ?line Cpznn = node_at(Ncpz), - - ?line {ok, Cp1} = start_node_comp(Ncp1, Config), - ?line {ok, Cp2} = start_node_comp(Ncp2, Config), - ?line {ok, Cp3} = start_node_comp(Ncp3, Config), - ?line {ok, Cpx} = start_node_comp(Ncpx, Config), - ?line {ok, Cpy} = start_node_comp(Ncpy, Config), - ?line {ok, Cpz} = start_node_comp(Ncpz, Config), + config_comp(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz), + + Cp1nn = node_at(Ncp1), + Cp2nn = node_at(Ncp2), + Cp3nn = node_at(Ncp3), + Cpxnn = node_at(Ncpx), + Cpynn = node_at(Ncpy), + Cpznn = node_at(Ncpz), + + {ok, Cp1} = start_node_comp(Ncp1, Config), + {ok, Cp2} = start_node_comp(Ncp2, Config), + {ok, Cp3} = start_node_comp(Ncp3, Config), + {ok, Cpx} = start_node_comp(Ncpx, Config), + {ok, Cpy} = start_node_comp(Ncpy, Config), + {ok, Cpz} = start_node_comp(Ncpz, Config), %% let the nodes know of each other - ?line pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), - ?line pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), - ?line pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), + pong = rpc:call(Cp1, net_adm, ping, [Cp2nn]), + pong = rpc:call(Cp2, net_adm, ping, [Cp3nn]), + pong = rpc:call(Cp3, net_adm, ping, [Cpxnn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpynn]), + pong = rpc:call(Cpy, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), - ?line [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), - ?line [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), - ?line [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}]), + [test_server] = rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}]), + [test_server] = rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}]), + [test_server] = rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}]), %% start a proc and register it - ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), + {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), - ?line RegNames = lists:sort([test2,test_server]), + RegNames = lists:sort([test2,test_server]), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cp1nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cp2nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cp3nn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp1, global_group, registered_names, [{node, Cpxnn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp2, global_group, registered_names, [{node, Cpynn}])), - ?line RegNames = + RegNames = lists:sort( rpc:call(Cp3, global_group, registered_names, [{node, Cpznn}])), - ?line undefined = rpc:call(Cp3, global_group, global_groups, []), + undefined = rpc:call(Cp3, global_group, global_groups, []), - ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, - Cpxnn, Cpynn, Cpznn], - ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line [] = (Own_nodes -- Own_nodes_should), - ?line [] = (Own_nodes_should -- Own_nodes), - - ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout2) - end, - ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout3) - end, - ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), - ?line receive - {pong, Cp2} -> ok - after - 2000 -> ct:fail(timeout4) - end, + Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, + Cpxnn, Cpynn, Cpznn], + Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), + [] = (Own_nodes -- Own_nodes_should), + [] = (Own_nodes_should -- Own_nodes), + + Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout2) + end, + Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout3) + end, + Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), + receive + {pong, Cp2} -> ok + after + 2000 -> ct:fail(timeout4) + end, %% start a proc and register it - ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), + {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), %%------------------------------------ %% Test monitor nodes %%------------------------------------ - ?line Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), + Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), %% Kill node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cp1}]), ct:sleep(100), - ?line stop_node(Cp1), + stop_node(Cp1), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Kill node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodedown, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodedown, Cpz}]), ct:sleep(100), - ?line stop_node(Cpz), + stop_node(Cpz), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cp1 - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cp1}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cp1}]), - ?line {ok, Cp1} = start_node_comp(Ncp1, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cp1} = start_node_comp(Ncp1, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cp1nn]), + pong = rpc:call(Cpx, net_adm, ping, [Cp1nn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% Restart node Cpz - ?line Pid2 = + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, {wait_nodeup, Cpz}]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, {wait_nodeup, Cpz}]), - ?line {ok, Cpz} = start_node_comp(Ncpz, Config), - ?line pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), - ?line pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), - ?line wait_for_ready_net(), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + {ok, Cpz} = start_node_comp(Ncpz, Config), + pong = rpc:call(Cp2, net_adm, ping, [Cpznn]), + pong = rpc:call(Cpx, net_adm, ping, [Cpznn]), + wait_for_ready_net(), + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), %% stop the nodes, and make sure names are released. stop_node(Cp1), @@ -625,52 +625,51 @@ compatible(Config) when is_list(Config) -> stop_node(Cpy), stop_node(Cpz), - ?line ?UNTIL(undefined =:= global:whereis_name(test)), + ?UNTIL(undefined =:= global:whereis_name(test)), ok. - + %% Test a system with only one global group. . one_grp(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "global_group.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), - ?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), + config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), - ?line {ok, Cp3} = start_node(Ncp3, Config), + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp3} = start_node(Ncp3, Config), %% sleep a while to make the global_group to sync... ct:sleep(1000), %% start a proc and register it - ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), + {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), %% test that it is registered at all nodes - ?line Pid = rpc:call(Cp1, global, whereis_name, [test]), - ?line Pid = rpc:call(Cp2, global, whereis_name, [test]), - ?line Pid = rpc:call(Cp3, global, whereis_name, [test]), + Pid = rpc:call(Cp1, global, whereis_name, [test]), + Pid = rpc:call(Cp2, global, whereis_name, [test]), + Pid = rpc:call(Cp3, global, whereis_name, [test]), %% try to register the same name - ?line no = rpc:call(Cp1, global, register_name, [test, self()]), + no = rpc:call(Cp1, global, register_name, [test, self()]), %% let process exit, check that it is unregistered automatically Pid ! die, - ?line - ?UNTIL(begin + ?UNTIL(begin (undefined =:= rpc:call(Cp1, global, whereis_name, [test])) and (undefined =:= rpc:call(Cp2, global, whereis_name, [test])) and (undefined =:= rpc:call(Cp3, global, whereis_name, [test])) end), %% test re_register - ?line {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), - ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test]), + {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), + Pid2 = rpc:call(Cp3, global, whereis_name, [test]), Pid3 = rpc:call(Cp3, ?MODULE, start_proc_rereg, [test]), - ?line Pid3 = rpc:call(Cp3, global, whereis_name, [test]), + Pid3 = rpc:call(Cp3, global, whereis_name, [test]), %% test sending rpc:call(Cp1, global, send, [test, {ping, self()}]), @@ -687,28 +686,28 @@ one_grp(Config) when is_list(Config) -> 2000 -> ct:fail(timeout2) end, - ?line rpc:call(Cp3, global, unregister_name, [test]), - ?line undefined = rpc:call(Cp1, global, whereis_name, [test]), - ?line undefined = rpc:call(Cp2, global, whereis_name, [test]), - ?line undefined = rpc:call(Cp3, global, whereis_name, [test]), + rpc:call(Cp3, global, unregister_name, [test]), + undefined = rpc:call(Cp1, global, whereis_name, [test]), + undefined = rpc:call(Cp2, global, whereis_name, [test]), + undefined = rpc:call(Cp3, global, whereis_name, [test]), Pid3 ! die, - ?line ?UNTIL(undefined =:= rpc:call(Cp3, global, whereis_name, [test])), + ?UNTIL(undefined =:= rpc:call(Cp3, global, whereis_name, [test])), %% register a proc - ?line {_, yes} = rpc:call(Cp3, ?MODULE, start_proc, [test]), + {_, yes} = rpc:call(Cp3, ?MODULE, start_proc, [test]), %% stop the nodes, and make sure names are released. stop_node(Cp3), - ?line ?UNTIL(undefined =:= rpc:call(Cp1, global, whereis_name, [test])), + ?UNTIL(undefined =:= rpc:call(Cp1, global, whereis_name, [test])), Pid2 ! die, stop_node(Cp1), stop_node(Cp2), ok. - + @@ -717,47 +716,46 @@ one_grp(Config) when is_list(Config) -> %% Start the nodes with different time intervals. one_grp_x(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "global_group.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config), - ?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), + config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"), - ?line {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp1} = start_node(Ncp1, Config), %% sleep a while to make the global_group to sync... ct:sleep(1000), %% start a proc and register it - ?line {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), + {Pid, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), - ?line {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp2} = start_node(Ncp2, Config), %% sleep a while to make the global_group to sync... ct:sleep(1000), %% test that it is registered at all nodes - ?line Pid = rpc:call(Cp1, global, whereis_name, [test]), - ?line Pid = rpc:call(Cp2, global, whereis_name, [test]), + Pid = rpc:call(Cp1, global, whereis_name, [test]), + Pid = rpc:call(Cp2, global, whereis_name, [test]), - ?line {ok, Cp3} = start_node(Ncp3, Config), + {ok, Cp3} = start_node(Ncp3, Config), %% sleep a while to make the global_group to sync... ct:sleep(1000), - ?line Pid = rpc:call(Cp3, global, whereis_name, [test]), + Pid = rpc:call(Cp3, global, whereis_name, [test]), %% try to register the same name - ?line no = rpc:call(Cp1, global, register_name, [test, self()]), + no = rpc:call(Cp1, global, register_name, [test, self()]), %% let process exit, check that it is unregistered automatically Pid ! die, - ?line - ?UNTIL(begin + ?UNTIL(begin (undefined =:= rpc:call(Cp1, global, whereis_name, [test])) and (undefined =:= rpc:call(Cp2, global, whereis_name, [test])) and (undefined =:= rpc:call(Cp3, global, whereis_name, [test])) end), %% test re_register - ?line {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), - ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test]), + {Pid2, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), + Pid2 = rpc:call(Cp3, global, whereis_name, [test]), Pid2 ! die, @@ -766,7 +764,7 @@ one_grp_x(Config) when is_list(Config) -> stop_node(Cp3), ok. - + @@ -775,26 +773,26 @@ one_grp_x(Config) when is_list(Config) -> %% Test a two global group system. . two_grp(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "global_group.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz,Ncpq] = node_names([cp1,cp2,cp3,cpx,cpy,cpz,cpq], Config), - ?line config(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq), - - ?line Cp1nn = node_at(Ncp1), - ?line Cp2nn = node_at(Ncp2), - ?line Cp3nn = node_at(Ncp3), - ?line Cpxnn = node_at(Ncpx), - ?line Cpynn = node_at(Ncpy), - ?line Cpznn = node_at(Ncpz), - - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), - ?line {ok, Cp3} = start_node(Ncp3, Config), - ?line {ok, Cpx} = start_node(Ncpx, Config), - ?line {ok, Cpy} = start_node(Ncpy, Config), - ?line {ok, Cpz} = start_node(Ncpz, Config), + config(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq), + + Cp1nn = node_at(Ncp1), + Cp2nn = node_at(Ncp2), + Cp3nn = node_at(Ncp3), + Cpxnn = node_at(Ncpx), + Cpynn = node_at(Ncpy), + Cpznn = node_at(Ncpz), + + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp3} = start_node(Ncp3, Config), + {ok, Cpx} = start_node(Ncpx, Config), + {ok, Cpy} = start_node(Ncpy, Config), + {ok, Cpz} = start_node(Ncpz, Config), %% The groups (cpq not started): %% [{nc1, [cp1,cp2,cp3]}, {nc2, [cpx,cpy,cpz]}, {nc3, [cpq]}] @@ -803,183 +801,182 @@ two_grp(Config) when is_list(Config) -> ct:sleep(1000), %% check the global group names - ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), - ?line {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), - ?line {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpx, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpx, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), %% check the global group nodes - ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp1, global_group, own_nodes, []), - ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), - ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp3, global_group, own_nodes, []), - ?line [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpx, global_group, own_nodes, []), - ?line [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpy, global_group, own_nodes, []), - ?line [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpz, global_group, own_nodes, []), + [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp1, global_group, own_nodes, []), + [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), + [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp3, global_group, own_nodes, []), + [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpx, global_group, own_nodes, []), + [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpy, global_group, own_nodes, []), + [Cpxnn, Cpynn, Cpznn] = rpc:call(Cpz, global_group, own_nodes, []), %% start a proc and register it - ?line {Pid1, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), + {Pid1, yes} = rpc:call(Cp1, ?MODULE, start_proc, [test]), - ?line Pid1 = rpc:call(Cp1, global_group, send, [test, {io, from_cp1}]), - ?line Pid1 = rpc:call(Cpx, global_group, send, [test, {io, from_cpx}]), - ?line Pid1 = rpc:call(Cp1, global_group, send, [{group,nc1}, test, - {io, from_cp1}]), - ?line [test] = + Pid1 = rpc:call(Cp1, global_group, send, [test, {io, from_cp1}]), + Pid1 = rpc:call(Cpx, global_group, send, [test, {io, from_cpx}]), + Pid1 = rpc:call(Cp1, global_group, send, [{group,nc1}, test, + {io, from_cp1}]), + [test] = rpc:call(Cpx, global_group, registered_names, [{node, Cp1nn}]), - ?line [test] = + [test] = rpc:call(Cpx, global_group, registered_names, [{group, nc1}]), - ?line [] = rpc:call(Cpx, global_group, registered_names, [{node, Cpxnn}]), - ?line [] = rpc:call(Cpx, global_group, registered_names, [{group, nc2}]), - ?line Pid1 = rpc:call(Cpx, global_group, send, [{group,nc1}, test, - {io, from_cp1}]), - ?line {badarg,{test,{io,from_cpx}}} = + [] = rpc:call(Cpx, global_group, registered_names, [{node, Cpxnn}]), + [] = rpc:call(Cpx, global_group, registered_names, [{group, nc2}]), + Pid1 = rpc:call(Cpx, global_group, send, [{group,nc1}, test, + {io, from_cp1}]), + {badarg,{test,{io,from_cpx}}} = rpc:call(Cp1, global_group, send, [{group,nc2}, test, {io, from_cpx}]), - ?line {badarg,{test,{io,from_cpx}}} = + {badarg,{test,{io,from_cpx}}} = rpc:call(Cpx, global_group, send, [{group,nc2}, test, {io, from_cpx}]), %% test that it is registered at all nodes - ?line Pid1 = rpc:call(Cp1, global, whereis_name, [test]), - ?line Pid1 = rpc:call(Cp2, global, whereis_name, [test]), - ?line Pid1 = rpc:call(Cp3, global, whereis_name, [test]), - ?line undefined = rpc:call(Cpx, global, whereis_name, [test]), - ?line undefined = rpc:call(Cpy, global, whereis_name, [test]), - ?line undefined = rpc:call(Cpz, global, whereis_name, [test]), - + Pid1 = rpc:call(Cp1, global, whereis_name, [test]), + Pid1 = rpc:call(Cp2, global, whereis_name, [test]), + Pid1 = rpc:call(Cp3, global, whereis_name, [test]), + undefined = rpc:call(Cpx, global, whereis_name, [test]), + undefined = rpc:call(Cpy, global, whereis_name, [test]), + undefined = rpc:call(Cpz, global, whereis_name, [test]), + %% start a proc and register it - ?line {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), + {PidX, yes} = rpc:call(Cpx, ?MODULE, start_proc, [test]), %% test that it is registered at all nodes - ?line Pid1 = rpc:call(Cp1, global, whereis_name, [test]), - ?line Pid1 = rpc:call(Cp2, global, whereis_name, [test]), - ?line Pid1 = rpc:call(Cp3, global, whereis_name, [test]), - ?line PidX = rpc:call(Cpx, global, whereis_name, [test]), - ?line PidX = rpc:call(Cpy, global, whereis_name, [test]), - ?line PidX = rpc:call(Cpz, global, whereis_name, [test]), - + Pid1 = rpc:call(Cp1, global, whereis_name, [test]), + Pid1 = rpc:call(Cp2, global, whereis_name, [test]), + Pid1 = rpc:call(Cp3, global, whereis_name, [test]), + PidX = rpc:call(Cpx, global, whereis_name, [test]), + PidX = rpc:call(Cpy, global, whereis_name, [test]), + PidX = rpc:call(Cpz, global, whereis_name, [test]), + Pid1 ! die, %% If we don't wait for global on other nodes to have updated its %% tables, 'test' may still be defined at the point when it is %% tested a few lines below. - ?line - ?UNTIL(begin + ?UNTIL(begin Pid = rpc:call(Cp2, global, whereis_name, [test]), undefined =:= Pid end), %% start a proc and register it - ?line {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), + {Pid2, yes} = rpc:call(Cp2, ?MODULE, start_proc, [test2]), %% test that it is registered at all nodes - ?line Pid2 = rpc:call(Cp1, global, whereis_name, [test2]), - ?line Pid2 = rpc:call(Cp2, global, whereis_name, [test2]), - ?line Pid2 = rpc:call(Cp3, global, whereis_name, [test2]), - ?line PidX = rpc:call(Cpx, global, whereis_name, [test]), - ?line PidX = rpc:call(Cpy, global, whereis_name, [test]), - ?line PidX = rpc:call(Cpz, global, whereis_name, [test]), - - ?line undefined = rpc:call(Cp1, global, whereis_name, [test]), - ?line undefined = rpc:call(Cp2, global, whereis_name, [test]), - ?line undefined = rpc:call(Cp3, global, whereis_name, [test]), - ?line undefined = rpc:call(Cpx, global, whereis_name, [test2]), - ?line undefined = rpc:call(Cpy, global, whereis_name, [test2]), - ?line undefined = rpc:call(Cpz, global, whereis_name, [test2]), - - - ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), + Pid2 = rpc:call(Cp1, global, whereis_name, [test2]), + Pid2 = rpc:call(Cp2, global, whereis_name, [test2]), + Pid2 = rpc:call(Cp3, global, whereis_name, [test2]), + PidX = rpc:call(Cpx, global, whereis_name, [test]), + PidX = rpc:call(Cpy, global, whereis_name, [test]), + PidX = rpc:call(Cpz, global, whereis_name, [test]), + + undefined = rpc:call(Cp1, global, whereis_name, [test]), + undefined = rpc:call(Cp2, global, whereis_name, [test]), + undefined = rpc:call(Cp3, global, whereis_name, [test]), + undefined = rpc:call(Cpx, global, whereis_name, [test2]), + undefined = rpc:call(Cpy, global, whereis_name, [test2]), + undefined = rpc:call(Cpz, global, whereis_name, [test2]), + + + Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), + Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cp3, global_group, send, [test2, {ping, self()}]), + Pid2 = rpc:call(Cp3, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpx, global_group, send, [test, {ping, self()}]), + PidX = rpc:call(Cpx, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpy, global_group, send, [test, {ping, self()}]), + PidX = rpc:call(Cpy, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpz, global_group, send, [test, {ping, self()}]), + PidX = rpc:call(Cpz, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cpx, global_group, send, [{node, Cp1nn}, test2, - {ping, self()}]), + Pid2 = rpc:call(Cpx, global_group, send, [{node, Cp1nn}, test2, + {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cpy, global_group, send, [{node, Cp2nn}, test2, - {ping, self()}]), + Pid2 = rpc:call(Cpy, global_group, send, [{node, Cp2nn}, test2, + {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cpz, global_group, send, [{node, Cp3nn}, test2, - {ping, self()}]), + Pid2 = rpc:call(Cpz, global_group, send, [{node, Cp3nn}, test2, + {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpznn}, test, - {ping, self()}]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpznn}, test, + {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpy, global_group, send, [{node, Cpxnn}, test, - {ping, self()}]), + PidX = rpc:call(Cpy, global_group, send, [{node, Cpxnn}, test, + {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpz, global_group, send, [{node, Cpynn}, test, - {ping, self()}]), + PidX = rpc:call(Cpz, global_group, send, [{node, Cpynn}, test, + {ping, self()}]), receive {pong, Cpx} -> ok after 2000 -> ct:fail(timeout2) end, - ?line Pid2 = rpc:call(Cpx, global_group, send, [{group, nc1}, test2, - {ping, self()}]), + Pid2 = rpc:call(Cpx, global_group, send, [{group, nc1}, test2, + {ping, self()}]), receive {pong, Cp2} -> ok after 2000 -> ct:fail(timeout2) end, - ?line PidX = rpc:call(Cpy, global_group, send, [{group, nc2}, test, - {ping, self()}]), + PidX = rpc:call(Cpy, global_group, send, [{group, nc2}, test, + {ping, self()}]), receive {pong, Cpx} -> ok after @@ -989,68 +986,68 @@ two_grp(Config) when is_list(Config) -> %%------------------------------------ %% Test monitor nodes %%------------------------------------ - ?line Pid2 = + Pid2 = rpc:call(Cp1, global_group, send, [{node, Cp2nn}, test2, monitor]), - ?line PidX = + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, monitor]), %% Kill node Cp1 - ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, - {wait_nodedown, Cp1}]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, - {wait_nodedown, Cp1}]), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, + {wait_nodedown, Cp1}]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, + {wait_nodedown, Cp1}]), ct:sleep(100), - ?line stop_node(Cp1), + stop_node(Cp1), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodedown), - ?line PidX = + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodedown), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, to_loop]), %% Kill node Cpz - ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, - {wait_nodedown, Cpz}]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, - {wait_nodedown, Cpz}]), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, + {wait_nodedown, Cpz}]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, + {wait_nodedown, Cpz}]), ct:sleep(100), - ?line stop_node(Cpz), + stop_node(Cpz), ct:sleep(1000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodedown), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - ?line Pid2 = + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodedown), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, to_loop]), %% Restart node Cp1 - ?line [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), - ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, - {wait_nodeup, Cp1}]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, - {wait_nodeup, Cp1}]), + [Cp1nn, Cp2nn, Cp3nn] = rpc:call(Cp2, global_group, own_nodes, []), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, + {wait_nodeup, Cp1}]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, + {wait_nodeup, Cp1}]), ct:sleep(100), - ?line {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp1} = start_node(Ncp1, Config), ct:sleep(5000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodeup), - ?line PidX = + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop_nodeup), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, to_loop]), %% Restart node Cpz - ?line Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, - {wait_nodeup, Cpz}]), - ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, - {wait_nodeup, Cpz}]), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, + {wait_nodeup, Cpz}]), + PidX = rpc:call(Cpx, global_group, send, [{node, Cpxnn}, test, + {wait_nodeup, Cpz}]), ct:sleep(100), - ?line {ok, Cpz} = start_node(Ncpz, Config), + {ok, Cpz} = start_node(Ncpz, Config), ct:sleep(5000), - - ?line ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodeup), - ?line ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), - ?line Pid2 = + + ok = assert_loop(Cp2, Cp2nn, test2, Pid2, loop_nodeup), + ok = assert_loop(Cpx, Cpxnn, test, PidX, loop), + Pid2 = rpc:call(Cp2, global_group, send, [{node, Cp2nn}, test2, to_loop]), @@ -1065,67 +1062,67 @@ two_grp(Config) when is_list(Config) -> stop_node(Cpz), ok. - + %% Test hidden global groups. hidden_groups(Config) when is_list(Config) -> Dir = proplists:get_value(priv_dir, Config), - ?line File = filename:join(Dir, "global_group.config"), - ?line {ok, Fd} = file:open(File, [write]), + File = filename:join(Dir, "global_group.config"), + {ok, Fd} = file:open(File, [write]), [Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz,Ncpq] = node_names([cp1,cp2,cp3,cpx,cpy,cpz,cpq], Config), - ?line config_hidden(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq), + config_hidden(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq), - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), - ?line {ok, Cp3} = start_node(Ncp3, Config), - ?line {ok, Cpx} = start_node(Ncpx, Config), - ?line {ok, Cpy} = start_node(Ncpy, Config), - ?line {ok, Cpz} = start_node(Ncpz, Config), - ?line {ok, Cpq} = start_node(Ncpq, Config), + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp3} = start_node(Ncp3, Config), + {ok, Cpx} = start_node(Ncpx, Config), + {ok, Cpy} = start_node(Ncpy, Config), + {ok, Cpz} = start_node(Ncpz, Config), + {ok, Cpq} = start_node(Ncpq, Config), %% sleep a while to make the global_groups to sync... ct:sleep(1000), %% check the global group names - ?line {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), - ?line {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), - ?line {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpx, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), - ?line {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp1, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp2, global_group, global_groups, []), + {nc1, [nc2, nc3]} = rpc:call(Cp3, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpx, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpy, global_group, global_groups, []), + {nc2, [nc1, nc3]} = rpc:call(Cpz, global_group, global_groups, []), %% check the global group nodes - ?line [Cp1, Cp2, Cp3] = rpc:call(Cp1, global_group, own_nodes, []), - ?line [Cp1, Cp2, Cp3] = rpc:call(Cp2, global_group, own_nodes, []), - ?line [Cp1, Cp2, Cp3] = rpc:call(Cp3, global_group, own_nodes, []), - ?line [Cpx, Cpy, Cpz] = rpc:call(Cpx, global_group, own_nodes, []), - ?line [Cpx, Cpy, Cpz] = rpc:call(Cpy, global_group, own_nodes, []), - ?line [Cpx, Cpy, Cpz] = rpc:call(Cpz, global_group, own_nodes, []), - ?line [Cpq] = rpc:call(Cpq, global_group, own_nodes, []), + [Cp1, Cp2, Cp3] = rpc:call(Cp1, global_group, own_nodes, []), + [Cp1, Cp2, Cp3] = rpc:call(Cp2, global_group, own_nodes, []), + [Cp1, Cp2, Cp3] = rpc:call(Cp3, global_group, own_nodes, []), + [Cpx, Cpy, Cpz] = rpc:call(Cpx, global_group, own_nodes, []), + [Cpx, Cpy, Cpz] = rpc:call(Cpy, global_group, own_nodes, []), + [Cpx, Cpy, Cpz] = rpc:call(Cpz, global_group, own_nodes, []), + [Cpq] = rpc:call(Cpq, global_group, own_nodes, []), %% Make some inter group connections - ?line pong = rpc:call(Cp1, net_adm, ping, [Cpx]), - ?line pong = rpc:call(Cpy, net_adm, ping, [Cp2]), - ?line pong = rpc:call(Cp3, net_adm, ping, [Cpx]), - ?line pong = rpc:call(Cpz, net_adm, ping, [Cp3]), - ?line pong = rpc:call(Cpq, net_adm, ping, [Cp1]), - ?line pong = rpc:call(Cpz, net_adm, ping, [Cpq]), + pong = rpc:call(Cp1, net_adm, ping, [Cpx]), + pong = rpc:call(Cpy, net_adm, ping, [Cp2]), + pong = rpc:call(Cp3, net_adm, ping, [Cpx]), + pong = rpc:call(Cpz, net_adm, ping, [Cp3]), + pong = rpc:call(Cpq, net_adm, ping, [Cp1]), + pong = rpc:call(Cpz, net_adm, ping, [Cpq]), %% Check that no inter group connections are visible NC1Nodes = lists:sort([Cp1, Cp2, Cp3]), NC2Nodes = lists:sort([Cpx, Cpy, Cpz]), - ?line NC1Nodes = lists:sort([Cp1|rpc:call(Cp1, erlang, nodes, [])]), - ?line NC1Nodes = lists:sort([Cp2|rpc:call(Cp2, erlang, nodes, [])]), - ?line NC1Nodes = lists:sort([Cp3|rpc:call(Cp3, erlang, nodes, [])]), - ?line NC2Nodes = lists:sort([Cpx|rpc:call(Cpx, erlang, nodes, [])]), - ?line NC2Nodes = lists:sort([Cpy|rpc:call(Cpy, erlang, nodes, [])]), - ?line NC2Nodes = lists:sort([Cpz|rpc:call(Cpz, erlang, nodes, [])]), + NC1Nodes = lists:sort([Cp1|rpc:call(Cp1, erlang, nodes, [])]), + NC1Nodes = lists:sort([Cp2|rpc:call(Cp2, erlang, nodes, [])]), + NC1Nodes = lists:sort([Cp3|rpc:call(Cp3, erlang, nodes, [])]), + NC2Nodes = lists:sort([Cpx|rpc:call(Cpx, erlang, nodes, [])]), + NC2Nodes = lists:sort([Cpy|rpc:call(Cpy, erlang, nodes, [])]), + NC2Nodes = lists:sort([Cpz|rpc:call(Cpz, erlang, nodes, [])]), NC12Nodes = lists:append(NC1Nodes, NC2Nodes), - ?line false = lists:any(fun(N) -> lists:member(N, NC12Nodes) end, - rpc:call(Cpq, erlang, nodes, [])), + false = lists:any(fun(N) -> lists:member(N, NC12Nodes) end, + rpc:call(Cpq, erlang, nodes, [])), stop_node(Cp1), @@ -1137,24 +1134,24 @@ hidden_groups(Config) when is_list(Config) -> stop_node(Cpq), ok. - + %% Checks when the search process exits. . test_exit(Config) when is_list(Config) -> - ?line NN = node_name(atom_to_list(node())), - ?line Cp1nn = list_to_atom("cp1@" ++ NN), + NN = node_name(atom_to_list(node())), + Cp1nn = list_to_atom("cp1@" ++ NN), - ?line {ok, Cp1} = start_node(cp1, Config), - ?line {ok, Cp2} = start_node(cp2, Config), - ?line {ok, Cp3} = start_node(cp3, Config), + {ok, Cp1} = start_node(cp1, Config), + {ok, Cp2} = start_node(cp2, Config), + {ok, Cp3} = start_node(cp3, Config), ct:sleep(1000), - ?line {error, illegal_function_call} = + {error, illegal_function_call} = rpc:call(Cp1, global_group, registered_names_test, [{node, Cp1nn}]), - ?line {badarg,_} = + {badarg,_} = rpc:call(Cp1, global_group, send, [king, "The message"]), - ?line undefined = rpc:call(Cp1, global_group, whereis_name, [king]), + undefined = rpc:call(Cp1, global_group, whereis_name, [king]), %% stop the nodes, and make sure names are released. stop_node(Cp1), @@ -1165,7 +1162,7 @@ test_exit(Config) when is_list(Config) -> ct:sleep(1000), ok. - + start_node(Name, Config) -> Pa=filename:dirname(code:which(?MODULE)), @@ -1211,10 +1208,10 @@ wait_for_ready_net() -> Nodes = lists:sort(?NODES), ?UNTIL(begin lists:all(fun(N) -> Nodes =:= get_known(N) end, Nodes) and - lists:all(fun(N) -> - LNs = rpc:call(N, erlang, nodes, []), - Nodes =:= lists:sort([N | LNs]) - end, Nodes) + lists:all(fun(N) -> + LNs = rpc:call(N, erlang, nodes, []), + Nodes =:= lists:sort([N | LNs]) + end, Nodes) end). get_known(Node) -> @@ -1224,11 +1221,11 @@ get_known(Node) -> config_hidden(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq) -> M = from($@, atom_to_list(node())), io:format(Fd, "[{kernel, [{sync_nodes_optional, ['~s@~s','~s@~s','~s@~s', " - " '~s@~s','~s@~s','~s@~s']}," - "{sync_nodes_timeout, 1000}," - "{global_groups, [{nc1, hidden, ['~s@~s','~s@~s','~s@~s']}, " - "{nc2, hidden, ['~s@~s','~s@~s','~s@~s']}, " - "{nc3, normal, ['~s@~s']}]} ] }]. ~n", + " '~s@~s','~s@~s','~s@~s']}," + "{sync_nodes_timeout, 1000}," + "{global_groups, [{nc1, hidden, ['~s@~s','~s@~s','~s@~s']}, " + "{nc2, hidden, ['~s@~s','~s@~s','~s@~s']}, " + "{nc3, normal, ['~s@~s']}]} ] }]. ~n", [Ncp1, M, Ncp2, M, Ncp3, M, Ncpx, M, Ncpy, M, Ncpz, M, Ncp1, M, Ncp2, M, Ncp3, M, @@ -1238,11 +1235,11 @@ config_hidden(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq) -> config(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz, Ncpq) -> M = from($@, atom_to_list(node())), io:format(Fd, "[{kernel, [{sync_nodes_optional, ['~s@~s','~s@~s','~s@~s', " - " '~s@~s','~s@~s','~s@~s']}," - "{sync_nodes_timeout, 1000}," - "{global_groups, [{nc1, ['~s@~s','~s@~s','~s@~s']}, " - " {nc2, ['~s@~s','~s@~s','~s@~s']}, " - "{nc3, ['~s@~s']}]} ] }]. ~n", + " '~s@~s','~s@~s','~s@~s']}," + "{sync_nodes_timeout, 1000}," + "{global_groups, [{nc1, ['~s@~s','~s@~s','~s@~s']}, " + " {nc2, ['~s@~s','~s@~s','~s@~s']}, " + "{nc3, ['~s@~s']}]} ] }]. ~n", [Ncp1, M, Ncp2, M, Ncp3, M, Ncpx, M, Ncpy, M, Ncpz, M, Ncp1, M, Ncp2, M, Ncp3, M, @@ -1255,9 +1252,9 @@ config_no(Fd) -> config_sync(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz) -> M = from($@, atom_to_list(node())), io:format(Fd, "[{kernel, [{sync_nodes_optional, ['~s@~s','~s@~s','~s@~s', " - " '~s@~s','~s@~s','~s@~s']}," - "{sync_nodes_timeout, 1000}," - "{global_groups, []} ] }] .~n", + " '~s@~s','~s@~s','~s@~s']}," + "{sync_nodes_timeout, 1000}," + "{global_groups, []} ] }] .~n", [Ncp1, M, Ncp2, M, Ncp3, M, Ncpx, M, Ncpy, M, Ncpz, M]). @@ -1265,8 +1262,8 @@ config_sync(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz) -> config_comp(Fd, Ncp1, Ncp2, Ncp3, Ncpx, Ncpy, Ncpz) -> M = from($@, atom_to_list(node())), io:format(Fd, "[{kernel, [{sync_nodes_optional, ['~s@~s','~s@~s','~s@~s', " - " '~s@~s','~s@~s','~s@~s']}," - "{sync_nodes_timeout, 1000} ] }] .~n", + " '~s@~s','~s@~s','~s@~s']}," + "{sync_nodes_timeout, 1000} ] }] .~n", [Ncp1, M, Ncp2, M, Ncp3, M, Ncpx, M, Ncpy, M, Ncpz, M]). @@ -1287,7 +1284,7 @@ start_proc(Name) -> receive {Pid, Res} -> {Pid, Res} end. - + start_proc_rereg(Name) -> Pid = spawn(?MODULE, init2, [self(), Name]), receive -- cgit v1.2.3