Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0271-kernel-test-Tweaked-the-accept-system-limi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0271-kernel-test-Tweaked-the-accept-system-limit-test-cas.patch of Package erlang
From c5f470fee0ace568b6fbe146105eedceb65b30cc Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Mon, 26 Apr 2021 12:38:37 +0200 Subject: [PATCH 1/3] [kernel|test] Tweaked the 'accept-system-limit' test case --- lib/kernel/test/gen_tcp_misc_SUITE.erl | 47 +++++++++++++++++--------- lib/kernel/test/kernel_test_lib.hrl | 2 ++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index d099cc0864..381d5a33f0 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -4637,10 +4637,15 @@ do_accept_system_limit(Config) -> {error, eaddrnotavail = Reason} -> ?SKIPT(listen_failed_str(Reason)) end, - {ok, TcpPort} = inet:port(LS), + {ok, {Addr, Port}} = inet:sockname(LS), + ?P("listen socket \"bound\" to:" + "~n Address: ~p" + "~n Port: ~p", [Addr, Port]), Me = self(), ?P("create connector"), - Connector = spawn_link(fun () -> connector(Config, TcpPort, Me) end), + Connector = spawn_link(fun() -> + connector(Config, Port, Me) + end), ?P("sync with connector (~p)", [Connector]), receive {Connector, sync} -> Connector ! {self(), continue} end, ?P("begin accepting"), @@ -4657,33 +4662,43 @@ acceptor(Connector, LS, GotSL, A) -> {error, eaddrnotavail = Reason} -> ?SKIPE(accept_failed_str(Reason)); {error, system_limit} -> - ?P("acceptor: system limit => *almost* done (~w)", [length(A)]), + ?P("acceptor: " + "system limit => *almost* done (~w)", [length(A)]), acceptor(Connector, LS, true, A); {error, timeout} when GotSL -> ?P("acceptor: timeout (with system limit) => done (~w)", - [length(A)]), + [length(A)]), ok; {error, timeout} -> + ?P("acceptor: timeout *without* system limit => failure" + "~n Number of Accepted: ~w", + [length(A)]), error end. -connector(Config, TcpPort, Tester) -> +connector(Config, AccPort, Tester) -> ?P("[connector] start"), ManyPorts = open_ports([]), + ?P("[connector] length(ManyPorts): ~p", [length(ManyPorts)]), Tester ! {self(), sync}, - ?P("[connector] sync with tester (~p)", [Tester]), + ?P("[connector] await continute from tester (~p)", [Tester]), receive {Tester, continue} -> timer:sleep(100) end, ?P("[connector] begin connecting"), - ConnF = fun (Port) -> - case (catch ?CONNECT(Config, {127,0,0,1}, TcpPort, [])) of - {ok, Sock} -> - Sock; - {error, eaddrnotavail = Reason} -> - ?SKIPE(connect_failed_str(Reason)); - _Error -> - port_close(Port) - end - end, + ConnF = + fun(Port) -> + case (catch ?CONNECT(Config, {127,0,0,1}, AccPort)) of + {ok, Sock} -> + ?P("[connector] success: " + "~n ~p", [Sock]), + Sock; + {error, eaddrnotavail = Reason} -> + ?SKIPE(connect_failed_str(Reason)); + _Error -> + ?P("[connector] failure: " + "~n ~p", [_Error]), + port_close(Port) + end + end, R = [ConnF(Port) || Port <- lists:sublist(ManyPorts, 10)], ?P("[connector] await stop"), receive stop -> ?P("[connector] stop (~w)", [length(R)]), R end. diff --git a/lib/kernel/test/kernel_test_lib.hrl b/lib/kernel/test/kernel_test_lib.hrl index d49c31f4d6..74b5fa86a0 100644 --- a/lib/kernel/test/kernel_test_lib.hrl +++ b/lib/kernel/test/kernel_test_lib.hrl @@ -34,6 +34,8 @@ -define(TC_TRY(Case, Cond, TC), ?LIB:tc_try(Case, Cond, TC)). -define(LISTEN(C, P, O), ?LIB:listen(C, P, O)). +-define(CONNECT(__C__, __H__, __P__), + ?LIB:connect(__C__, __H__, __P__, [])). -define(CONNECT(__C__, __H__, __P__, __O__), ?LIB:connect(__C__, __H__, __P__, __O__)). -define(CONNECT(__C__, __H__, __P__, __O__, __T__), -- 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