diff options
Diffstat (limited to 'lib/kernel/test/gen_tcp_api_SUITE.erl')
-rw-r--r-- | lib/kernel/test/gen_tcp_api_SUITE.erl | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index 593a784bcc..c2ab0c3df6 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -1,8 +1,8 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2022. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1998-2023. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,7 +14,7 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% +%% %% %CopyrightEnd% %% -module(gen_tcp_api_SUITE). @@ -353,15 +353,22 @@ t_connect_src_port(Config) when is_list(Config) -> %% invalid things. t_connect_bad(Config) when is_list(Config) -> NonExistingPort = 45638, % Not in use, I hope. - {error, Reason1} = gen_tcp:connect(localhost, NonExistingPort, - ?INET_BACKEND_OPTS(Config)), - io:format("Error for connection attempt to port not in use: ~p", - [Reason1]), - - {error, Reason2} = gen_tcp:connect("non-existing-host-xxx", 7, - ?INET_BACKEND_OPTS(Config)), - io:format("Error for connection attempt to non-existing host: ~p", - [Reason2]), + t_connect_bad(Config, localhost, NonExistingPort, "port not in use"), + t_connect_bad(Config, "non-existing-host-xxx", 7, "non-existing host"), + element(1, os:type()) =:= unix andalso + begin + t_connect_bad(Config, "", 7, "empty host string"), + t_connect_bad(Config, '', 7, "empty host atom") + end, + t_connect_bad(Config, ".", 7, "root domain string"), + t_connect_bad(Config, '.', 7, "root domain atom"). + +t_connect_bad(Config, Host, Port, Descr) -> + {error, Reason} = + gen_tcp:connect(Host, Port,?INET_BACKEND_OPTS(Config)), + io:format( + "Error for connection attempt to " ++ Descr ++ ": ~p~n", + [Reason]), ok. @@ -1352,7 +1359,9 @@ do_simple_sockaddr_send_recv(SockAddr, _) -> %% we have to skip on that platform. s_accept_with_explicit_socket_backend(Config) when is_list(Config) -> ?TC_TRY(s_accept_with_explicit_socket_backend, - fun() -> is_socket_supported() end, + fun() -> + is_socket_supported() + end, fun() -> do_s_accept_with_explicit_socket_backend() end). do_s_accept_with_explicit_socket_backend() -> @@ -1385,8 +1394,11 @@ do_s_accept_with_explicit_socket_backend() -> is_socket_supported() -> try socket:info() of - _ -> - ok + #{io_backend := #{name := BackendName}} + when (BackendName =/= win_esaio) -> + ok; + _ -> + {skip, "Temporary exclusion"} catch error : notsup -> {skip, "esock not supported"}; |