File 0109-erts-Fix-map_SUITE-t_map_compare-for-recursive-maps.patch of Package erlang
From 53425fe86955b76cc236b12f28236c09e1073827 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Thu, 23 Feb 2023 17:04:49 +0100
Subject: [PATCH] erts: Fix map_SUITE:t_map_compare for recursive maps
Don't cheat, use cmp() itself when sorting map keys
which may contain maps.
---
erts/emulator/test/map_SUITE.erl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index f2208fb6aa..e64311c2e5 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -1890,8 +1890,8 @@ cmp(M1, M2, Exact) ->
cmp_maps(M1, M2, Exact) ->
case {maps:size(M1),maps:size(M2)} of
{S,S} ->
- {K1,V1} = lists:unzip(term_sort(maps:to_list(M1))),
- {K2,V2} = lists:unzip(term_sort(maps:to_list(M2))),
+ {K1,V1} = lists:unzip(cmp_key_sort(maps:to_list(M1))),
+ {K2,V2} = lists:unzip(cmp_key_sort(maps:to_list(M2))),
case cmp(K1, K2, true) of
0 -> cmp(V1, V2, Exact);
@@ -1915,6 +1915,10 @@ cmp_others(T1, T2, _) ->
{false,false} -> 1
end.
+cmp_key_sort(L) ->
+ lists:sort(fun(A,B) -> cmp(A,B,true) =< 0 end,
+ L).
+
map_gen(Pairs, Size) ->
{_,L} = lists:foldl(fun(_, {Keys, Acc}) ->
KI = rand:uniform(size(Keys)),
--
2.35.3