[Tarantool-patches] [PATCH luajit 6/7] test: fix lua-Harness JIT-related tests
Igor Munkin
imun at tarantool.org
Tue Feb 28 22:01:54 MSK 2023
Sergey,
Thanks for your review! I've fixed both typos in commit message and
added the new patch at the bottom.
On 14.02.23, Sergey Kaplun wrote:
> Hi, Igor!
> Thanks for the patch!
> Please, consider my comment below.
>
> On 13.02.23, Igor Munkin wrote:
<snipped>
>
> I afraid that this check isn't fully correct either:
> `jit.status()` yields CPU-specific flags and JIT optimization flags.
> For ARM64 the subset of CPU-specific flags is empty. Hence, if someone
> runs the tests with `jit.opt.start(0)` to disable all JIT optimization
> this check will return false for LuaJIT compiled with JIT.
>
> | $ src/luajit -e 'jit.opt.start(0) print(jit.arch, jit.status(), select("#", jit.status()) > 1)'
> | arm64 true false
>
Ouch, you're right. I've fixed the issue the way you suggested below.
> Also, I found the easier way to check `LJ_HASJIT` is set or not.
> We can simply check the existance of `jit.opt` module:
>
> | $ src/luajit -e 'print(jit.opt)'
> | nil
>
<snipped>
> > --
> > 2.30.2
> >
>
> --
> Best regards,
> Sergey Kaplun
Here is the new patch:
================================================================================
test: fix lua-Harness JIT-related tests
lua-Harness considers whether JIT is enabled or not in the scope of the
403-jit.t and 411-luajit.t tests. However, the original condition is
wrong, since <jit.status> yields false for both cases, when JIT is just
turned off and when LuaJIT is built without compiler support. So, if
<jit.status> yields false, the latter case is considered. The condition
is fixed to differ both aforementioned cases in the following way: when
jit.opt is nil, LuaJIT is built without compiler; otherwise, JIT support
is on board.
Part of tarantool/tarantool#8252
diff --git a/test/lua-Harness-tests/403-jit.t b/test/lua-Harness-tests/403-jit.t
index 0f986da9..1a88564b 100755
--- a/test/lua-Harness-tests/403-jit.t
+++ b/test/lua-Harness-tests/403-jit.t
@@ -31,7 +31,7 @@ if not jit then
skip_all("only with LuaJIT")
end
-local compiled_with_jit = jit.status()
+local compiled_with_jit = jit.opt ~= nil
local luajit20 = jit.version_num < 20100 and not jit.version:match'RaptorJIT'
local has_jit_opt = compiled_with_jit
local has_jit_security = jit.security
diff --git a/test/lua-Harness-tests/411-luajit.t b/test/lua-Harness-tests/411-luajit.t
index 3a9a7b8f..6cfd6837 100755
--- a/test/lua-Harness-tests/411-luajit.t
+++ b/test/lua-Harness-tests/411-luajit.t
@@ -37,7 +37,7 @@ if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
skip_all("io.popen not supported")
end
-local compiled_with_jit = jit.status()
+local compiled_with_jit = jit.opt ~= nil
local has_jutil = pcall(require, 'jit.util')
local has_openresty_listing = profile.openresty or jit.version:match'moonjit'
================================================================================
--
Best regards,
IM
More information about the Tarantool-patches
mailing list