[Tarantool-patches] [PATCH v2 luajit 38/45] test: enable <misc/tcall_loop.lua> LuaJIT test

Sergey Bronnikov sergeyb at tarantool.org
Thu Aug 22 17:14:26 MSK 2024


Sergey,

On 21.08.2024 11:58, Sergey Kaplun wrote:
> This patch moves the aforementioned test from the <misc> to the <trace/>
> directory, includes it in <index>, and names the subtest.
>
> Part of tarantool/tarantool#9398
> ---
thanks for the patch! LGTM
>   test/LuaJIT-tests/misc/tcall_loop.lua  |  8 --------
>   test/LuaJIT-tests/trace/index          |  1 +
>   test/LuaJIT-tests/trace/tcall_loop.lua | 10 ++++++++++
>   3 files changed, 11 insertions(+), 8 deletions(-)
>   delete mode 100644 test/LuaJIT-tests/misc/tcall_loop.lua
>   create mode 100644 test/LuaJIT-tests/trace/tcall_loop.lua
>
> diff --git a/test/LuaJIT-tests/misc/tcall_loop.lua b/test/LuaJIT-tests/misc/tcall_loop.lua
> deleted file mode 100644
> index d3c6f1a6..00000000
> --- a/test/LuaJIT-tests/misc/tcall_loop.lua
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -local function f(i)
> -  if i > 0 then return f(i-1) end
> -  return 1
> -end
> -
> -local x = 0
> -for i=1,100 do x = x + f(1000) end
> -assert(x == 100)
> diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
> index 9de3b478..1b8fb8f4 100644
> --- a/test/LuaJIT-tests/trace/index
> +++ b/test/LuaJIT-tests/trace/index
> @@ -11,3 +11,4 @@ snap.lua
>   stack_purge.lua
>   stitch.lua
>   tcall_base.lua
> +tcall_loop.lua
> diff --git a/test/LuaJIT-tests/trace/tcall_loop.lua b/test/LuaJIT-tests/trace/tcall_loop.lua
> new file mode 100644
> index 00000000..7d872644
> --- /dev/null
> +++ b/test/LuaJIT-tests/trace/tcall_loop.lua
> @@ -0,0 +1,10 @@
> +local function f(i)
> +  if i > 0 then return f(i - 1) end
> +  return 1
> +end
> +
> +do --- Recording tailcall with the loop for the tail recursion.
> +  local x = 0
> +  for _ = 1, 100 do x = x + f(1000) end
> +  assert(x == 100)
> +end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240822/d27f551b/attachment.htm>


More information about the Tarantool-patches mailing list