aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/inet_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/inet_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/inet_SUITE.erl')
-rw-r--r--lib/kernel/test/inet_SUITE.erl478
1 files changed, 238 insertions, 240 deletions
diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl
index 92ed4b051e..ee10747b0a 100644
--- a/lib/kernel/test/inet_SUITE.erl
+++ b/lib/kernel/test/inet_SUITE.erl
@@ -120,9 +120,9 @@ t_gethostbyaddr() ->
t_gethostbyaddr(Config) when is_list(Config) ->
{Name,FullName,IPStr,{A,B,C,D}=IP,Aliases,_,_} = ct:get_config(test_host_ipv4_only),
Rname = integer_to_list(D) ++ "." ++
- integer_to_list(C) ++ "." ++
- integer_to_list(B) ++ "." ++
- integer_to_list(A) ++ ".in-addr.arpa",
+ integer_to_list(C) ++ "." ++
+ integer_to_list(B) ++ "." ++
+ integer_to_list(A) ++ ".in-addr.arpa",
{ok,HEnt} = inet:gethostbyaddr(IPStr),
{ok,HEnt} = inet:gethostbyaddr(IP),
{error,Error} = inet:gethostbyaddr(Name),
@@ -154,71 +154,71 @@ t_gethostbyaddr(Config) when is_list(Config) ->
t_gethostbyaddr_v6() -> required(v6).
%% Test the inet:gethostbyaddr/1 inet6 function.
t_gethostbyaddr_v6(Config) when is_list(Config) ->
- ?line {Name6, FullName6, IPStr6, IP6, Aliases6} =
+ {Name6, FullName6, IPStr6, IP6, Aliases6} =
ct:get_config(test_host_ipv6_only),
- ?line case inet:gethostbyaddr(IPStr6) of
+ case inet:gethostbyaddr(IPStr6) of
%% Even if IPv6 is not supported, the native resolver may succeed
%% looking up the host. DNS lookup will probably fail.
{error,nxdomain} ->
{skip, "IPv6 test fails! IPv6 not supported on this host!?"};
{ok,HEnt6} ->
- ?line {ok,HEnt6} = inet:gethostbyaddr(IP6),
- ?line {error,Error6} = inet:gethostbyaddr(Name6),
- ?line ok = io:format("Failure reason: ~p: ~s",
- [Error6, inet:format_error(Error6)]),
- ?line HEnt6_ = HEnt6#hostent{h_addrtype = inet6,
- h_length = 16,
- h_addr_list = [IP6]},
- ?line HEnt6_ = HEnt6,
- ?line check_elems([{HEnt6#hostent.h_name,[Name6,FullName6]},
- {HEnt6#hostent.h_aliases,[[],Aliases6]}]),
-
- ?line {_DName6, _DFullName6, DIPStr6, DIP6, _} =
- ct:get_config(test_dummy_ipv6_host),
- ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr6),
- ?line {error,nxdomain} = inet:gethostbyaddr(DIP6),
+ {ok,HEnt6} = inet:gethostbyaddr(IP6),
+ {error,Error6} = inet:gethostbyaddr(Name6),
+ ok = io:format("Failure reason: ~p: ~s",
+ [Error6, inet:format_error(Error6)]),
+ HEnt6_ = HEnt6#hostent{h_addrtype = inet6,
+ h_length = 16,
+ h_addr_list = [IP6]},
+ HEnt6_ = HEnt6,
+ check_elems([{HEnt6#hostent.h_name,[Name6,FullName6]},
+ {HEnt6#hostent.h_aliases,[[],Aliases6]}]),
+
+ {_DName6, _DFullName6, DIPStr6, DIP6, _} =
+ ct:get_config(test_dummy_ipv6_host),
+ {error,nxdomain} = inet:gethostbyaddr(DIPStr6),
+ {error,nxdomain} = inet:gethostbyaddr(DIP6),
ok
end.
t_gethostbyname() -> required(v4).
%% Test the inet:gethostbyname/1 function.
t_gethostbyname(Config) when is_list(Config) ->
- ?line {Name,FullName,IPStr,IP,Aliases,IP_46_Str,_} =
+ {Name,FullName,IPStr,IP,Aliases,IP_46_Str,_} =
ct:get_config(test_host_ipv4_only),
- ?line {ok,_} = inet:gethostbyname(IPStr),
- ?line {ok,HEnt} = inet:gethostbyname(Name),
- ?line {ok,HEnt} = inet:gethostbyname(list_to_atom(Name)),
- ?line HEnt_ = HEnt#hostent{h_addrtype = inet,
- h_length = 4,
- h_addr_list = [IP]},
-
- ?line HEnt_ = HEnt,
- ?line check_elems([{HEnt#hostent.h_name,[Name,FullName]},
- {HEnt#hostent.h_aliases,[[],Aliases]}]),
- ?line {ok,HEntF} = inet:gethostbyname(FullName),
- ?line HEntF_ = HEntF#hostent{h_name = FullName,
- h_addrtype = inet,
- h_length = 4,
- h_addr_list = [IP]},
- ?line HEntF_ = HEntF,
- ?line check_elems([{HEnt#hostent.h_aliases,[[],Aliases]}]),
+ {ok,_} = inet:gethostbyname(IPStr),
+ {ok,HEnt} = inet:gethostbyname(Name),
+ {ok,HEnt} = inet:gethostbyname(list_to_atom(Name)),
+ HEnt_ = HEnt#hostent{h_addrtype = inet,
+ h_length = 4,
+ h_addr_list = [IP]},
+
+ HEnt_ = HEnt,
+ check_elems([{HEnt#hostent.h_name,[Name,FullName]},
+ {HEnt#hostent.h_aliases,[[],Aliases]}]),
+ {ok,HEntF} = inet:gethostbyname(FullName),
+ HEntF_ = HEntF#hostent{h_name = FullName,
+ h_addrtype = inet,
+ h_length = 4,
+ h_addr_list = [IP]},
+ HEntF_ = HEntF,
+ check_elems([{HEnt#hostent.h_aliases,[[],Aliases]}]),
%%
- ?line FullNameU = toupper(FullName),
- ?line {ok,HEntU} = inet:gethostbyname(FullNameU),
- ?line FullNameU = toupper(HEntU#hostent.h_name),
- ?line #hostent{
+ FullNameU = toupper(FullName),
+ {ok,HEntU} = inet:gethostbyname(FullNameU),
+ FullNameU = toupper(HEntU#hostent.h_name),
+ #hostent{
h_addrtype = inet,
h_length = 4,
h_addr_list = [IP]} = HEntU,
- ?line check_elems(
- [{[toupper(H) || H <- HEntU#hostent.h_aliases],
- [[],[toupper(A) || A <- Aliases]]}]),
+ check_elems(
+ [{[toupper(H) || H <- HEntU#hostent.h_aliases],
+ [[],[toupper(A) || A <- Aliases]]}]),
- ?line {DName, _DFullName, _DIPStr, _DIP, _, _, _} =
+ {DName, _DFullName, _DIPStr, _DIP, _, _, _} =
ct:get_config(test_dummy_host),
- ?line {error,nxdomain} = inet:gethostbyname(DName),
- ?line {error,nxdomain} = inet:gethostbyname(IP_46_Str),
+ {error,nxdomain} = inet:gethostbyname(DName),
+ {error,nxdomain} = inet:gethostbyname(IP_46_Str),
ok.
t_gethostbyname_v6() -> required(v6).
@@ -288,21 +288,21 @@ check_elem(Val, [], Tests0) ->
t_getaddr() -> required(v4).
%% Test the inet:getaddr/2 function.
t_getaddr(Config) when is_list(Config) ->
- ?line {Name,FullName,IPStr,IP,_,IP_46_Str,IP46} =
+ {Name,FullName,IPStr,IP,_,IP_46_Str,IP46} =
ct:get_config(test_host_ipv4_only),
- ?line {ok,IP} = inet:getaddr(list_to_atom(Name), inet),
- ?line {ok,IP} = inet:getaddr(Name, inet),
- ?line {ok,IP} = inet:getaddr(FullName, inet),
- ?line {ok,IP} = inet:getaddr(IP, inet),
- ?line {ok,IP} = inet:getaddr(IPStr, inet),
- ?line {error,nxdomain} = inet:getaddr(IP_46_Str, inet),
- ?line {error,eafnosupport} = inet:getaddr(IP46, inet),
-
- ?line {DName, DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host),
- ?line {error,nxdomain} = inet:getaddr(DName, inet),
- ?line {error,nxdomain} = inet:getaddr(DFullName, inet),
- ?line {ok,DIP} = inet:getaddr(DIPStr, inet),
- ?line {ok,DIP} = inet:getaddr(DIP, inet),
+ {ok,IP} = inet:getaddr(list_to_atom(Name), inet),
+ {ok,IP} = inet:getaddr(Name, inet),
+ {ok,IP} = inet:getaddr(FullName, inet),
+ {ok,IP} = inet:getaddr(IP, inet),
+ {ok,IP} = inet:getaddr(IPStr, inet),
+ {error,nxdomain} = inet:getaddr(IP_46_Str, inet),
+ {error,eafnosupport} = inet:getaddr(IP46, inet),
+
+ {DName, DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host),
+ {error,nxdomain} = inet:getaddr(DName, inet),
+ {error,nxdomain} = inet:getaddr(DFullName, inet),
+ {ok,DIP} = inet:getaddr(DIPStr, inet),
+ {ok,DIP} = inet:getaddr(DIP, inet),
ok.
t_getaddr_v6() -> required(v4) ++ required(v6).
@@ -340,9 +340,9 @@ ipv4_to_ipv6(Config) when is_list(Config) ->
%% If the native resolver succeeds to look it up, an IPv4 compatible
%% address should be returned. If no IPv6 support on this host, an
%% error should beturned.
- ?line {_Name,_FullName,IPStr,_IP,Aliases,IP_46_Str,IP_46} =
+ {_Name,_FullName,IPStr,_IP,Aliases,IP_46_Str,IP_46} =
ct:get_config(test_host_ipv4_only),
- ?line IP4to6Res =
+ IP4to6Res =
case inet:getaddr(IPStr, inet6) of
{ok,IP_46} ->
io:format("IPv4->IPv6: success~n"),
@@ -356,16 +356,16 @@ ipv4_to_ipv6(Config) when is_list(Config) ->
Other ->
ct:fail({ipv4_to_ipv6_lookup_failed,Other})
end,
- ?line case {IP4to6Res,inet:gethostbyname(IPStr, inet6)} of
- {true,{ok,HEnt}} ->
- ?line HEnt_ = HEnt#hostent{h_addrtype = inet6,
- h_length = 16,
- h_addr_list = [IP_46]},
- ?line HEnt_ = HEnt,
- ?line check_elems([{HEnt#hostent.h_name,[IP_46_Str,IPStr]},
- {HEnt#hostent.h_aliases,[[],Aliases]}]);
- {_,IP4to6Res} -> ok
- end,
+ case {IP4to6Res,inet:gethostbyname(IPStr, inet6)} of
+ {true,{ok,HEnt}} ->
+ HEnt_ = HEnt#hostent{h_addrtype = inet6,
+ h_length = 16,
+ h_addr_list = [IP_46]},
+ HEnt_ = HEnt,
+ check_elems([{HEnt#hostent.h_name,[IP_46_Str,IPStr]},
+ {HEnt#hostent.h_aliases,[[],Aliases]}]);
+ {_,IP4to6Res} -> ok
+ end,
ok.
host_and_addr() ->
@@ -374,14 +374,14 @@ host_and_addr() ->
%% Test looking up hosts and addresses. Use 'ypcat hosts'
%% or the local eqivalent to find all hosts.
host_and_addr(Config) when is_list(Config) ->
- ?line lists:foreach(fun try_host/1, get_hosts(Config)),
+ lists:foreach(fun try_host/1, get_hosts(Config)),
ok.
try_host({Ip0, Host}) ->
- ?line {ok,Ip} = inet:getaddr(Ip0, inet),
- ?line {ok,{hostent, _, _, inet, _, Ips1}} = inet:gethostbyaddr(Ip),
- ?line {ok,{hostent, _, _, inet, _, _Ips2}} = inet:gethostbyname(Host),
- ?line true = lists:member(Ip, Ips1),
+ {ok,Ip} = inet:getaddr(Ip0, inet),
+ {ok,{hostent, _, _, inet, _, Ips1}} = inet:gethostbyaddr(Ip),
+ {ok,{hostent, _, _, inet, _, _Ips2}} = inet:gethostbyname(Host),
+ true = lists:member(Ip, Ips1),
ok.
%% Get all hosts from the system using 'ypcat hosts' or the local
@@ -428,18 +428,18 @@ get_hosts([C|Rest], Cur, Ip, Result) ->
get_hosts(Rest, [C|Cur], Ip, Result);
get_hosts([], _, _, Result) ->
Result.
-
+
parse_hosts(Config) when is_list(Config) ->
DataDir = proplists:get_value(data_dir,Config),
- ?line HostFile = filename:join(DataDir, "hosts"),
- ?line inet_parse:hosts(HostFile),
- ?line HostFileErr1 = filename:join(DataDir, "hosts_err1"),
- ?line inet_parse:hosts(HostFileErr1),
- ?line Resolv = filename:join(DataDir,"resolv.conf"),
- ?line inet_parse:resolv(Resolv),
- ?line ResolvErr1 = filename:join(DataDir,"resolv.conf.err1"),
- ?line inet_parse:resolv(ResolvErr1).
+ HostFile = filename:join(DataDir, "hosts"),
+ inet_parse:hosts(HostFile),
+ HostFileErr1 = filename:join(DataDir, "hosts_err1"),
+ inet_parse:hosts(HostFileErr1),
+ Resolv = filename:join(DataDir,"resolv.conf"),
+ inet_parse:resolv(Resolv),
+ ResolvErr1 = filename:join(DataDir,"resolv.conf.err1"),
+ inet_parse:resolv(ResolvErr1).
parse_address(Config) when is_list(Config) ->
V4Strict =
@@ -511,10 +511,10 @@ parse_address(Config) when is_list(Config) ->
{{0,0,0,0,0,65535,258,65534},"::FFFF:1.2.255.254"},
{{16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff},
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"}
- |[{{D2,0,0,0,0,P,(D1 bsl 8) bor D2,(D3 bsl 8) bor D4},
- erlang:integer_to_list(D2, 16)++"::"++Q++S}
- || {{D1,D2,D3,D4},S} <- V4Strict,
- {P,Q} <- [{0,""},{16#17,"17:"},{16#ff0,"0ff0:"}]]],
+ |[{{D2,0,0,0,0,P,(D1 bsl 8) bor D2,(D3 bsl 8) bor D4},
+ erlang:integer_to_list(D2, 16)++"::"++Q++S}
+ || {{D1,D2,D3,D4},S} <- V4Strict,
+ {P,Q} <- [{0,""},{16#17,"17:"},{16#ff0,"0ff0:"}]]],
V4Sloppy =
[{{10,1,16#98,16#76},"10.0x019876"},
{{8#12,1,8#130,8#321},"012.01.054321"},
@@ -615,35 +615,35 @@ parse_strict_address(Config) when is_list(Config) ->
inet:parse_strict_address("c11:0c22:5c33:c440::077:0088").
t_gethostnative(Config) when is_list(Config) ->
-%% this will result in 26 bytes sent which causes problem in Windows
-%% if the port-program has not assured stdin to be read in BINARY mode
-%% OTP-2555
- ?line case inet_gethost_native:gethostbyname(
- "a23456789012345678901234") of
+ %% this will result in 26 bytes sent which causes problem in Windows
+ %% if the port-program has not assured stdin to be read in BINARY mode
+ %% OTP-2555
+ case inet_gethost_native:gethostbyname(
+ "a23456789012345678901234") of
{error,notfound} ->
- ?line ok;
+ ok;
{error,no_data} ->
- ?line ok
+ ok
end.
%% Check that the emulator survives crashes in gethost_native.
gethostnative_parallell(Config) when is_list(Config) ->
- ?line {ok,Hostname} = inet:gethostname(),
- ?line {ok,_} = inet:gethostbyname(Hostname),
+ {ok,Hostname} = inet:gethostname(),
+ {ok,_} = inet:gethostbyname(Hostname),
case whereis(inet_gethost_native) of
Pid when is_pid(Pid) ->
- ?line do_gethostnative_parallell();
+ do_gethostnative_parallell();
_ ->
- ?line {skipped, "Not running native gethostbyname"}
+ {skipped, "Not running native gethostbyname"}
end.
do_gethostnative_parallell() ->
- ?line PA = filename:dirname(code:which(?MODULE)),
+ PA = filename:dirname(code:which(?MODULE)),
{ok,Node} = test_server:start_node(gethost_parallell, slave,
- [{args, "-pa " ++ PA}]),
- ?line ok = rpc:call(Node, ?MODULE, parallell_gethost, []),
- ?line receive after 10000 -> ok end,
- ?line pong = net_adm:ping(Node),
+ [{args, "-pa " ++ PA}]),
+ ok = rpc:call(Node, ?MODULE, parallell_gethost, []),
+ receive after 10000 -> ok end,
+ pong = net_adm:ping(Node),
test_server:stop_node(Node),
ok.
@@ -737,7 +737,7 @@ wait_for_gethost(N) ->
%% This is what I call an exit tuple :)
exit({inet,gethostbyname, returned, Otherwise, 'when',
'N','=',N,'and','hostname','=',Hostname,'and',
- kill_gethost_n,'=',get(kill_gethost_n)})
+ kill_gethost_n,'=',get(kill_gethost_n)})
end,
case whereis(inet_gethost_native) of
Pid when is_pid(Pid) ->
@@ -749,20 +749,20 @@ wait_for_gethost(N) ->
end,
wait_for_gethost(N-1)
end.
-
+
%% Check that the resolver handles a CNAME loop.
cname_loop(Config) when is_list(Config) ->
%% getbyname (hostent_by_domain)
- ?line ok = inet_db:add_rr("mydomain.com", in, ?S_CNAME, ttl, "mydomain.com"),
- ?line {error,nxdomain} = inet_db:getbyname("mydomain.com", ?S_A),
- ?line ok = inet_db:del_rr("mydomain.com", in, ?S_CNAME, "mydomain.com"),
+ ok = inet_db:add_rr("mydomain.com", in, ?S_CNAME, ttl, "mydomain.com"),
+ {error,nxdomain} = inet_db:getbyname("mydomain.com", ?S_A),
+ ok = inet_db:del_rr("mydomain.com", in, ?S_CNAME, "mydomain.com"),
%% res_hostent_by_domain
RR = #dns_rr{domain = "mydomain.com",
class = in,
type = ?S_CNAME,
data = "mydomain.com"},
Rec = #dns_rec{anlist = [RR]},
- ?line {error,nxdomain} = inet_db:res_hostent_by_domain("mydomain.com", ?S_A, Rec),
+ {error,nxdomain} = inet_db:res_hostent_by_domain("mydomain.com", ?S_A, Rec),
ok.
@@ -781,9 +781,9 @@ gethostnative_soft_restart() -> required(hosts).
%% Check that no name lookups fails during soft restart
%% of inet_gethost_native.
gethostnative_soft_restart(Config) when is_list(Config) ->
- ?line gethostnative_control(Config,
- #gethostnative_control{
- control_seq=[soft_restart]}).
+ gethostnative_control(Config,
+ #gethostnative_control{
+ control_seq=[soft_restart]}).
gethostnative_debug_level() -> required(hosts).
@@ -791,59 +791,59 @@ gethostnative_debug_level() -> required(hosts).
%% Check that no name lookups fails during debug level change
%% of inet_gethost_native.
gethostnative_debug_level(Config) when is_list(Config) ->
- ?line gethostnative_control(Config,
- #gethostnative_control{
- control_seq=[{debug_level,1},
- {debug_level,0}]}).
+ gethostnative_control(Config,
+ #gethostnative_control{
+ control_seq=[{debug_level,1},
+ {debug_level,0}]}).
gethostnative_control(Config, Optrec) ->
- ?line case inet_db:res_option(lookup) of
- [native] ->
- case whereis(inet_gethost_native) of
- Pid when is_pid(Pid) ->
- ?line gethostnative_control_1(Config, Optrec);
- _ ->
- ?line {skipped, "Not running native gethostbyname"}
- end;
- _ ->
- ?line {skipped, "Native not only lookup metod"}
- end.
+ case inet_db:res_option(lookup) of
+ [native] ->
+ case whereis(inet_gethost_native) of
+ Pid when is_pid(Pid) ->
+ gethostnative_control_1(Config, Optrec);
+ _ ->
+ {skipped, "Not running native gethostbyname"}
+ end;
+ _ ->
+ {skipped, "Native not only lookup metod"}
+ end.
gethostnative_control_1(Config,
#gethostnative_control{
- control_seq=Seq,
- control_interval=Interval,
- lookup_delay=Delay,
- lookup_count=Cnt,
- lookup_processes=N}) ->
- ?line {ok, Hostname} = inet:gethostname(),
- ?line {ok, _} = inet:gethostbyname(Hostname),
- ?line Hosts =
+ control_seq=Seq,
+ control_interval=Interval,
+ lookup_delay=Delay,
+ lookup_count=Cnt,
+ lookup_processes=N}) ->
+ {ok, Hostname} = inet:gethostname(),
+ {ok, _} = inet:gethostbyname(Hostname),
+ Hosts =
[Hostname|[H || {_,H} <- get_hosts(Config)]
++[H++D || H <- ["www.","www1.","www2.",""],
D <- ["erlang.org","erlang.se"]]
++[H++"cslab.ericsson.net" || H <- ["morgoth.","hades.","styx."]]],
%% Spawn some processes to do parallel lookups while
%% I repeatedly do inet_gethost_native:control/1.
- ?line TrapExit = process_flag(trap_exit, true),
- ?line gethostnative_control_2([undefined], Interval, Delay, Cnt, N, Hosts),
+ TrapExit = process_flag(trap_exit, true),
+ gethostnative_control_2([undefined], Interval, Delay, Cnt, N, Hosts),
io:format(
- "First intermission: now starting control sequence ~w\n",
- [Seq]),
- ?line erlang:display(first_intermission),
- ?line gethostnative_control_2(Seq, Interval, Delay, Cnt, N, Hosts),
- ?line erlang:display(second_intermission),
+ "First intermission: now starting control sequence ~w\n",
+ [Seq]),
+ erlang:display(first_intermission),
+ gethostnative_control_2(Seq, Interval, Delay, Cnt, N, Hosts),
+ erlang:display(second_intermission),
io:format(
- "Second intermission: now stopping control sequence ~w\n",
- [Seq]),
- ?line gethostnative_control_2([undefined], Interval, Delay, Cnt, N, Hosts),
- ?line true = process_flag(trap_exit, TrapExit),
- ?line ok.
+ "Second intermission: now stopping control sequence ~w\n",
+ [Seq]),
+ gethostnative_control_2([undefined], Interval, Delay, Cnt, N, Hosts),
+ true = process_flag(trap_exit, TrapExit),
+ ok.
gethostnative_control_2(Seq, Interval, Delay, Cnt, N, Hosts) ->
- ?line Tag = make_ref(),
- ?line Parent = self(),
- ?line Lookupers =
+ Tag = make_ref(),
+ Parent = self(),
+ Lookupers =
[spawn_link(
fun () ->
lookup_loop(Hosts, Delay, Tag, Parent, Cnt, Hosts)
@@ -855,7 +855,7 @@ gethostnative_control_2(Seq, Interval, Delay, Cnt, N, Hosts) ->
gethostnative_control_3(Tag, Reason) ->
receive
{Tag,Error} ->
- ?line gethostnative_control_3(Tag, Error)
+ gethostnative_control_3(Tag, Error)
after 0 ->
Reason
end.
@@ -870,27 +870,26 @@ control_loop([Op|Ops], Interval, Tag, Lookupers, Seq) ->
Seq).
control_loop_1(Op, Interval, Tag, Lookupers) ->
- ?line
- receive
- {'EXIT',Pid,Reason} ->
- ?line case Reason of
- Tag -> % Done
- ?line control_loop_1
- (Op, Interval, Tag,
- lists:delete(Pid, Lookupers));
- _ ->
- ?line io:format("Lookuper ~p died: ~p",
- [Pid,Reason]),
- ct:fail("Lookuper died")
- end
- after Interval ->
- ?line if Op =/= undefined ->
- ?line ok = inet_gethost_native:control(Op);
- true ->
- ?line ok
- end,
- ?line Lookupers
- end.
+ receive
+ {'EXIT',Pid,Reason} ->
+ case Reason of
+ Tag -> % Done
+ control_loop_1
+ (Op, Interval, Tag,
+ lists:delete(Pid, Lookupers));
+ _ ->
+ io:format("Lookuper ~p died: ~p",
+ [Pid,Reason]),
+ ct:fail("Lookuper died")
+ end
+ after Interval ->
+ if Op =/= undefined ->
+ ok = inet_gethost_native:control(Op);
+ true ->
+ ok
+ end,
+ Lookupers
+ end.
lookup_loop(_, _Delay, Tag, _Parent, 0, _Hosts) ->
exit(Tag);
@@ -901,8 +900,8 @@ lookup_loop([H|Hs], Delay, Tag, Parent, Cnt, Hosts) ->
{ok,_Hent} -> ok;
{error,nxdomain} -> ok;
Error ->
- ?line io:format("Name lookup error for ~p for ~p: ~p",
- [self(),H,Error]),
+ io:format("Name lookup error for ~p for ~p: ~p",
+ [self(),H,Error]),
Parent ! {Tag,Error}
end,
receive
@@ -924,19 +923,19 @@ lookup_bad_search_option(Config) when is_list(Config) ->
%% Tests basic functionality of getiflist, getif, and ifget.
getif(Config) when is_list(Config) ->
- ?line case os:type() of
- {unix,Osname} ->
- ?line do_getif(Osname);
- {_,_} ->
- {skip,"inet:getif/0 probably not supported"}
- end.
+ case os:type() of
+ {unix,Osname} ->
+ do_getif(Osname);
+ {_,_} ->
+ {skip,"inet:getif/0 probably not supported"}
+ end.
do_getif(Osname) ->
- ?line {ok,Hostname} = inet:gethostname(),
- ?line {ok,Address} = inet:getaddr(Hostname, inet),
- ?line {ok,Loopback} = inet:getaddr("localhost", inet),
- ?line {ok,Interfaces} = inet:getiflist(),
- ?line HWAs =
+ {ok,Hostname} = inet:gethostname(),
+ {ok,Address} = inet:getaddr(Hostname, inet),
+ {ok,Loopback} = inet:getaddr("localhost", inet),
+ {ok,Interfaces} = inet:getiflist(),
+ HWAs =
lists:sort(
lists:foldl(
fun (I, Acc) ->
@@ -945,10 +944,10 @@ do_getif(Osname) ->
{ok,[]} -> Acc
end
end, [], Interfaces)),
- ?line io:format("HWAs = ~p~n", [HWAs]),
- ?line (Osname =/= sunos)
+ io:format("HWAs = ~p~n", [HWAs]),
+ (Osname =/= sunos)
andalso ((length(HWAs) > 0) orelse (ct:fail(no_HWAs))),
- ?line Addresses =
+ Addresses =
lists:sort(
lists:foldl(
fun (I, Acc) ->
@@ -957,51 +956,50 @@ do_getif(Osname) ->
{ok,[]} -> Acc
end
end, [], Interfaces)),
- ?line {ok,Getif} = inet:getif(),
- ?line Addresses = lists:sort([A || {A,_,_} <- Getif]),
- ?line true = ip_member(Address, Addresses),
- ?line true = ip_member(Loopback, Addresses),
- ?line ok.
+ {ok,Getif} = inet:getif(),
+ Addresses = lists:sort([A || {A,_,_} <- Getif]),
+ true = ip_member(Address, Addresses),
+ true = ip_member(Loopback, Addresses),
+ ok.
%% Test long interface names do not overrun buffer.
getif_ifr_name_overflow(Config) when is_list(Config) ->
- ?line case os:type() of
- {unix,Osname} ->
- ?line do_getif_ifr_name_overflow(Osname);
- {_,_} ->
- {skip,"inet:ifget/2 probably not supported"}
- end.
+ case os:type() of
+ {unix,Osname} ->
+ do_getif_ifr_name_overflow(Osname);
+ {_,_} ->
+ {skip,"inet:ifget/2 probably not supported"}
+ end.
do_getif_ifr_name_overflow(_) ->
%% emulator should not crash
- ?line {ok,[]} = inet:ifget(lists:duplicate(128, "x"), [addr]),
+ {ok,[]} = inet:ifget(lists:duplicate(128, "x"), [addr]),
ok.
%% Test long service names do not overrun buffer.
getservbyname_overflow(Config) when is_list(Config) ->
%% emulator should not crash
- ?line {error,einval} = inet:getservbyname(list_to_atom(lists:flatten(lists:duplicate(128, "x"))), tcp),
+ {error,einval} = inet:getservbyname(list_to_atom(lists:flatten(lists:duplicate(128, "x"))), tcp),
ok.
%% Test inet:gifaddrs/0.
getifaddrs(Config) when is_list (Config) ->
- ?line {ok,IfAddrs} = inet:getifaddrs(),
+ {ok,IfAddrs} = inet:getifaddrs(),
io:format("IfAddrs = ~p.~n", [IfAddrs]),
- ?line
- case
- {os:type(),
- [If ||
- {If,Opts} <- IfAddrs,
- lists:keymember(hwaddr, 1, Opts)]} of
- {{unix,sunos},[]} -> ok;
- {OT,[]} ->
- ct:fail({should_have_hwaddr,OT});
- _ -> ok
- end,
- ?line Addrs =
+ case
+ {os:type(),
+ [If ||
+ {If,Opts} <- IfAddrs,
+ lists:keymember(hwaddr, 1, Opts)]} of
+ {{unix,sunos},[]} -> ok;
+ {OT,[]} ->
+ ct:fail({should_have_hwaddr,OT});
+ _ -> ok
+ end,
+ Addrs =
[element(1, A) || A <- ifaddrs(IfAddrs)],
io:format("Addrs = ~p.~n", [Addrs]),
- ?line [check_addr(Addr) || Addr <- Addrs],
+ [check_addr(Addr) || Addr <- Addrs],
ok.
check_addr(Addr)
@@ -1011,33 +1009,33 @@ check_addr(Addr)
ok;
check_addr(Addr) ->
io:format("Addr: ~p.~n", [Addr]),
- ?line Ping = "ping",
- ?line Pong = "pong",
- ?line {ok,L} = gen_tcp:listen(0, [{ip,Addr},{active,false}]),
- ?line {ok,P} = inet:port(L),
- ?line {ok,S1} = gen_tcp:connect(Addr, P, [{active,false}]),
- ?line {ok,S2} = gen_tcp:accept(L),
- ?line ok = gen_tcp:send(S2, Ping),
- ?line {ok,Ping} = gen_tcp:recv(S1, length(Ping)),
- ?line ok = gen_tcp:send(S1, Pong),
- ?line ok = gen_tcp:close(S1),
- ?line {ok,Pong} = gen_tcp:recv(S2, length(Pong)),
- ?line ok = gen_tcp:close(S2),
- ?line ok = gen_tcp:close(L),
+ Ping = "ping",
+ Pong = "pong",
+ {ok,L} = gen_tcp:listen(0, [{ip,Addr},{active,false}]),
+ {ok,P} = inet:port(L),
+ {ok,S1} = gen_tcp:connect(Addr, P, [{active,false}]),
+ {ok,S2} = gen_tcp:accept(L),
+ ok = gen_tcp:send(S2, Ping),
+ {ok,Ping} = gen_tcp:recv(S1, length(Ping)),
+ ok = gen_tcp:send(S1, Pong),
+ ok = gen_tcp:close(S1),
+ {ok,Pong} = gen_tcp:recv(S2, length(Pong)),
+ ok = gen_tcp:close(S2),
+ ok = gen_tcp:close(L),
ok.
-record(ifopts, {name,flags,addrs=[],hwaddr}).
ifaddrs([]) -> [];
ifaddrs([{If,Opts}|IOs]) ->
- ?line #ifopts{flags=Flags} = Ifopts =
+ #ifopts{flags=Flags} = Ifopts =
check_ifopts(Opts, #ifopts{name=If}),
- ?line case Flags =/= undefined andalso lists:member(up, Flags) of
- true ->
- Ifopts#ifopts.addrs;
- false ->
- []
- end++ifaddrs(IOs).
+ case Flags =/= undefined andalso lists:member(up, Flags) of
+ true ->
+ Ifopts#ifopts.addrs;
+ false ->
+ []
+ end++ifaddrs(IOs).
check_ifopts([], #ifopts{name=If,flags=Flags,addrs=Raddrs}=Ifopts) ->
Addrs = lists:reverse(Raddrs),