Skip to content

Commit 3c8dbe2

Browse files
mkokryashkinigormunkin
authored andcommitted
test: fix flaky OOM error frame test
This test could do allocation outside of the protected frame, which could result in an uncaught OOM and test failure. This patch adds extra `collectgarbage` calls to the test to avoid such situations. Reviewed-by: Sergey Kaplun <[email protected]> Reviewed-by: Sergey Bronnikov <[email protected]> Signed-off-by: Igor Munkin <[email protected]>
1 parent 3526ebb commit 3c8dbe2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/tarantool-tests/lj-1004-oom-error-frame.test.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ test:plan(2)
1010

1111
local testoomframe = require('testoomframe')
1212

13+
collectgarbage()
14+
1315
local anchor_memory = {} -- luacheck: no unused
1416
local function eatchunks(size)
1517
while true do
@@ -34,6 +36,11 @@ local function chomp()
3436
end
3537

3638
local st, err = pcall(chomp)
39+
40+
-- Prevent OOM outside of the protected frame.
41+
anchor_memory = nil
42+
collectgarbage()
43+
3744
test:ok(st == false, 'on-trace error handled successfully')
3845
test:like(err, 'not enough memory', 'error is OOM')
3946
test:done(true)

0 commit comments

Comments
 (0)