[Tarantool-patches] [PATCH luajit v3 01/29] test: add PUC-Rio Lua 5.1 test suite

Igor Munkin imun at tarantool.org
Tue Apr 13 23:31:18 MSK 2021


Sergey,

Thanks for the patch! LGTM with the following nits: I fixed them on top
of your branch[1] and guess no re-testing is needed.

On 13.04.21, Sergey Kaplun wrote:
> This patch adds PUC-Rio Lua 5.1 test suite as a part of the LuaJIT test
> suite. Source code is taken verbatim (except trailing whitespace) from
> https://www.lua.org/tests/lua5.1-tests.tar.gz.
> 
> Some tests may fail after this commit. They will be disabled
> or adapted in the next patches.
> 
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---

<snipped>

> diff --git a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
> new file mode 100644
> index 00000000..e3bbc9de
> --- /dev/null
> +++ b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
> @@ -0,0 +1,45 @@
> +# Test suite that has been added from PUC-Rio Lua 5.1 test archive
> +# in scope of https://github.com/tarantool/tarantool/issues/5845.
> +
> +# See the rationale in the root CMakeLists.txt.
> +cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
> +
> +# XXX: There are two ways to set up the proper environment
> +# described in the suite's README:
> +# * set LUA_PATH to "?;./?.lua"
> +# * or, better yet, set LUA_PATH to "./?.lua;;" and LUA_INIT to
> +#   "package.path = '?;'..package.path"
> +# Unfortunately, Tarantool doesn't support LUA_INIT and most
> +# likely it never will. For more info, see
> +# https://github.com/tarantool/tarantool/issues/5744
> +# Hence, there is no way other than set LUA_PATH environment
> +# variable as proposed in the first case.
> +set(LUA_PATH "?\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua")
> +
> +# Establish PUC-Lua-5.1-tests-prepare target that creates <libs/P1>

Typo: s/PUC-Lua-5.1-tests-prepare/PUC-Rio-Lua-5.1-tests-prepare/.

> +# subdirectory.
> +add_subdirectory(libs)
> +
> +# TODO: PUC-Rio Lua 5.1 test suite also has special header
> +# <ltests.h> and <ltests.c> translation unit to check some
> +# internal behaviour of the Lua implementation (see etc/
> +# directory). It modifies realloc function to check memory
> +# consistency and also contains tests for yield in hooks
> +# and for the Lua C API.
> +# But, unfortunately, <ltests.c> depends on specific PUC-Rio
> +# Lua 5.1 internal headers and should be adapted for LuaJIT.
> +
> +add_custom_target(PUC-Rio-Lua-5.1-tests
> +  DEPENDS ${LUAJIT_TEST_BINARY} PUC-Lua-5.1-tests-prepare

Typo: s/PUC-Lua-5.1-tests-prepare/PUC-Rio-Lua-5.1-tests-prepare/.

> +)
> +
> +add_custom_command(TARGET PUC-Rio-Lua-5.1-tests
> +  COMMENT "Running PUC-Rio Lua 5.1 tests"
> +  COMMAND
> +  env
> +    LUA_PATH="${LUA_PATH}\;\;"
> +    ${LUAJIT_TEST_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/all.lua
> +  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
> +)
> +
> +# vim: expandtab tabstop=2 shiftwidth=2

<snipped>

> diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
> new file mode 100644
> index 00000000..f24e7f30
> --- /dev/null
> +++ b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
> @@ -0,0 +1,18 @@
> +# Test suite that has been added from PUC-Rio Lua 5.1 test archive
> +# in scope of https://github.com/tarantool/tarantool/issues/5845.
> +
> +# See the rationale in the root CMakeLists.txt.
> +cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
> +
> +# The original tarball contains subdirectory "libs" with an empty
> +# subdirectory "libs/P1", to be used by tests.
> +# Instead of tracking empty directory with some anchor-file for
> +# git, create this directory via CMake.
> +add_custom_target(PUC-Lua-5.1-tests-prepare)
> +add_custom_command(TARGET PUC-Lua-5.1-tests-prepare

Typo: s/PUC-Lua-5.1-tests-prepare/PUC-Rio-Lua-5.1-tests-prepare/g.

> +  COMMENT "Create directory for PUC-Rio Lua 5.1 tests"
> +  COMMAND ${CMAKE_COMMAND} -E make_directory P1
> +  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
> +)
> +
> +# vim: expandtab tabstop=2 shiftwidth=2

<snipped>

> -- 
> 2.31.0
> 

[1]: https://github.com/tarantool/luajit/commit/47deba2

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list