File 1284-Modify-test-to-verify-that-chunk_step-can-step-into-.patch of Package erlang

From c9f9fe759da099558a0c19c2065556d627d5ccd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= <michal@erlang.org>
Date: Fri, 25 Apr 2025 13:52:17 +0200
Subject: [PATCH 4/4] Modify test to verify that chunk_step can step into
 previos max log file

---
 lib/kernel/test/disk_log_SUITE.erl | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl
index 2859bb1569..4feaf3e0ad 100644
--- a/lib/kernel/test/disk_log_SUITE.erl
+++ b/lib/kernel/test/disk_log_SUITE.erl
@@ -4207,23 +4207,27 @@ otp_16809(Conf) when is_list(Conf) ->
 
 decrease_size_with_chunk_step(Conf) when is_list(Conf) ->
     Dir = ?privdir(Conf),
-    Log = test,
+    Log = decrease_size_with_chunk_step,
     File = filename:join(Dir, lists:concat([Log, ".LOG"])),
-    {ok, test} = disk_log:open([{size, {1000, 3}}, {name,Log},{type, wrap},
-                                {file, File}, {notify, true}]),
-    eof = disk_log:chunk(Log,start,1),
-    {error, end_of_log} = disk_log:chunk_step(Log,start,1),
-    [disk_log:log(Log, X) || X <- lists:seq(1, 1000)],
+    {ok, Log} = disk_log:open([{size, {50, 3}}, {name, Log}, {type, wrap},
+                               {file, File}, {notify, true}]),
+    eof = disk_log:chunk(Log, start, 1),
+    {error, end_of_log} = disk_log:chunk_step(Log, start, 1),
+    ok = disk_log:log_terms(Log, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
     ok = disk_log:close(Log),
-    {ok, test} = disk_log:open([{name, Log}, {type, wrap}, {file, File},
-                                {notify, true}]),
-    %% Decrease maximum number of files from 10 to 2.
-    ok = disk_log:change_size(Log, {1000, 2}),
+    {ok, Log} = disk_log:open([{name, Log}, {type, wrap}, {file, File},
+                               {notify, true}]),
+    %% Decrease maximum number of files from 3 to 2.
+    ok = disk_log:change_size(Log, {50, 2}),
     %% The exception error of rem/2 operator should not occur in here.
-    {ok, _} = disk_log:chunk_step(Log, start, 1),
+    {ok, Cont} = disk_log:chunk_step(Log, start, 2),
+    %% Verify that chunk_step has stepped to old max file (3)
+    {_, [7, 8, 9]} = disk_log:chunk(Log, Cont),
     %% Continue to append the items to the log in order to make sure it can work
     %% as normal.
-    [disk_log:log(Log, X) || X <- lists:seq(1, 5000)],
+    ok = disk_log:log_terms(Log, [9, 8, 7, 6, 5, 4, 3, 2, 1]),
+    %% Verify that log files were decreased to 2 after wrapping
+    [6, 5, 4, 3, 2, 1] = get_all_terms(Log),
     ok = disk_log:close(Log),
     del(File, 2).
 
-- 
2.43.0

openSUSE Build Service is sponsored by