Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
erlang
0179-Write-test-case.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0179-Write-test-case.patch of Package erlang
From cf78d19b0c213a329a00612d1d12feeda099a7bf Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Tue, 11 Feb 2020 17:01:57 +0100 Subject: [PATCH 2/2] Write test case --- lib/kernel/test/gen_udp_SUITE.erl | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 70d8caf478..2720d3cc77 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -35,7 +35,8 @@ -export([send_to_closed/1, active_n/1, buffer_size/1, binary_passive_recv/1, bad_address/1, - read_packets/1, open_fd/1, connect/1, implicit_inet6/1, + read_packets/1, recv_poll_after_active_once/1, + open_fd/1, connect/1, implicit_inet6/1, local_basic/1, local_unbound/1, local_fdopen/1, local_fdopen_unbound/1, local_abstract/1]). @@ -45,7 +46,8 @@ suite() -> all() -> [send_to_closed, buffer_size, binary_passive_recv, - bad_address, read_packets, open_fd, connect, + bad_address, read_packets, recv_poll_after_active_once, + open_fd, connect, implicit_inet6, active_n, {group, local}]. @@ -436,6 +438,27 @@ flush() -> end. +%% OTP-16059 +%% UDP recv with timeout 0 corrupts internal state so that after a +%% recv under {active, once} the UDP recv poll wastes incoming data +recv_poll_after_active_once(Config) when is_list(Config) -> + Msg1 = <<"Hej!">>, + Msg2 = <<"Hej igen!">>, + Addr = {127,0,0,1}, + {ok,S1} = gen_udp:open(0, [binary, {active, once}]), + {ok,P1} = inet:port(S1), + {ok,S2} = gen_udp:open(0, [binary, {active, false}]), + {ok,P2} = inet:port(S2), + ok = gen_udp:send(S2, Addr, P1, Msg1), + receive + {udp, S1, Addr, P2, Msg1} -> + {error, timeout} = gen_udp:recv(S1, 0, 0), + ok = gen_udp:send(S2, Addr, P1, Msg2), + receive after 500 -> ok end, % Give the kernel time to deliver + {ok, {Addr, P2, Msg2}} = gen_udp:recv(S1, 0, 0), + ok + end. + %% Test that the 'fd' option works. open_fd(Config) when is_list(Config) -> -- 2.16.4
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