File 3302-kernel-test-Tweaked-gen_tcp-misc-suite.patch of Package erlang
From cb59cb04f8728d94ac751a553f87c1a546dd6da8 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 29 Jul 2024 17:00:33 +0200
Subject: [PATCH 2/6] [kernel|test] Tweaked gen_tcp misc suite
---
lib/kernel/test/gen_tcp_misc_SUITE.erl | 27 ++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index d57ae645e8..8b8f109776 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -1808,6 +1808,8 @@ do_sort(Config, Addr, P, List0) ->
?SKIPT(connect_failed_str(Reason))
end,
%% ok = inet:setopts(S, [{debug, true}]),
+ ?P("Send Lines: "
+ "~n ~p", [List]),
send_lines(S, List),
ok = gen_tcp:shutdown(S, write),
Lines = collect_lines(S, true),
@@ -1816,7 +1818,19 @@ do_sort(Config, Addr, P, List0) ->
SortedLines = lists:sort(List),
?P("Sorted: "
"~n ~p", [SortedLines]),
- Lines = SortedLines,
+ case SortedLines of
+ Lines ->
+ ok;
+ _ ->
+ LmSL = Lines -- SortedLines,
+ SLmL = SortedLines -- Lines,
+ ?P("Not identical after sorting:"
+ "~n Lines -- SortedLines: "
+ "~n ~p"
+ "~n SortedLines -- Lines: "
+ "~n ~p", [LmSL, SLmL]),
+ Lines = SortedLines
+ end,
ok = gen_tcp:close(S).
sort_server(Config, Addr, Active) ->
@@ -1831,6 +1845,7 @@ sort_server(Config, Addr, Active) ->
{ok,Port} = inet:port(L),
Port.
+%% Acceptor loop
sort_server_1(L, Active) ->
{ok,S} = gen_tcp:accept(L),
Go = make_ref(),
@@ -1839,9 +1854,17 @@ sort_server_1(L, Active) ->
Sorter ! Go,
sort_server_1(L, Active).
+%% Sorter
sorter(S, Active) ->
+ ?P("[sorter] try receive lines for sorting"),
Lines = collect_lines(S, Active),
- send_lines(S, lists:sort(Lines)),
+ SortedLines = lists:sort(Lines),
+ ?P("[sorter]"
+ "~n received Lines: "
+ "~n ~p"
+ "~n (send) sorted Lines: "
+ "~n ~p", [Lines, SortedLines]),
+ send_lines(S, SortedLines),
gen_tcp:shutdown(S, write),
gen_tcp:close(S).
--
2.43.0