aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorKjell Winblad <[email protected]>2019-05-08 11:50:56 +0200
committerKjell Winblad <[email protected]>2019-05-21 14:43:56 +0200
commitcc763c935f17d5799d30fac53725965b93c5ab45 (patch)
tree52ce832f23d8a6677c2cc91c0c9ea51a6aa80469 /lib/kernel
parentc8cec4415b49ce3b70d760e81aaa482af20d93a2 (diff)
downloadotp-cc763c935f17d5799d30fac53725965b93c5ab45.tar.gz
otp-cc763c935f17d5799d30fac53725965b93c5ab45.tar.bz2
otp-cc763c935f17d5799d30fac53725965b93c5ab45.zip
Fix test case `gen_tcp_api_SUITE:t_connect_timeout`
This commit makes the test case `t_connect_timeout` in the test suite gen_tcp_api_SUITE more reliable by searching for unused IP addresses in a larger range of IP addresses.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/gen_tcp_api_SUITE.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl
index 1be016444f..00c9dc5ed5 100644
--- a/lib/kernel/test/gen_tcp_api_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_api_SUITE.erl
@@ -594,10 +594,13 @@ unused_ip() ->
io:format("we = ~p, unused_ip = ~p~n", [Hent, IP]),
IP.
-unused_ip(_, _, _, 255) -> error;
+unused_ip(255, 255, 255, 255) -> error;
+unused_ip(255, B, C, D) -> unused_ip(1, B + 1, C, D);
+unused_ip(A, 255, C, D) -> unused_ip(A, 1, C + 1, D);
+unused_ip(A, B, 255, D) -> unused_ip(A, B, 1, D + 1);
unused_ip(A, B, C, D) ->
case inet:gethostbyaddr({A, B, C, D}) of
- {ok, _} -> unused_ip(A, B, C, D+1);
+ {ok, _} -> unused_ip(A + 1, B, C, D);
{error, _} -> {ok, {A, B, C, D}}
end.