aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/erl_boot_server_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-02 06:50:54 +0100
committerBjörn Gustavsson <[email protected]>2016-03-10 15:11:00 +0100
commit0ba20cd6d43e277593b59463d2c2959bb6db0957 (patch)
tree5c9fac877f54fe9b26622125707f030361af86c1 /lib/kernel/test/erl_boot_server_SUITE.erl
parent3dfdf35c65b8985a3abe21ef83f27cc8e82ba11c (diff)
downloadotp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.gz
otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.bz2
otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.zip
Remove ?line macros
While we are it, also re-ident the files.
Diffstat (limited to 'lib/kernel/test/erl_boot_server_SUITE.erl')
-rw-r--r--lib/kernel/test/erl_boot_server_SUITE.erl260
1 files changed, 130 insertions, 130 deletions
diff --git a/lib/kernel/test/erl_boot_server_SUITE.erl b/lib/kernel/test/erl_boot_server_SUITE.erl
index b2fb4974d8..aef1d69f62 100644
--- a/lib/kernel/test/erl_boot_server_SUITE.erl
+++ b/lib/kernel/test/erl_boot_server_SUITE.erl
@@ -61,257 +61,257 @@ end_per_group(_GroupName, Config) ->
%% Tests the erl_boot_server:start/1 function.
start(Config) when is_list(Config) ->
- ?line [Host1, Host2|_] = good_hosts(Config),
+ [Host1, Host2|_] = good_hosts(Config),
%% Bad arguments.
BadHost = "bad__host",
- ?line {error, {badarg, {}}} = erl_boot_server:start({}),
- ?line {error, {badarg, atom}} = erl_boot_server:start(atom),
- ?line {error, {badarg, [atom, BadHost]}} =
+ {error, {badarg, {}}} = erl_boot_server:start({}),
+ {error, {badarg, atom}} = erl_boot_server:start(atom),
+ {error, {badarg, [atom, BadHost]}} =
erl_boot_server:start([atom, BadHost]),
- ?line {error, {badarg, [Host1, BadHost]}} =
+ {error, {badarg, [Host1, BadHost]}} =
erl_boot_server:start([Host1, BadHost]),
%% Test once.
- ?line {ok, Pid1} = erl_boot_server:start([Host1]),
- ?line {error, {already_started, Pid1}} =
+ {ok, Pid1} = erl_boot_server:start([Host1]),
+ {error, {already_started, Pid1}} =
erl_boot_server:start([Host1]),
- ?line exit(Pid1, kill),
+ exit(Pid1, kill),
%% Test again.
ct:sleep(1),
- ?line {ok, Pid2} = erl_boot_server:start([Host1, Host2]),
- ?line {error, {already_started, Pid2}} =
+ {ok, Pid2} = erl_boot_server:start([Host1, Host2]),
+ {error, {already_started, Pid2}} =
erl_boot_server:start([Host1, Host2]),
- ?line exit(Pid2, kill),
+ exit(Pid2, kill),
ct:sleep(1),
ok.
%% Tests the erl_boot_server:start_link/1 function.
start_link(Config) when is_list(Config) ->
- ?line [Host1, Host2|_] = good_hosts(Config),
+ [Host1, Host2|_] = good_hosts(Config),
OldFlag = process_flag(trap_exit, true),
- ?line {error, {badarg, {}}} = erl_boot_server:start_link({}),
- ?line {error, {badarg, atom}} = erl_boot_server:start_link(atom),
- ?line BadHost = "bad__host",
- ?line {error, {badarg, [atom, BadHost]}} =
+ {error, {badarg, {}}} = erl_boot_server:start_link({}),
+ {error, {badarg, atom}} = erl_boot_server:start_link(atom),
+ BadHost = "bad__host",
+ {error, {badarg, [atom, BadHost]}} =
erl_boot_server:start_link([atom, BadHost]),
- ?line {ok, Pid1} = erl_boot_server:start_link([Host1]),
- ?line {error, {already_started, Pid1}} =
+ {ok, Pid1} = erl_boot_server:start_link([Host1]),
+ {error, {already_started, Pid1}} =
erl_boot_server:start_link([Host1]),
- ?line shutdown(Pid1),
+ shutdown(Pid1),
- ?line {ok, Pid2} = erl_boot_server:start_link([Host1, Host2]),
- ?line {error, {already_started, Pid2}} =
+ {ok, Pid2} = erl_boot_server:start_link([Host1, Host2]),
+ {error, {already_started, Pid2}} =
erl_boot_server:start_link([Host1, Host2]),
- ?line shutdown(Pid2),
+ shutdown(Pid2),
process_flag(trap_exit, OldFlag),
ok.
%% Tests that no processes are left if a boot server is killed.
stop(Config) when is_list(Config) ->
- ?line [Host1|_] = good_hosts(Config),
+ [Host1|_] = good_hosts(Config),
%% Start a boot server and kill it. Make sure that any helper processes
%% dies.
%% Make sure the inet_gethost_native server is already started,
%% otherwise it will make this test fail:
- ?line inet:getaddr(localhost, inet),
- ?line Before = processes(),
- ?line {ok, Pid} = erl_boot_server:start([Host1]),
- ?line New = processes() -- [Pid|Before],
- ?line exit(Pid, kill),
- ?line receive after 100 -> ok end,
- ?line case [P || P <- New, is_process_alive(P)] of
- [] ->
- ok;
- NotKilled ->
- ct:fail({not_killed, NotKilled})
- end,
+ inet:getaddr(localhost, inet),
+ Before = processes(),
+ {ok, Pid} = erl_boot_server:start([Host1]),
+ New = processes() -- [Pid|Before],
+ exit(Pid, kill),
+ receive after 100 -> ok end,
+ case [P || P <- New, is_process_alive(P)] of
+ [] ->
+ ok;
+ NotKilled ->
+ ct:fail({not_killed, NotKilled})
+ end,
ok.
%% Tests the erl_boot_server:add/1 function.
add(Config) when is_list(Config) ->
- ?line OldFlag = process_flag(trap_exit, true),
- ?line {ok, Pid1} = erl_boot_server:start_link([]),
- ?line [] = erl_boot_server:which_slaves(),
- ?line [Host1, Host2, Host3|_] = good_hosts(Config),
+ OldFlag = process_flag(trap_exit, true),
+ {ok, Pid1} = erl_boot_server:start_link([]),
+ [] = erl_boot_server:which_slaves(),
+ [Host1, Host2, Host3|_] = good_hosts(Config),
%% Try bad values.
- ?line {error, {badarg, {}}} = erl_boot_server:add_slave({}),
- ?line {error, {badarg, [atom]}} = erl_boot_server:add_slave([atom]),
- ?line BadHost = "bad__host",
- ?line {error, {badarg, BadHost}} = erl_boot_server:add_slave(BadHost),
- ?line [] = erl_boot_server:which_slaves(),
+ {error, {badarg, {}}} = erl_boot_server:add_slave({}),
+ {error, {badarg, [atom]}} = erl_boot_server:add_slave([atom]),
+ BadHost = "bad__host",
+ {error, {badarg, BadHost}} = erl_boot_server:add_slave(BadHost),
+ [] = erl_boot_server:which_slaves(),
%% Add good host names.
- ?line {ok, Ip1} = inet:getaddr(Host1, inet),
- ?line {ok, Ip2} = inet:getaddr(Host2, inet),
- ?line {ok, Ip3} = inet:getaddr(Host3, inet),
- ?line MIp1 = {?all_ones, Ip1},
- ?line MIp2 = {?all_ones, Ip2},
- ?line MIp3 = {?all_ones, Ip3},
- ?line ok = erl_boot_server:add_slave(Host1),
- ?line [MIp1] = erl_boot_server:which_slaves(),
- ?line ok = erl_boot_server:add_slave(Host2),
- ?line M_Ip1_Ip2 = lists:sort([MIp1, MIp2]),
- ?line M_Ip1_Ip2 = lists:sort(erl_boot_server:which_slaves()),
- ?line ok = erl_boot_server:add_slave(Host3),
- ?line M_Ip1_Ip2_Ip3 = lists:sort([MIp3|M_Ip1_Ip2]),
- ?line M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
+ {ok, Ip1} = inet:getaddr(Host1, inet),
+ {ok, Ip2} = inet:getaddr(Host2, inet),
+ {ok, Ip3} = inet:getaddr(Host3, inet),
+ MIp1 = {?all_ones, Ip1},
+ MIp2 = {?all_ones, Ip2},
+ MIp3 = {?all_ones, Ip3},
+ ok = erl_boot_server:add_slave(Host1),
+ [MIp1] = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:add_slave(Host2),
+ M_Ip1_Ip2 = lists:sort([MIp1, MIp2]),
+ M_Ip1_Ip2 = lists:sort(erl_boot_server:which_slaves()),
+ ok = erl_boot_server:add_slave(Host3),
+ M_Ip1_Ip2_Ip3 = lists:sort([MIp3|M_Ip1_Ip2]),
+ M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
%% Add duplicate names.
- ?line ok = erl_boot_server:add_slave(Host3),
- ?line M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:add_slave(Host3),
+ M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
%% More bad names.
- ?line {error, {badarg, BadHost}} = erl_boot_server:add_slave(BadHost),
- ?line M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
+ {error, {badarg, BadHost}} = erl_boot_server:add_slave(BadHost),
+ M_Ip1_Ip2_Ip3 = erl_boot_server:which_slaves(),
%% Cleanup.
- ?line shutdown(Pid1),
- ?line process_flag(trap_exit, OldFlag),
+ shutdown(Pid1),
+ process_flag(trap_exit, OldFlag),
ok.
%% Tests the erl_boot_server:delete/1 function.
delete(Config) when is_list(Config) ->
- ?line OldFlag = process_flag(trap_exit, true),
+ OldFlag = process_flag(trap_exit, true),
- ?line [Host1, Host2, Host3|_] = good_hosts(Config),
- ?line {ok, Ip1} = inet:getaddr(Host1, inet),
- ?line {ok, Ip2} = inet:getaddr(Host2, inet),
- ?line {ok, Ip3} = inet:getaddr(Host3, inet),
- ?line MIp1 = {?all_ones, Ip1},
- ?line MIp2 = {?all_ones, Ip2},
- ?line MIp3 = {?all_ones, Ip3},
+ [Host1, Host2, Host3|_] = good_hosts(Config),
+ {ok, Ip1} = inet:getaddr(Host1, inet),
+ {ok, Ip2} = inet:getaddr(Host2, inet),
+ {ok, Ip3} = inet:getaddr(Host3, inet),
+ MIp1 = {?all_ones, Ip1},
+ MIp2 = {?all_ones, Ip2},
+ MIp3 = {?all_ones, Ip3},
- ?line {ok, Pid1} = erl_boot_server:start_link([Host1, Host2, Host3]),
- ?line M_Ip123 = lists:sort([MIp1, MIp2, MIp3]),
- ?line M_Ip123 = erl_boot_server:which_slaves(),
+ {ok, Pid1} = erl_boot_server:start_link([Host1, Host2, Host3]),
+ M_Ip123 = lists:sort([MIp1, MIp2, MIp3]),
+ M_Ip123 = erl_boot_server:which_slaves(),
%% Do some bad attempts and check that the list of slaves is intact.
- ?line {error, {badarg, {}}} = erl_boot_server:delete_slave({}),
- ?line {error, {badarg, [atom]}} = erl_boot_server:delete_slave([atom]),
- ?line BadHost = "bad__host",
- ?line {error, {badarg, BadHost}} = erl_boot_server:delete_slave(BadHost),
- ?line M_Ip123 = erl_boot_server:which_slaves(),
+ {error, {badarg, {}}} = erl_boot_server:delete_slave({}),
+ {error, {badarg, [atom]}} = erl_boot_server:delete_slave([atom]),
+ BadHost = "bad__host",
+ {error, {badarg, BadHost}} = erl_boot_server:delete_slave(BadHost),
+ M_Ip123 = erl_boot_server:which_slaves(),
%% Delete Host2 and make sure it's gone.
- ?line ok = erl_boot_server:delete_slave(Host2),
- ?line M_Ip13 = lists:sort([MIp1, MIp3]),
- ?line M_Ip13 = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:delete_slave(Host2),
+ M_Ip13 = lists:sort([MIp1, MIp3]),
+ M_Ip13 = erl_boot_server:which_slaves(),
- ?line ok = erl_boot_server:delete_slave(Host1),
- ?line [MIp3] = erl_boot_server:which_slaves(),
- ?line ok = erl_boot_server:delete_slave(Host1),
- ?line [MIp3] = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:delete_slave(Host1),
+ [MIp3] = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:delete_slave(Host1),
+ [MIp3] = erl_boot_server:which_slaves(),
- ?line {error, {badarg, BadHost}} = erl_boot_server:delete_slave(BadHost),
- ?line [MIp3] = erl_boot_server:which_slaves(),
+ {error, {badarg, BadHost}} = erl_boot_server:delete_slave(BadHost),
+ [MIp3] = erl_boot_server:which_slaves(),
- ?line ok = erl_boot_server:delete_slave(Ip3),
- ?line [] = erl_boot_server:which_slaves(),
- ?line ok = erl_boot_server:delete_slave(Ip3),
- ?line [] = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:delete_slave(Ip3),
+ [] = erl_boot_server:which_slaves(),
+ ok = erl_boot_server:delete_slave(Ip3),
+ [] = erl_boot_server:which_slaves(),
- ?line shutdown(Pid1),
- ?line process_flag(trap_exit, OldFlag),
+ shutdown(Pid1),
+ process_flag(trap_exit, OldFlag),
ok.
%% Tests erl_boot_server responses to slave requests.
responses(Config) when is_list(Config) ->
- ?line process_flag(trap_exit, true),
+ process_flag(trap_exit, true),
%% Copy from inet_boot.hrl
EBOOT_PORT = 4368,
EBOOT_REQUEST = "EBOOTQ",
EBOOT_REPLY = "EBOOTR",
- ?line {ok,Host} = inet:gethostname(),
- ?line {ok,Ip} = inet:getaddr(Host, inet),
+ {ok,Host} = inet:gethostname(),
+ {ok,Ip} = inet:getaddr(Host, inet),
ThisVer = erlang:system_info(version),
- ?line {ok,BootPid} = erl_boot_server:start_link([Host]),
+ {ok,BootPid} = erl_boot_server:start_link([Host]),
%% Send junk
- ?line S1 = open_udp(),
- ?line prim_inet:sendto(S1, Ip, EBOOT_PORT, ["0"]),
+ S1 = open_udp(),
+ prim_inet:sendto(S1, Ip, EBOOT_PORT, ["0"]),
receive
What ->
- ?line close_udp(S1),
+ close_udp(S1),
ct:fail({"got unexpected response",What})
after 100 ->
ok
end,
%% Req from a slave with same erlang vsn.
- ?line S2 = open_udp(),
- ?line prim_inet:sendto(S2, Ip, EBOOT_PORT, [EBOOT_REQUEST,ThisVer]),
+ S2 = open_udp(),
+ prim_inet:sendto(S2, Ip, EBOOT_PORT, [EBOOT_REQUEST,ThisVer]),
receive
{udp,S2,Ip,_Port1,Resp1} ->
- ?line close_udp(S2),
- ?line EBOOT_REPLY = string:substr(Resp1, 1, length(EBOOT_REPLY)),
- ?line Rest1 = string:substr(Resp1, length(EBOOT_REPLY)+1, length(Resp1)),
- ?line [_,_,_ | ThisVer] = Rest1
+ close_udp(S2),
+ EBOOT_REPLY = string:substr(Resp1, 1, length(EBOOT_REPLY)),
+ Rest1 = string:substr(Resp1, length(EBOOT_REPLY)+1, length(Resp1)),
+ [_,_,_ | ThisVer] = Rest1
after 2000 ->
- ?line close_udp(S2),
+ close_udp(S2),
ct:fail("no boot server response; same vsn")
end,
-
+
%% Req from a slave with other erlang vsn.
- ?line S3 = open_udp(),
- ?line prim_inet:sendto(S3, Ip, EBOOT_PORT, [EBOOT_REQUEST,"1.0"]),
+ S3 = open_udp(),
+ prim_inet:sendto(S3, Ip, EBOOT_PORT, [EBOOT_REQUEST,"1.0"]),
receive
Anything ->
- ?line close_udp(S3),
+ close_udp(S3),
ct:fail({"got unexpected response",Anything})
after 100 ->
ok
end,
%% Kill the boot server and wait for it to disappear.
- ?line unlink(BootPid),
- ?line BootPidMref = erlang:monitor(process, BootPid),
- ?line exit(BootPid, kill),
+ unlink(BootPid),
+ BootPidMref = erlang:monitor(process, BootPid),
+ exit(BootPid, kill),
receive
{'DOWN',BootPidMref,_,_,_} -> ok
end,
- ?line {ok,BootPid2} = erl_boot_server:start_link(["127.0.0.1"]),
+ {ok,BootPid2} = erl_boot_server:start_link(["127.0.0.1"]),
%% Req from slave with invalid ip address.
- ?line S4 = open_udp(),
+ S4 = open_udp(),
Ret =
case Ip of
{127,0,0,1} ->
{comment,"IP address for this host is 127.0.0.1"};
_ ->
- ?line prim_inet:sendto(S4, Ip, EBOOT_PORT,
- [EBOOT_REQUEST,ThisVer]),
+ prim_inet:sendto(S4, Ip, EBOOT_PORT,
+ [EBOOT_REQUEST,ThisVer]),
receive
Huh ->
- ?line close_udp(S4),
+ close_udp(S4),
ct:fail({"got unexpected response",Huh})
after 100 ->
ok
end
end,
- ?line unlink(BootPid2),
- ?line exit(BootPid2, kill),
+ unlink(BootPid2),
+ exit(BootPid2, kill),
%% Now wait for any late unexpected messages.
receive
Whatever ->
ct:fail({unexpected_message,Whatever})
after 4000 ->
- ?line close_udp(S1),
- ?line close_udp(S3),
- ?line close_udp(S4),
+ close_udp(S1),
+ close_udp(S3),
+ close_udp(S4),
ok
end,
@@ -337,10 +337,10 @@ good_hosts(_Config) ->
[GoodHost1, GoodHost2, GoodHost3].
open_udp() ->
- ?line {ok, S} = prim_inet:open(udp, inet, dgram),
- ?line ok = prim_inet:setopts(S, [{mode,list},{active,true},
- {deliver,term},{broadcast,true}]),
- ?line {ok,_} = prim_inet:bind(S, {0,0,0,0}, 0),
+ {ok, S} = prim_inet:open(udp, inet, dgram),
+ ok = prim_inet:setopts(S, [{mode,list},{active,true},
+ {deliver,term},{broadcast,true}]),
+ {ok,_} = prim_inet:bind(S, {0,0,0,0}, 0),
S.
close_udp(S) ->