Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>,
	Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit] test: fix misclib-getmetrics-lapi.test.lua
Date: Sat, 28 Sep 2024 13:33:59 +0300	[thread overview]
Message-ID: <20240928103359.16057-1-skaplun@tarantool.org> (raw)

When run under Tarantool, the test may fail if Tarantool already has
performed some finalize steps. This patch fixes it by making the test
more general.
---

Branch: https://github.com/tarantool/luajit/tree/skaplun/fix-getmetrics-lapi-test

 test/tarantool-tests/misclib-getmetrics-lapi.test.lua | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
index 741900b6..89aecf7b 100644
--- a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
+++ b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
@@ -132,8 +132,9 @@ test:test("gc-steps", function(subtest)
     subtest:ok(oldm.gc_steps_atomic > 0)
     subtest:ok(oldm.gc_steps_sweepstring > 0)
     subtest:ok(oldm.gc_steps_sweep > 0)
-    -- Nothing to finalize, skipped.
-    subtest:is(oldm.gc_steps_finalize, 0)
+    -- Nothing to finalize, skipped. Tarantool may perform some
+    -- finalize steps already, so just use the base test.
+    subtest:ok(oldm.gc_steps_finalize >= 0)
 
     -- As long as we stopped the GC, consequent call
     -- should return the same values:
@@ -144,7 +145,7 @@ test:test("gc-steps", function(subtest)
     subtest:is(newm.gc_steps_sweepstring - oldm.gc_steps_sweepstring, 0)
     subtest:is(newm.gc_steps_sweep - oldm.gc_steps_sweep, 0)
     -- Nothing to finalize, skipped.
-    subtest:is(newm.gc_steps_finalize, 0)
+    subtest:is(newm.gc_steps_finalize - oldm.gc_steps_finalize, 0)
     oldm = newm
 
     -- Now the last phase: run full GC once and make sure that
@@ -158,7 +159,7 @@ test:test("gc-steps", function(subtest)
     subtest:ok(newm.gc_steps_sweepstring - oldm.gc_steps_sweepstring >= 1)
     subtest:ok(newm.gc_steps_sweep  - oldm.gc_steps_sweep >= 1)
     -- Nothing to finalize, skipped.
-    subtest:is(newm.gc_steps_finalize, 0)
+    subtest:is(newm.gc_steps_finalize - oldm.gc_steps_finalize, 0)
     oldm = newm
 
     -- Now let's run three GC cycles to ensure that increment
@@ -174,7 +175,7 @@ test:test("gc-steps", function(subtest)
     subtest:ok(newm.gc_steps_sweepstring - oldm.gc_steps_sweepstring >= 3)
     subtest:ok(newm.gc_steps_sweep  - oldm.gc_steps_sweep >= 3)
     -- Nothing to finalize, skipped.
-    subtest:is(newm.gc_steps_finalize, 0)
+    subtest:is(newm.gc_steps_finalize - oldm.gc_steps_finalize, 0)
 end)
 
 test:test("objcount", function(subtest)
-- 
2.46.2


             reply	other threads:[~2024-09-28 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-28 10:33 Sergey Kaplun via Tarantool-patches [this message]
2024-10-01  9:42 ` Sergey Bronnikov via Tarantool-patches
2024-10-11 18:51 ` Maxim Kokryashkin via Tarantool-patches
2024-10-15  7:40   ` Sergey Kaplun via Tarantool-patches
2024-10-18 15:19 ` Sergey Kaplun via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240928103359.16057-1-skaplun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] test: fix misclib-getmetrics-lapi.test.lua' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox