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

Maxim Kokryashkin m.kokryashkin at tarantool.org
Mon Dec 5 14:06:51 MSK 2022


Hi, Igor!
Thanks for the patch!
LGTM, except for the nits Sergey has already mentioned
and the two additional nits below.
 
> 
>>Sometimes TAP functions become hot spots for JIT compiler and the
>Typo: s/for JIT compiler/for the JIT compiler/
>>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.
>Typo: s/no/not/
>>
>>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
>--
>Best regards,
>Maxim Kokryashkin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20221205/a9eee9a8/attachment.htm>


More information about the Tarantool-patches mailing list