Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
3303-kernel-test-Tweaked-udp-read_packets-test-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3303-kernel-test-Tweaked-udp-read_packets-test-case.patch of Package erlang
From edb4e64db23d27f75754fbf8fccd6f016dcac6e2 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Tue, 6 Aug 2024 12:17:57 +0200 Subject: [PATCH 3/6] [kernel|test] Tweaked (udp) read_packets test case --- lib/kernel/test/gen_udp_SUITE.erl | 46 ++++++++++++++++++++++++----- lib/kernel/test/kernel_test_lib.hrl | 5 ++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 10f925dd6f..33188cbd73 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -808,20 +808,43 @@ read_packets(Config) when is_list(Config) -> true -> %% We have not (yet) implemented support for %% this option. We accept it but do not use it. + ?P("~w:cond -> skip", [?FUNCTION_NAME]), {skip, "Not compliant with socket"}; false -> + ?P("~w:cond -> run", [?FUNCTION_NAME]), ok end end, - TC = fun() -> + Pre = fun() -> + %% Try start/create a worker node + NName = ?UNIQ_NODE_NAME, + ?P("~w:pre -> try create node ~p", [?FUNCTION_NAME, NName]), + case start_node(NName) of + {ok, Node} -> + ?P("~w:pre -> node ~p started", + [?FUNCTION_NAME, Node]), + #{node => Node, + conf => Config}; + {error, Reason} -> + ?P("~w:pre -> Failed start node ~p" + "~n ~p", [?FUNCTION_NAME, NName, Reason]), + {skip, Reason} + end + end, + TC = fun(State) -> ?P("~w:tc -> begin", [?FUNCTION_NAME]), - Res = do_read_packets(Config), + Res = do_read_packets(State), ?P("~w:tc -> done", [?FUNCTION_NAME]), Res end, - ?TC_TRY(?FUNCTION_NAME, Cond, TC). + Post = fun(#{node := Node}) -> + ?P("~w:post -> stop node", [?FUNCTION_NAME]), + stop_node(Node) + end, + ?TC_TRY(?FUNCTION_NAME, Cond, Pre, TC, Post). -do_read_packets(Config) when is_list(Config) -> +do_read_packets(#{node := Node, + conf := Config}) when is_list(Config) -> N1 = 5, N2 = 1, Msgs = 30000, @@ -833,8 +856,6 @@ do_read_packets(Config) when is_list(Config) -> "~n Addr: ~p" "~n Port: ~p", [RA, RP]), - ?P("create slave node"), - {ok,Peer,Node} = ?CT_PEER(), %% ?P("perform read-packets test"), {V1, Trace1} = read_packets_test(Config, R, RA, RP, Msgs, Node), @@ -848,8 +869,6 @@ do_read_packets(Config) when is_list(Config) -> ?P("verify read-packets (to ~w)", [N2]), {ok, [{read_packets,N2}]} = inet:getopts(R, [read_packets]), %% - ?P("stop slave node"), - peer:stop(Peer), ?P("dump trace 1"), dump_terms(Config, "trace1.terms", Trace1), ?P("dump trace 2"), @@ -3321,6 +3340,17 @@ pi(Item) -> Val. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +start_node(Name) -> + Pa = filename:dirname(code:which(?MODULE)), + ?START_NODE(Name, "-pa " ++ Pa). + + +stop_node(Node) -> + ?STOP_NODE(Node). + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% diff --git a/lib/kernel/test/kernel_test_lib.hrl b/lib/kernel/test/kernel_test_lib.hrl index b3b8a6ba0a..7177e67706 100644 --- a/lib/kernel/test/kernel_test_lib.hrl +++ b/lib/kernel/test/kernel_test_lib.hrl @@ -60,6 +60,11 @@ -define(HAS_SUPPORT_IPV6(), ?LIB:has_support_ipv6()). -define(WHICH_LOCAL_ADDR(D), ?LIB:which_local_addr((D))). +-define(UNIQ_NODE_NAME, + list_to_atom(?MODULE_STRING ++ "__" ++ + atom_to_list(?FUNCTION_NAME) ++ "_" ++ + integer_to_list(erlang:unique_integer([positive])))). + -define(START_NODE(__N__, __A__), ?LIB:start_node(__N__, __A__)). -define(START_NODE(__N__, __A__, __O__), -- 2.43.0
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