From f15ea40575cc4062e6e8bea01e917dca431b46ee Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sun, 22 Nov 2026 19:23:40 +0100 Subject: [PATCH] test(scripting): the image memory test makes fewer images, to finish in time under coverage (#427) The dropped images were 20 of 64 MB, each filled pixel by pixel. Under the GCC -O0 --coverage build that sometimes took longer than the 20 s a screen has to draw, so the check got -1. 4 dropped images, twice the memory of a screen, still prove that dropped images don't count. --- tests/unit/test_script_screen_host.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_script_screen_host.cpp b/tests/unit/test_script_screen_host.cpp index 6add4f008..dc1cfa2f8 100644 --- a/tests/unit/test_script_screen_host.cpp +++ b/tests/unit/test_script_screen_host.cpp @@ -1239,7 +1239,10 @@ return { } )"}; -// white when the images a screen holds are held to its memory, and the images it dropped don't count +// white when the images a screen holds are held to its memory, and the images it dropped don't count. an image of +// 4096 x 4096 is 64 MB, half the memory of a screen: the second one kept is refused, and the 4 dropped ones (twice +// the memory) would be refused too if the dropped ones counted. no more of them: each is filled pixel by pixel, slowly +// in the coverage build (GCC -O0 --coverage), and with 20 of them the screen sometimes didn't draw in its 20 s there constexpr std::string_view image_memory_script{R"( local kept = {} local ok, message = pcall(function() @@ -1248,7 +1251,7 @@ end) local refused = not ok and message:find("memory limit exceeded", 1, true) ~= nil and #kept < 100 kept = nil local dropped = pcall(function() - for i = 1, 20 do local image = eu07.image(4096, 4096) end + for i = 1, 4 do local image = eu07.image(4096, 4096) end end) return { render = function(state)