Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 3/2] test: remove TAP side effects in getmetrics tests
Date: Fri,  2 Dec 2022 13:01:44 +0300	[thread overview]
Message-ID: <747403a67925a8c09148cd10ea3514b5f6766395.1669926435.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1669926435.git.imun@tarantool.org>

Sometimes TAP functions become hot spots for JIT compiler and the
corresponding traces spoils test assertions with their side effects.
To avoid such misbehaviour and fix fragile test, <misc.getmetrics> is
explicitly called in this particular case. There is no need to fix the
corresponding test for Lua C API interface, since there is no TAP
helpers used to check whether <jit_snap_restore> is counted right. There
is also no need to fix other subtests nearby, since their assertions are
no affected by TAP helpers side effects.

Relates to tarantool/tarantool#7762

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 test/tarantool-tests/misclib-getmetrics-lapi.test.lua | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
index 19dfd199..0c170d0c 100644
--- a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
+++ b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua
@@ -363,7 +363,9 @@ test:test("snap-restores-scalar", function(subtest)
     -- No exits triggering snap restore so far: snapshot
     -- restoration was inlined into the machine code.
     subtest:is(new_metrics.jit_snap_restore - old_metrics.jit_snap_restore, 0)
-    old_metrics = new_metrics
+    -- XXX: obtain actual metrics to avoid side effects that are
+    -- caused by Lua code and JIT engine fine tuning above.
+    old_metrics = misc.getmetrics()
 
     -- Simply 2 side exits from the trace:
     foo(20)
-- 
2.34.0


  parent reply	other threads:[~2022-12-02 10:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 20:28 [Tarantool-patches] [PATCH luajit 0/2] Fix tests for LUAJIT_ENABLE_CHECKHOOK Igor Munkin via Tarantool-patches
2022-12-01 20:28 ` [Tarantool-patches] [PATCH luajit 1/2] test: relax JIT setup in lj-430-maxirconst test Igor Munkin via Tarantool-patches
2022-12-05  7:52   ` Sergey Kaplun via Tarantool-patches
2022-12-05 21:33     ` Igor Munkin via Tarantool-patches
2022-12-05 10:47   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:34     ` Igor Munkin via Tarantool-patches
2022-12-01 20:28 ` [Tarantool-patches] [PATCH luajit 2/2] test: relax JIT setup in misc.getmetrics test Igor Munkin via Tarantool-patches
2022-12-05  7:57   ` Sergey Kaplun via Tarantool-patches
2022-12-05 21:40     ` Igor Munkin via Tarantool-patches
2022-12-05 10:52   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:40     ` Igor Munkin via Tarantool-patches
2022-12-02 10:01 ` Igor Munkin via Tarantool-patches [this message]
2022-12-05  8:01   ` [Tarantool-patches] [PATCH luajit 3/2] test: remove TAP side effects in getmetrics tests Sergey Kaplun via Tarantool-patches
2022-12-05 21:46     ` Igor Munkin via Tarantool-patches
2022-12-05 11:06   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:47     ` Igor Munkin via Tarantool-patches
2022-12-02 10:05 ` [Tarantool-patches] [PATCH luajit 0/2] Fix tests for LUAJIT_ENABLE_CHECKHOOK Igor Munkin via Tarantool-patches
2022-12-12  9:42 ` Igor Munkin 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=747403a67925a8c09148cd10ea3514b5f6766395.1669926435.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 3/2] test: remove TAP side effects in getmetrics tests' \
    /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