[Tarantool-patches] [PATCH v2 luajit 0/5] Adapt lua-Harness test suite

Igor Munkin imun at tarantool.org
Wed Mar 17 03:46:24 MSK 2021


Sergey,

Thanks for the series! I've looked onto the updated version on your
branch and it is almost cool! I've polished it a bit: commit message,
typos, etc -- you can see the changes on my branch[1] (CI is green[2]).
If you're OK with them, I'll push the changeset to the trunk.

Speaking about the changes in Tarantool, I almost OK with them except
the test/luajit-test-init.lua. Consider the comments below.

================================================================================

diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index 1c05e085b..3d37164e8 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -40,16 +40,19 @@ set(LUAJIT_TEST_BINARY $<TARGET_FILE:tarantool> CACHE STRING
 set(LUAJIT_USE_TEST OFF CACHE BOOL
     "Generate <test> target" FORCE)
 
-# Enable internal LuaJIT assertions for Tarantool Debug build.
 # XXX: There is <strict> module enabled by default in Tarantool
 # built in Debug, so we need to tweak LuaJIT testing environment.
+# XXX: Also, this script "unloads" internal Tarantool's modules
+# and remove globals conflicting with LuaJIT test suites.
+set(LUAJIT_TEST_INIT "${PROJECT_SOURCE_DIR}/test/luajit-test-init.lua"
+    CACHE STRING "Lua code need to be run before tests are started" FORCE)
+
+# Enable internal LuaJIT assertions for Tarantool Debug build.
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(LUAJIT_USE_APICHECK ON CACHE BOOL
         "Assertions for the Lua/C API" FORCE)
     set(LUAJIT_USE_ASSERT ON CACHE BOOL
         "Assertions for the whole LuaJIT VM" FORCE)
-    set(LUAJIT_TEST_INIT "${PROJECT_SOURCE_DIR}/test/luajit-test-init.lua"
-        CACHE STRING "Lua code need to be run before tests are started" FORCE)
 endif()
 
 # Valgrind can be used only with the system allocator. For more
diff --git a/test/luajit-test-init.lua b/test/luajit-test-init.lua
index bc4af9748..d3f637156 100644
--- a/test/luajit-test-init.lua
+++ b/test/luajit-test-init.lua
@@ -1,2 +1,16 @@
 -- Disable strict for Tarantool.
 require("strict").off()
+
+-- XXX: lua-Harness test suite uses it's own tap.lua module
+-- that conflicts with the Tarantool's one.
+package.loaded.tap = nil
+-- XXX: lua-Harness test suite checks that utf8 module presents
+-- only in Lua5.3 or moonjit.
+utf8 = nil
+
+-- Add `strict.off()` to `progname` command, that runs child tests

# If only strict.off is required for child processes, please mention why
# others are not.

+-- in some LuaJIT test suites to disable strict there too.
+-- Quotes type is important.
+-- XXX: luacheck thinks that `arg` is read-only global variable.
+-- luacheck: no global
+arg[-1] = arg[-1]..' -e "require[[strict]].off()"'

# Please, mention how Tarantool parses CLI arguments and why arg[-1]
# contains the binary name despite the given flags.

# Furthermore, you can get the file path via `debug.getinfo(1).source`,
# so you can reassemble LUAJIT_TEST_COMMAND. However, if this is
# unnecessary, then nevermind.

================================================================================

On 15.03.21, Sergey Kaplun wrote:
> In this patchset lua-Harness test suite is adapted for the LuaJIT fork
> and Tarantool.
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-5844-adapt-lua-harness-test-suite
> Tarantool's branch for tests:
> https://github.com/tarantool/tarantool/tree/skaplun/gh-5844-adapt-lua-harness-test-suite
> Issues:
> * https://github.com/tarantool/tarantool/issues/5844
> * https://github.com/tarantool/tarantool/issues/5473
> 
> Changes in v2:
> * glanced commit message for the first patch
> * dropped module renaming
> * separate suite introduction and adjustment
> * dropped unnecessary commits with disabled tests
> 
> Mergen Imeev (1):
>   test: add lua-Harness test suite
> 
> Sergey Kaplun (4):
>   test: adjust lua-Harness suite for LuaJIT
>   test: adjust lua-Harness test suite for Tarantool
>   test: disable 241-standalone of lua-Harness suite
>   test: disable 411-luajit of lua-Harness suite
> 

<snipped>

> 
> -- 
> 2.28.0

[1]: https://github.com/tarantool/luajit/tree/imun/gh-5844-adapt-lua-harness-test-suite
[2]: https://github.com/tarantool/tarantool/tree/imun/gh-5844-adapt-lua-harness-test-suite

> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list