[Tarantool-patches] [PATCH luajit 3/2] test: remove TAP side effects in getmetrics tests

Igor Munkin imun at tarantool.org
Fri Dec 2 13:01:44 MSK 2022


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 at 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



More information about the Tarantool-patches mailing list