[Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call

Maxim Kokryashkin m.kokryashkin at tarantool.org
Tue Feb 15 01:21:24 MSK 2022


Hi!
Thanks for the review!
 
Here is the new commit message:
=======================================================
test: adapt tests checking traceback in tail call
 
LuaJIT does not provide information about tail calls,
unlike, Lua 5.1 does, so a traceback in LuaJIT may be different.
 
Consider this chunk of code:
```
local function f(n)
  if n > 0 then
    return f(n - 1)
  else
    coroutine.yield()
  end
end
 
local co = coroutine.create(f)
coroutine.resume(co, 3)
print(debug.traceback(co))
```
 
For LuaJIT traceback looks like the following:
stack traceback:
        [C]: in function 'yield'
        test.lua:5: in function <test.lua:1>
```
 
And for Lua 5.1 it looks like the following:
```
stack traceback:
        [C]: in function 'yield'
        test.lua:5: in function <test.lua:1>
        (tail call): ?
        (tail call): ?
        (tail call): ?
```
 
This commit adapts the corresponding test to the behavior of LuaJIT, so
it doesn't check tail calls anymore.
 
Resolves tarantool/tarantool#5703
Part of tarantool/tarantool#5870
=======================================================
 
New CI branch:  https://github.com/tarantool/tarantool/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio-full-ci
--
Best regards,
Maxim Kokryashkin
 
 
> 
>>Max,
>>
>>Thanks for the patch! LGTM, except a couple of nits.
>>
>>On 09.11.21, Максим Корякшин wrote:
>>>
>>> Hi, Sergey! Thanks for the review!
>>> Here is the new commit message considering your comments:
>>>  
>>> =======================================================
>>> test: adapt tests checking traceback in tail call
>>>  
>>> LuaJIT does not provide information about tail calls,
>>> unlike, Lua 5.1 does, so a traceback in LuaJIT may be different.
>>>  
>>> Consider this chunck of code:
>>
>>Typo: s/chunck/chunk/.
>>
>>> ```
>>> local function f(n)
>>>     if n > 0 then
>>>         return f(n - 1)
>>>     else
>>>         coroutine.yield()
>>>     end
>>> end
>>>  
>>> local co = coroutine.create(f)
>>> coroutine.resume(co, 3)
>>> print(debug.traceback(co))
>>> ```
>>>  
>>> For LuaJIT traceback looks like the following:
>>> stack traceback:
>>>             [C]: in function 'yield'
>>>             test.lua:5: in function <test.lua:1>
>>> ```
>>>  
>>> And for Lua 5.1 it looks like the following:
>>> ```
>>> stack traceback:
>>>             [C]: in function 'yield'
>>>             test.lua:5: in function <test.lua:1>
>>>             (tail call): ?
>>>             (tail call): ?
>>>             (tail call): ?
>>> ```
>>>  
>>> This commit adapts the corresponding test to the behavior of LuaJIT, so
>>> it doesn't check tail calls anymore.
>>>  
>>
>>Please, add "Resolves tarantool/tarantool#5703" here.
>>
>>> Part of tarantool/tarantool#5870
>>> =======================================================
>>>  
>>> CI:   https://github.com/tarantool/tarantool/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
>>>  
>>> Best regards,
>>> Maxim Kokryashkin
>>
>><snipped>
>>
>>>  
>>
>>--
>>Best regards,
>>IM
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20220215/eeacf665/attachment.htm>


More information about the Tarantool-patches mailing list