* [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
@ 2021-09-24 17:25 Maxim Kokryashkin via Tarantool-patches
2021-09-24 18:28 ` Максим Корякшин via Tarantool-patches
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2021-09-24 17:25 UTC (permalink / raw)
To: tarantool-patches, imun, skaplun
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:
```
local function checktraceback (co, p)
local tb = debug.traceback(co)
local i = 0
for l in string.gmatch(tb, "[^\n]+\n?") do
assert(i == 0 or string.find(l, p[i]))
i = i+1
end
assert(p[i] == nil)
end
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)
checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
```
For LuaJIT traceback looks like the following:
```
stack traceback:
[C]: in function 'yield'
db.lua:436: in function <db.lua:434>
```
And for Lua 5.1 it looks like the following:
```
stack traceback:
[C]: in function 'yield'
db.lua:436: in function <db.lua:434>
(tail call): ?
(tail call): ?
(tail call): ?
```
Closes tarantool/tarantool#5703
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
Issue: https://github.com/tarantool/tarantool/issues/5703
GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index 56f59ea8..f254cde6 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -475,9 +475,8 @@ end
local co = coroutine.create(f)
coroutine.resume(co, 3)
--- FIXME: Behavior is different for LuaJIT.
--- See the comment to `h()` above. Test is disabled for LuaJIT.
--- checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
+-- Test is adapted to the behaviour of LuaJIT.
+checktraceback(co, {"yield", "db.lua"})
co = coroutine.create(function (x)
--
2.33.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2021-09-24 17:25 [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call Maxim Kokryashkin via Tarantool-patches
@ 2021-09-24 18:28 ` Максим Корякшин via Tarantool-patches
2021-10-11 15:11 ` Sergey Kaplun via Tarantool-patches
2022-02-17 16:36 ` Igor Munkin via Tarantool-patches
2 siblings, 0 replies; 7+ messages in thread
From: Максим Корякшин via Tarantool-patches @ 2021-09-24 18:28 UTC (permalink / raw)
To: Maxim Kokryashkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]
Hi!
I have fixed a typo in the commit, so here is the diff:
=============================================================
diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index f254cde6..fce85b19 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -475,7 +475,7 @@ end
local co = coroutine.create(f)
coroutine.resume(co, 3)
--- Test is adapted to the behaviour of LuaJIT.
+-- Test is adapted to the behavior of LuaJIT.
checktraceback(co, {"yield", "db.lua"})
=============================================================
Best regards,
Maxim Kokryashkin
>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:
>```
>local function checktraceback (co, p)
> local tb = debug.traceback(co)
> local i = 0
> for l in string.gmatch(tb, "[^\n]+\n?") do
> assert(i == 0 or string.find(l, p[i]))
> i = i+1
> end
> assert(p[i] == nil)
>end
>
>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)
>checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
>```
>
>For LuaJIT traceback looks like the following:
>```
>stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
>```
>
>And for Lua 5.1 it looks like the following:
>```
>stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
> (tail call): ?
> (tail call): ?
> (tail call): ?
>```
>
>Closes tarantool/tarantool#5703
>Part of tarantool/tarantool#5845
>Part of tarantool/tarantool#4473
>---
>Issue: https://github.com/tarantool/tarantool/issues/5703
>GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
>
> test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
>index 56f59ea8..f254cde6 100644
>--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
>+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
>@@ -475,9 +475,8 @@ end
>
> local co = coroutine.create(f)
> coroutine.resume(co, 3)
>--- FIXME: Behavior is different for LuaJIT.
>--- See the comment to `h()` above. Test is disabled for LuaJIT.
>--- checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
>+-- Test is adapted to the behaviour of LuaJIT.
>+checktraceback(co, {"yield", "db.lua"})
>
>
> co = coroutine.create(function (x)
>--
>2.33.0
[-- Attachment #2: Type: text/html, Size: 3812 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2021-09-24 17:25 [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call Maxim Kokryashkin via Tarantool-patches
2021-09-24 18:28 ` Максим Корякшин via Tarantool-patches
@ 2021-10-11 15:11 ` Sergey Kaplun via Tarantool-patches
2021-11-09 16:59 ` Максим Корякшин via Tarantool-patches
2022-02-17 16:36 ` Igor Munkin via Tarantool-patches
2 siblings, 1 reply; 7+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2021-10-11 15:11 UTC (permalink / raw)
To: Maxim Kokryashkin; +Cc: tarantool-patches
Hi, Maxim!
Thanks for the patch!
LGTM except a few nits, regarding the commit message.
On 24.09.21, Maxim Kokryashkin wrote:
> LuaJIT does not provide information about tail calls
Typo: s/calls/calls,/
> unlike, Lua 5.1 does, so a traceback in LuaJIT may be different.
>
> Consider this chunck of code:
> ```
> local function checktraceback (co, p)
> local tb = debug.traceback(co)
> local i = 0
> for l in string.gmatch(tb, "[^\n]+\n?") do
> assert(i == 0 or string.find(l, p[i]))
> i = i+1
> end
> assert(p[i] == nil)
> end
>
> 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)
> checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
> ```
>
> For LuaJIT traceback looks like the following:
> ```
> stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
> ```
>
> And for Lua 5.1 it looks like the following:
> ```
> stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
> (tail call): ?
> (tail call): ?
> (tail call): ?
> ```
Please provide a simple example in the commit message. This is too
monstrous. Also, it is a good practice to mention what the patch does.
>
> Closes tarantool/tarantool#5703
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
Looks like it should be 5870 instead 4473. Also, 5845 is already
closed.
> ---
> Issue: https://github.com/tarantool/tarantool/issues/5703
> GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
>
> test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
> index 56f59ea8..f254cde6 100644
> --- a/test/PUC-Rio-Lua-5.1-tests/db.lua
> +++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
<snipped>
> --
> 2.33.0
>
--
Best regards,
Sergey Kaplun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2021-10-11 15:11 ` Sergey Kaplun via Tarantool-patches
@ 2021-11-09 16:59 ` Максим Корякшин via Tarantool-patches
2022-02-11 19:12 ` Igor Munkin via Tarantool-patches
0 siblings, 1 reply; 7+ messages in thread
From: Максим Корякшин via Tarantool-patches @ 2021-11-09 16:59 UTC (permalink / raw)
To: Sergey Kaplun; +Cc: Maxim Kokryashkin, tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 3519 bytes --]
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:
```
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.
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
>Понедельник, 11 октября 2021, 18:13 +03:00 от Sergey Kaplun <skaplun@tarantool.org>:
>
>Hi, Maxim!
>
>Thanks for the patch!
>
>LGTM except a few nits, regarding the commit message.
>
>On 24.09.21, Maxim Kokryashkin wrote:
>> LuaJIT does not provide information about tail calls
>
>Typo: s/calls/calls,/
>
>> unlike, Lua 5.1 does, so a traceback in LuaJIT may be different.
>>
>> Consider this chunck of code:
>> ```
>> local function checktraceback (co, p)
>> local tb = debug.traceback(co)
>> local i = 0
>> for l in string.gmatch(tb, "[^\n]+\n?") do
>> assert(i == 0 or string.find(l, p[i]))
>> i = i+1
>> end
>> assert(p[i] == nil)
>> end
>>
>> 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)
>> checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
>> ```
>>
>> For LuaJIT traceback looks like the following:
>> ```
>> stack traceback:
>> [C]: in function 'yield'
>> db.lua:436: in function <db.lua:434>
>> ```
>>
>> And for Lua 5.1 it looks like the following:
>> ```
>> stack traceback:
>> [C]: in function 'yield'
>> db.lua:436: in function <db.lua:434>
>> (tail call): ?
>> (tail call): ?
>> (tail call): ?
>> ```
>
>Please provide a simple example in the commit message. This is too
>monstrous. Also, it is a good practice to mention what the patch does.
>
>>
>> Closes tarantool/tarantool#5703
>> Part of tarantool/tarantool#5845
>> Part of tarantool/tarantool#4473
>
>Looks like it should be 5870 instead 4473. Also, 5845 is already
>closed.
>
>> ---
>> Issue: https://github.com/tarantool/tarantool/issues/5703
>> GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
>>
>> test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
>> index 56f59ea8..f254cde6 100644
>> --- a/test/PUC-Rio-Lua-5.1-tests/db.lua
>> +++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
>
><snipped>
>
>> --
>> 2.33.0
>>
>
>--
>Best regards,
>Sergey Kaplun
[-- Attachment #2: Type: text/html, Size: 5372 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2021-11-09 16:59 ` Максим Корякшин via Tarantool-patches
@ 2022-02-11 19:12 ` Igor Munkin via Tarantool-patches
2022-02-14 22:21 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 1 reply; 7+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2022-02-11 19:12 UTC (permalink / raw)
To: Максим
Корякшин
Cc: Maxim Kokryashkin, tarantool-patches
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2022-02-11 19:12 ` Igor Munkin via Tarantool-patches
@ 2022-02-14 22:21 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 0 replies; 7+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2022-02-14 22:21 UTC (permalink / raw)
To: Igor Munkin; +Cc: Maxim Kokryashkin, tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 3154 bytes --]
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
>
[-- Attachment #2: Type: text/html, Size: 5237 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call
2021-09-24 17:25 [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call Maxim Kokryashkin via Tarantool-patches
2021-09-24 18:28 ` Максим Корякшин via Tarantool-patches
2021-10-11 15:11 ` Sergey Kaplun via Tarantool-patches
@ 2022-02-17 16:36 ` Igor Munkin via Tarantool-patches
2 siblings, 0 replies; 7+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2022-02-17 16:36 UTC (permalink / raw)
To: Maxim Kokryashkin; +Cc: tarantool-patches
Max,
I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in 1.10, 2.8 and master.
On 24.09.21, Maxim Kokryashkin wrote:
> 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:
> ```
> local function checktraceback (co, p)
> local tb = debug.traceback(co)
> local i = 0
> for l in string.gmatch(tb, "[^\n]+\n?") do
> assert(i == 0 or string.find(l, p[i]))
> i = i+1
> end
> assert(p[i] == nil)
> end
>
> 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)
> checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
> ```
>
> For LuaJIT traceback looks like the following:
> ```
> stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
> ```
>
> And for Lua 5.1 it looks like the following:
> ```
> stack traceback:
> [C]: in function 'yield'
> db.lua:436: in function <db.lua:434>
> (tail call): ?
> (tail call): ?
> (tail call): ?
> ```
>
> Closes tarantool/tarantool#5703
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
> Issue: https://github.com/tarantool/tarantool/issues/5703
> GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio
>
> test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
<snipped>
> --
> 2.33.0
>
--
Best regards,
IM
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-02-17 16:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 17:25 [Tarantool-patches] [PATCH luajit] test: adapt tests checking traceback in tail call Maxim Kokryashkin via Tarantool-patches
2021-09-24 18:28 ` Максим Корякшин via Tarantool-patches
2021-10-11 15:11 ` Sergey Kaplun via Tarantool-patches
2021-11-09 16:59 ` Максим Корякшин via Tarantool-patches
2022-02-11 19:12 ` Igor Munkin via Tarantool-patches
2022-02-14 22:21 ` Maxim Kokryashkin via Tarantool-patches
2022-02-17 16:36 ` Igor Munkin via Tarantool-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox