[Tarantool-patches] [PATCH v2 luajit 24/26] test: enable <api_call.lua> LuaJIT test

Sergey Bronnikov sergeyb at tarantool.org
Mon Feb 5 16:28:43 MSK 2024


Hi, Sergey

thanks for the patch! LGTM

On 1/29/24 13:45, Sergey Kaplun wrote:
> This patch moves the <api_call.lua> test from the <misc> to <lang>
> directory, includes it in <index>, and names subtests.
>
> Part of tarantool/tarantool#9398
> ---
>   test/LuaJIT-tests/{misc => lang}/api_call.lua | 32 +++++++++++--------
>   test/LuaJIT-tests/lang/index                  |  1 +
>   2 files changed, 19 insertions(+), 14 deletions(-)
>   rename test/LuaJIT-tests/{misc => lang}/api_call.lua (79%)
>
> diff --git a/test/LuaJIT-tests/misc/api_call.lua b/test/LuaJIT-tests/lang/api_call.lua
> similarity index 79%
> rename from test/LuaJIT-tests/misc/api_call.lua
> rename to test/LuaJIT-tests/lang/api_call.lua
> index 7dbd5e40..142959c5 100644
> --- a/test/LuaJIT-tests/misc/api_call.lua
> +++ b/test/LuaJIT-tests/lang/api_call.lua
> @@ -1,4 +1,4 @@
> -local ctest = require("ctest")
> +local ctest = require("libctest")
>   
>   local function ret0() end
>   local function ret1() return 1 end
> @@ -57,19 +57,10 @@ local function test_adjust_results(testfunc)
>     ck(cc(-1, retva, 1, 2), 1, 2)
>   end
>   
> -test_adjust_results(ctest.call)
> -test_adjust_results(ctest.pcall_err)
> -
> -
>   local function gcshrink()
>     for i=1,10 do collectgarbage() end
>   end
>   
> -assert(select('#', ctest.call(2000, gcshrink)) == 2000)
> -gcshrink()
> -assert(select('#', ctest.call(7000, gcshrink)) == 7000)
> -gcshrink()
> -
>   local function test_yield(resume, yield)
>     local function inpcall()
>       ck(pack(yield(6, 7)), 18, 19)
> @@ -91,8 +82,21 @@ local function test_yield(resume, yield)
>     assert(resume(co) == false)
>   end
>   
> -test_yield(coroutine.resume, coroutine.yield)
> -test_yield(ctest.resume, coroutine.yield)
> -test_yield(coroutine.resume, ctest.yield)
> -test_yield(ctest.resume, ctest.yield)
> +do --- adjust results
> +  test_adjust_results(ctest.call)
> +  test_adjust_results(ctest.pcall_err)
> +end
>   
> +do --- GC shrink
> +  assert(select('#', ctest.call(2000, gcshrink)) == 2000)
> +  gcshrink()
> +  assert(select('#', ctest.call(7000, gcshrink)) == 7000)
> +  gcshrink()
> +end
> +
> +do --- yield
> +  test_yield(coroutine.resume, coroutine.yield)
> +  test_yield(ctest.resume, coroutine.yield)
> +  test_yield(coroutine.resume, ctest.yield)
> +  test_yield(ctest.resume, ctest.yield)
> +end
> diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
> index 60cbecfb..dc0c2e14 100644
> --- a/test/LuaJIT-tests/lang/index
> +++ b/test/LuaJIT-tests/lang/index
> @@ -1,4 +1,5 @@
>   andor.lua
> +api_call.lua
>   assignment.lua
>   compare.lua
>   compare_nan.lua


More information about the Tarantool-patches mailing list