Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0272-kernel-esock-test-Tweak-test-if-sctp-is-su...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0272-kernel-esock-test-Tweak-test-if-sctp-is-supported.patch of Package erlang
From ef56939dab7dc00005dbe55732c6bcf087a6c768 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Mon, 26 Apr 2021 16:41:51 +0200 Subject: [PATCH 2/3] [kernel|esock|test] Tweak test if sctp is supported --- lib/kernel/test/socket_SUITE.erl | 46 ++++++++++++++++++++++++----- lib/kernel/test/socket_test_lib.erl | 12 +++++--- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl index 6f5e778047..d2a7f02260 100644 --- a/lib/kernel/test/socket_SUITE.erl +++ b/lib/kernel/test/socket_SUITE.erl @@ -662,6 +662,8 @@ -define(TT(T), ct:timetrap(T)). -define(F(F, A), ?LIB:f(F, A)). +-define(P(F), ?LIB:print(F)). +-define(P(F, A), ?LIB:print(F, A)). -define(TPP_SMALL, lists:seq(1, 8)). @@ -25320,10 +25322,24 @@ reg_s_single_open_and_close_and_count() -> ] ++ case SupportsSCTP of true -> - [ - {inet, seqpacket, sctp}, - {inet, seqpacket, sctp} - ]; + %% On some platforms this is not enough, + %% we need to actually check this "by doing it"... + ?P("test open sctp socket"), + case socket:open(inet, + seqpacket, + sctp, + #{use_registry => false}) of + {ok, S} -> + ?P("test open sctp socket: success"), + (catch socket:close(S)), + [ + {inet, seqpacket, sctp}, + {inet, seqpacket, sctp} + ]; + {error, _} -> + ?P("test open sctp socket: failed"), + [] + end; false -> [] end ++ @@ -25333,10 +25349,24 @@ reg_s_single_open_and_close_and_count() -> ] ++ case SupportsSCTP andalso SupportsIPV6 of true -> - [ - {inet6, seqpacket, sctp}, - {inet6, seqpacket, sctp} - ]; + %% On some platforms this is not enough, + %% we need to actually check this "by doing it"... + ?P("test open sctp socket"), + case socket:open(inet6, + seqpacket, + sctp, + #{use_registry => false}) of + {ok, S6} -> + ?P("test open sctp socket: success"), + (catch socket:close(S6)), + [ + {inet6, seqpacket, sctp}, + {inet6, seqpacket, sctp} + ]; + {error, _} -> + ?P("test open sctp socket: failed"), + [] + end; false -> [] end, diff --git a/lib/kernel/test/socket_test_lib.erl b/lib/kernel/test/socket_test_lib.erl index 01b69953bc..15e5cae111 100644 --- a/lib/kernel/test/socket_test_lib.erl +++ b/lib/kernel/test/socket_test_lib.erl @@ -35,6 +35,7 @@ %% String and format f/2, + print/1, print/2, %% Generic 'has support' test function(s) has_support_ipv6/0, @@ -101,11 +102,7 @@ formated_timestamp() -> format_timestamp({_N1, _N2, _N3} = TS) -> {_Date, Time} = calendar:now_to_local_time(TS), - %% {YYYY,MM,DD} = Date, {Hour,Min,Sec} = Time, - %% FormatTS = - %% io_lib:format("~.4w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w.~w", - %% [YYYY, MM, DD, Hour, Min, Sec, N3]), FormatTS = io_lib:format("~.2.0w:~.2.0w:~.2.0w", [Hour, Min, Sec]), lists:flatten(FormatTS). @@ -116,6 +113,13 @@ f(F, A) -> lists:flatten(io_lib:format(F, A)). +print(F) -> + print(F, []). + +print(F, A) -> + io:format("~s ~p " ++ F ++ "~n", [formated_timestamp(), self() | A]). + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% has_support_ipv6() -> -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor