aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/gen_tcp_misc_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-11 15:33:17 +0100
committerBjörn Gustavsson <[email protected]>2016-03-23 13:28:09 +0100
commit34ff15da5756a4a2dfe82c475214e390f7cc6e2b (patch)
tree93ba3360b0cb8d671a6b4d2361e46d5c5494ddc8 /lib/kernel/test/gen_tcp_misc_SUITE.erl
parent8f5e589c7adab9450513852e8b71643d6c11e711 (diff)
downloadotp-34ff15da5756a4a2dfe82c475214e390f7cc6e2b.tar.gz
otp-34ff15da5756a4a2dfe82c475214e390f7cc6e2b.tar.bz2
otp-34ff15da5756a4a2dfe82c475214e390f7cc6e2b.zip
Clean up the determination of the hostname
Diffstat (limited to 'lib/kernel/test/gen_tcp_misc_SUITE.erl')
-rw-r--r--lib/kernel/test/gen_tcp_misc_SUITE.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index 7c3b011eb9..bafe3bfeb8 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -2475,7 +2475,7 @@ setup_closed_ao() ->
Dir = filename:dirname(code:which(?MODULE)),
{ok,R} = test_server:start_node(?UNIQ_NODE_NAME, slave,
[{args,"-pa " ++ Dir}]),
- Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))),
+ Host = get_hostname(node()),
{ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}]),
Fun = fun(F) ->
receive
@@ -2518,7 +2518,7 @@ setup_timeout_sink(Timeout, AutoClose) ->
Dir = filename:dirname(code:which(?MODULE)),
{ok,R} = test_server:start_node(?UNIQ_NODE_NAME, slave,
[{args,"-pa " ++ Dir}]),
- Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))),
+ Host = get_hostname(node()),
{ok, L} = gen_tcp:listen(0, [{active,false},{packet,2},
{send_timeout,Timeout},
{send_timeout_close,AutoClose}]),
@@ -2561,7 +2561,7 @@ setup_active_timeout_sink(Timeout, AutoClose) ->
Dir = filename:dirname(code:which(?MODULE)),
{ok,R} = test_server:start_node(?UNIQ_NODE_NAME, slave,
[{args,"-pa " ++ Dir}]),
- Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))),
+ Host = get_hostname(node()),
{ok, L} = gen_tcp:listen(0, [binary,{active,false},{packet,0},{nodelay, true},{keepalive, true},
{send_timeout,Timeout},
{send_timeout_close,AutoClose}]),
@@ -3016,3 +3016,7 @@ oct_aloop(S,X,Times) ->
end.
ok({ok,V}) -> V.
+
+get_hostname(Name) ->
+ "@"++Host = lists:dropwhile(fun(C) -> C =/= $@ end, atom_to_list(Name)),
+ Host.