From 2d11a8344b46323febc089f933343634d403f3ad Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 11 Sep 2024 18:03:08 +0200 Subject: [PATCH 1/7] [kernel|test] Unix flavors skip exceptions --- lib/kernel/test/net_SUITE.erl | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/kernel/test/net_SUITE.erl b/lib/kernel/test/net_SUITE.erl index 12eb8982db92..1760094935db 100644 --- a/lib/kernel/test/net_SUITE.erl +++ b/lib/kernel/test/net_SUITE.erl @@ -462,8 +462,11 @@ api_b_getservbyname() -> wrong_port("amqp", tcp, WrongPort, 5672); {error, Reason} -> case os:type() of - {unix, openbsd} - when (Reason =:= einval) -> + {unix, Flavor} + when ((Flavor =:= openbsd) orelse + (Flavor =:= solaris) orelse + (Flavor =:= sunos)) andalso + (Reason =:= einval) -> ok; _ -> ?P("Unexpected failure: ~p", @@ -480,11 +483,12 @@ api_b_getservbyname() -> wrong_port("amqp", sctp, WrongPort, 5672); {error, Reason} -> case os:type() of - {unix, darwin} - when (Reason =:= einval) -> - ok; - {unix, openbsd} - when (Reason =:= einval) -> + {unix, Flavor} + when ((Flavor =:= darwin) orelse + (Flavor =:= openbsd) orelse + (Flavor =:= solaris) orelse + (Flavor =:= sunos)) andalso + (Reason =:= einval) -> ok; _ -> ?P("Unexpected failure: ~p", @@ -642,8 +646,11 @@ api_b_getservbyport() -> WrongService, "amqp"); {error, Reason} -> case os:type() of - {unix, openbsd} - when (Reason =:= einval) -> + {unix, Flavor} + when ((Flavor =:= openbsd) orelse + (Flavor =:= solaris) orelse + (Flavor =:= sunos)) andalso + (Reason =:= einval) -> ok; _ -> ?P("Unexpected failure: ~p", @@ -661,9 +668,11 @@ api_b_getservbyport() -> WrongService, "amqp"); {error, Reason} when (Reason =:= einval) -> case os:type() of - {unix, UNIX} - when (UNIX =:= darwin) orelse - (UNIX =:= openbsd) -> + {unix, Flavor} + when (Flavor =:= darwin) orelse + (Flavor =:= openbsd) orelse + (Flavor =:= solaris) orelse + (Flavor =:= sunos) -> ok; _ -> ?P("Unexpected failure: ~p", From fd41f76c529b590f8d82e3747f6f3c81385a3b9e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 18 Sep 2024 07:37:50 +0200 Subject: [PATCH 2/7] [kernel|test] Add skip for flakey os --- lib/kernel/test/socket_traffic_SUITE.erl | 27 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/kernel/test/socket_traffic_SUITE.erl b/lib/kernel/test/socket_traffic_SUITE.erl index 215bcdf302f4..8ccde82a885d 100644 --- a/lib/kernel/test/socket_traffic_SUITE.erl +++ b/lib/kernel/test/socket_traffic_SUITE.erl @@ -4806,6 +4806,7 @@ traffic_ping_pong_large_sendmsg_and_recvmsg_sctp4(Config) tc_try(?FUNCTION_NAME, fun() -> is_not_windows(), + is_not_flakey_os(), has_support_ipv4(), has_support_sctp(), traffic_ping_pong_large_sendmsg_and_recvmsg_cond() @@ -4837,6 +4838,7 @@ traffic_ping_pong_large_sendmsg_and_recvmsg_sctp6(Config) tc_try(?FUNCTION_NAME, fun() -> is_not_windows(), + is_not_flakey_os(), has_support_ipv6(), has_support_sctp(), traffic_ping_pong_large_sendmsg_and_recvmsg_cond() @@ -7039,13 +7041,13 @@ is_slow_ubuntu(Config) -> end. -is_not_solaris() -> - case os:type() of - {unix, solaris} -> - skip("Solaris"); - _ -> - ok - end. +%% is_not_solaris() -> +%% case os:type() of +%% {unix, solaris} -> +%% skip("Solaris"); +%% _ -> +%% ok +%% end. is_not_windows() -> case os:type() of @@ -7055,6 +7057,17 @@ is_not_windows() -> ok end. +is_not_flakey_os() -> + is_not_flakey_os(erlang:system_info(system_architecture)). + +is_not_flakey_os("sparc-sun-solaris2.10") -> + skip(flakey); +is_not_flakey_os("x86_64-pc-solaris2.11") -> + skip(flakey); +is_not_flakey_os(_) -> + ok. + + has_support_unix_domain_socket() -> case socket:is_supported(local) of true -> From 0f0d22b511963c04767b20fac51ae3ec5e195e5a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 30 Sep 2024 10:59:52 +0200 Subject: [PATCH 3/7] [kernel|test] Add factor limit and node start checks Add a factor limit test during (socket) suite init. Also add more detailed check during node start, so that failure to start a node will 'skip' the test case, not fail. --- lib/kernel/test/kernel_test_lib.erl | 12 ++++++++++++ lib/kernel/test/kernel_test_lib.hrl | 2 ++ lib/kernel/test/socket_SUITE.erl | 10 ++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/kernel/test/kernel_test_lib.erl b/lib/kernel/test/kernel_test_lib.erl index 079aeefe33a4..ae6a69af0bc1 100644 --- a/lib/kernel/test/kernel_test_lib.erl +++ b/lib/kernel/test/kernel_test_lib.erl @@ -49,6 +49,8 @@ -export([ proxy_call/3, + ensure_not_dog_slow/2, + %% Generic 'has support' test function(s) is_socket_supported/0, has_support_ipv4/0, @@ -2706,6 +2708,16 @@ proxy_call(F, Timeout, Default) +ensure_not_dog_slow(Config, Limit) -> + Key = kernel_factor, + case lists:keysearch(Key, 1, Config) of + {value, {Key, Value}} when (Value > Limit) -> + skip({factor_limit, Value, Limit}); + _ -> + ok + end. + + %% This is an extremely simple check... has_support_ipv4() -> case which_local_addr(inet) of diff --git a/lib/kernel/test/kernel_test_lib.hrl b/lib/kernel/test/kernel_test_lib.hrl index 7177e6770627..dde4d53dfae6 100644 --- a/lib/kernel/test/kernel_test_lib.hrl +++ b/lib/kernel/test/kernel_test_lib.hrl @@ -56,6 +56,8 @@ -define(WHICH_INET_BACKEND(C), ?LIB:which_inet_backend(C)). -define(IS_SOCKET_BACKEND(C), ?LIB:is_socket_backend(C)). +-define(ENSURE_NOT_DOG_SLOW(C, L), ?LIB:ensure_not_dog_slow((C), (L))). + -define(HAS_SUPPORT_IPV4(), ?LIB:has_support_ipv4()). -define(HAS_SUPPORT_IPV6(), ?LIB:has_support_ipv6()). -define(WHICH_LOCAL_ADDR(D), ?LIB:which_local_addr((D))). diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl index 4ec9209656fe..01d8abfef5bd 100644 --- a/lib/kernel/test/socket_SUITE.erl +++ b/lib/kernel/test/socket_SUITE.erl @@ -411,6 +411,8 @@ init_per_suite(Config0) -> ?P("init_per_suite -> end when " "~n Config: ~p", [Config1]), + ?ENSURE_NOT_DOG_SLOW(Config1, 15), + %% We need a monitor on this node also kernel_test_sys_monitor:start(), @@ -12682,8 +12684,12 @@ start_node(Name, Timeout) when is_integer(Timeout) andalso (Timeout > 0) -> ?SEV_IPRINT("Started node ~p - now (global) sync", [Name]), global:sync(), % Again, just in case... ?SEV_IPRINT("ping proxy"), - pong = ?PPING(Node), - {Peer, Node}; + case ?PPING(Node) of + {error, Reason} -> + skip({ping_failed, Reason}); + pong_ -> + {Peer, Node} + end; {error, Reason} -> ?SEV_EPRINT("failed starting node ~p (=> SKIP):" "~n ~p", [Name, Reason]), From 317b34c75110ad1db0e7e51c361fc8008a55c9b9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 30 Sep 2024 11:02:01 +0200 Subject: [PATCH 4/7] [kernel|test] Skip sctp tc for flakey os --- lib/kernel/test/socket_traffic_SUITE.erl | 38 ++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/kernel/test/socket_traffic_SUITE.erl b/lib/kernel/test/socket_traffic_SUITE.erl index 8ccde82a885d..e992e8350f58 100644 --- a/lib/kernel/test/socket_traffic_SUITE.erl +++ b/lib/kernel/test/socket_traffic_SUITE.erl @@ -475,6 +475,7 @@ traffic_send_and_recv_counters_sctp4(_Config) when is_list(_Config) -> ?TT(?SECS(15)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv4(), has_support_sctp() end, @@ -497,6 +498,7 @@ traffic_send_and_recv_counters_sctp6(_Config) when is_list(_Config) -> ?TT(?SECS(15)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv6(), has_support_sctp() end, @@ -612,6 +614,7 @@ traffic_sendmsg_and_recvmsg_counters_sctp4(_Config) when is_list(_Config) -> ?TT(?SECS(15)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv4(), has_support_sctp() @@ -645,6 +648,7 @@ traffic_sendmsg_and_recvmsg_counters_sctp6(_Config) when is_list(_Config) -> ?TT(?SECS(15)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv6(), has_support_sctp() @@ -2770,6 +2774,7 @@ traffic_send_and_recv_chunks_sctp4(_Config) when is_list(_Config) -> ?TT(?SECS(30)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv4(), has_support_sctp() end, @@ -2792,6 +2797,7 @@ traffic_send_and_recv_chunks_sctp6(_Config) when is_list(_Config) -> ?TT(?SECS(30)), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv6(), has_support_sctp() end, @@ -3903,6 +3909,7 @@ traffic_ping_pong_small_send_and_recv_sctp4(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_SMALL_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv4(), has_support_sctp() end, @@ -3932,6 +3939,7 @@ traffic_ping_pong_small_send_and_recv_sctp6(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_SMALL_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv6(), has_support_sctp() end, @@ -4037,6 +4045,7 @@ traffic_ping_pong_medium_send_and_recv_sctp4(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_MEDIUM_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv4(), has_support_sctp() end, @@ -4065,6 +4074,7 @@ traffic_ping_pong_medium_send_and_recv_sctp6(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_MEDIUM_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), has_support_ipv6(), has_support_sctp() end, @@ -4180,10 +4190,11 @@ traffic_ping_pong_large_send_and_recv_sctp4(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_LARGE_NUM), tc_try(?FUNCTION_NAME, fun() -> - has_support_ipv4(), - has_support_sctp(), + is_not_flakey_os(), is_old_fedora16(), is_slow_ubuntu(Config), + has_support_ipv4(), + has_support_sctp(), traffic_ping_pong_large_host_cond() end, fun() -> @@ -4212,10 +4223,11 @@ traffic_ping_pong_large_send_and_recv_sctp6(Config) when is_list(Config) -> Num = ?TPP_NUM(Config, ?TPP_LARGE_NUM), tc_try(?FUNCTION_NAME, fun() -> - has_support_ipv6(), - has_support_sctp(), + is_not_flakey_os(), is_old_fedora16(), - is_slow_ubuntu(Config) + is_slow_ubuntu(Config), + has_support_ipv6(), + has_support_sctp() end, fun() -> InitState = #{domain => inet6, @@ -4501,6 +4513,7 @@ traffic_ping_pong_small_sendmsg_and_recvmsg_sctp4(Config) Num = ?TPP_NUM(Config, ?TPP_SMALL_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv4(), has_support_sctp() @@ -4531,6 +4544,7 @@ traffic_ping_pong_small_sendmsg_and_recvmsg_sctp6(Config) Num = ?TPP_NUM(Config, ?TPP_SMALL_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv6(), has_support_sctp() @@ -4647,6 +4661,7 @@ traffic_ping_pong_medium_sendmsg_and_recvmsg_sctp4(Config) Num = ?TPP_NUM(Config, ?TPP_MEDIUM_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv4(), has_support_sctp() @@ -4677,6 +4692,7 @@ traffic_ping_pong_medium_sendmsg_and_recvmsg_sctp6(Config) Num = ?TPP_NUM(Config, ?TPP_MEDIUM_NUM), tc_try(?FUNCTION_NAME, fun() -> + is_not_flakey_os(), is_not_windows(), has_support_ipv6(), has_support_sctp() @@ -7041,14 +7057,6 @@ is_slow_ubuntu(Config) -> end. -%% is_not_solaris() -> -%% case os:type() of -%% {unix, solaris} -> -%% skip("Solaris"); -%% _ -> -%% ok -%% end. - is_not_windows() -> case os:type() of {win32, nt} -> @@ -7061,9 +7069,9 @@ is_not_flakey_os() -> is_not_flakey_os(erlang:system_info(system_architecture)). is_not_flakey_os("sparc-sun-solaris2.10") -> - skip(flakey); + skip('flakey os'); is_not_flakey_os("x86_64-pc-solaris2.11") -> - skip(flakey); + skip('flakey os'); is_not_flakey_os(_) -> ok. From c79517a65be20123bf2f4dbf3602760b0a3d2483 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Oct 2024 08:48:14 +0200 Subject: [PATCH 5/7] [kernel|test] Spelling... --- lib/kernel/test/socket_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl index 01d8abfef5bd..0dc6c0b1f6de 100644 --- a/lib/kernel/test/socket_SUITE.erl +++ b/lib/kernel/test/socket_SUITE.erl @@ -12687,7 +12687,7 @@ start_node(Name, Timeout) when is_integer(Timeout) andalso (Timeout > 0) -> case ?PPING(Node) of {error, Reason} -> skip({ping_failed, Reason}); - pong_ -> + pong -> {Peer, Node} end; {error, Reason} -> From cebfd54041a8a1854e8cdefdf304e6c87989468c Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 15 Nov 2024 16:43:09 +0100 Subject: [PATCH 6/7] [kernel|test] Skip bidirectional traffic tc on SonOS --- lib/kernel/test/gen_tcp_misc_SUITE.erl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 24827a2a8300..28ab5117344f 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -8409,6 +8409,8 @@ bidirectional_traffic(Config) when is_list(Config) -> true -> {skip, "Inet driver specific test"}; false -> + %% Unstable on our Solaris/SunOS machine(s) + is_not_sunos(), ok end end, @@ -9406,7 +9408,24 @@ is_platform(Family, Name, PlatformStr) _ -> skip("Require " ++ PlatformStr) end. - + +is_not_sunos() -> + is_not_unix(sunos, "SunOS"). + +is_not_unix(Name, PlatformStr) -> + is_not_platform(unix, Name, PlatformStr). + +is_not_platform(Family, Name, PlatformStr) + when is_atom(Family) andalso + is_atom(Name) andalso + is_list(PlatformStr) -> + case os:type() of + {Family, Name} -> + skip("Require *not* " ++ PlatformStr); + _ -> + ok + end. + is_socket_supported() -> try socket:info() of From 02dfa1d51392a8e75d0c9f32ba3520b3a308a97c Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 20 Nov 2024 07:03:14 +0100 Subject: [PATCH 7/7] [kernel|test] Fixes and cosmetics Fixed init_per_testcase for names_multihoming_ipv4. Also added some printouts to the 's_loop' for the send_block test case. --- lib/kernel/test/gen_sctp_SUITE.erl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index 9adb49dc0de5..1c727a99f2b8 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -185,7 +185,7 @@ init_per_testcase(api_connectx_init = Case, Config) -> init_per_testcase(t_simple_local_sockaddr_in_connectx_init = Case, Config) -> check_sctp_connectx(Case, Config); init_per_testcase(names_multihoming_ipv4 = Case, Config) -> - case lists:keylookup(label, 1, Config) of + case lists:keysearch(label, 1, Config) of {value, {label, docker}} -> {skip, "Unstable/broken on docker"}; _ -> @@ -2604,16 +2604,22 @@ s_start(Starter, Timeout) -> s_loop(Socket, Timeout, Parent, State) -> receive {?MODULE,AMref,{controlling_process, NewParent}} -> + ?P("received (new) controlling process: " + "~n ~p", [NewParent]), AMref ! {?MODULE,AMref,ok}, s_loop(Socket, Timeout, NewParent, State); {?MODULE,AMref,close} -> % socket_close() + ?P("received close"), erlang:send_after(Timeout, self(), {?MODULE,AMref,exit}), s_loop(Socket, Timeout, Parent, State); {?MODULE,AMref,exit} -> + ?P("received exit"), ok = gen_sctp:close(Socket), NewState = gb_push(exit, Socket, State), AMref ! {?MODULE,AMref,{NewState,flush()}}; {?MODULE,AMref,{Req}} -> + ?P("received request: " + "~n ~p", [Req]), Result = s_handle_req(Socket, Req), NewState = gb_push(req, {Req,Result}, State), AMref ! {?MODULE, AMref,Result}, @@ -2624,6 +2630,9 @@ s_loop(Socket, Timeout, Parent, State) -> {sctp,Socket,Addr,Port, {[#sctp_sndrcvinfo{stream=Stream,assoc_id=AssocId}=SRI],Data}} when not is_tuple(Data) -> + ?P("received [sctp] snd/rcv info: " + "~n Stream: ~p" + "~n AssocId: ~p", [Stream, AssocId]), case gb_get({assoc_change,AssocId}, State) of [{Addr,Port, #sctp_assoc_change{ @@ -2639,6 +2648,10 @@ s_loop(Socket, Timeout, Parent, State) -> s_loop(Socket, Timeout, Parent, NewState); {sctp,Socket,Addr,Port, {SRI,#sctp_assoc_change{assoc_id=AssocId,state=St}=SAC}} -> + ?P("received [sctp] assoc change: " + "~n AssocId: ~p" + "~n St: ~p" + "~n SRI: ~p", [AssocId, St, SRI]), case SRI of [#sctp_sndrcvinfo{assoc_id=AssocId,stream=0}] -> ok; [] -> ok @@ -2657,6 +2670,10 @@ s_loop(Socket, Timeout, Parent, State) -> {SRI,#sctp_paddr_change{assoc_id=AssocId, addr={_,P}, state=St}=SPC}} -> + ?P("received [sctp] paddr change: " + "~n AssocId: ~p" + "~n P: ~p" + "~n St: ~p", [AssocId, P, St]), match_unless_solaris(Port, P), case SRI of [#sctp_sndrcvinfo{assoc_id=AssocId,stream=0}] -> ok; @@ -2674,6 +2691,9 @@ s_loop(Socket, Timeout, Parent, State) -> s_loop(Socket, Timeout, Parent, NewState); {sctp,Socket,Addr,Port, {SRI,#sctp_shutdown_event{assoc_id=AssocId}=SSE}} -> + ?P("received [sctp] shutdown event: " + "~n AssocId: ~p" + "~n SRI: ~p", [AssocId, SRI]), case SRI of [#sctp_sndrcvinfo{assoc_id=AssocId,stream=0}] -> ok; [] -> ok @@ -2688,6 +2708,11 @@ s_loop(Socket, Timeout, Parent, State) -> again(Socket), s_loop(Socket, Timeout, Parent, NewState); Unexpected -> + ?P("received unexpected message: " + "~n ~p" + "~nwhen" + "~n Socket Info: ~p", + [Unexpected, inet:info(Socket)]), erlang:error({unexpected,Unexpected}) end.