From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>, Sergey Bronnikov <sergeyb@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH luajit 04/36] test: remove <misc/coro_yield.lua> LuaJIT test Date: Wed, 14 Aug 2024 16:55:46 +0300 [thread overview] Message-ID: <86bb00a8c219db705156f4156558129bfe71e109.1723638851.git.skaplun@tarantool.org> (raw) In-Reply-To: <cover.1723638851.git.skaplun@tarantool.org> This patch removes the aforementioned test since it is the same test as <lib/coroutine/yield.lua> that wasn't cleaned up during the refactoring in the original repository. Part of tarantool/tarantool#9398 --- test/LuaJIT-tests/misc/coro_yield.lua | 111 -------------------------- 1 file changed, 111 deletions(-) delete mode 100644 test/LuaJIT-tests/misc/coro_yield.lua diff --git a/test/LuaJIT-tests/misc/coro_yield.lua b/test/LuaJIT-tests/misc/coro_yield.lua deleted file mode 100644 index ae3206e0..00000000 --- a/test/LuaJIT-tests/misc/coro_yield.lua +++ /dev/null @@ -1,111 +0,0 @@ -local create = coroutine.create -local wrap = coroutine.wrap -local resume = coroutine.resume -local yield = coroutine.yield - --- Test stack overflow handling on return from coroutine. -do - wrap(function() - local co = create(function() - yield(string.byte(string.rep(" ", 100), 1, 100)) - end) - assert(select('#', resume(co)) == 101) - end)() -end - -do - wrap(function() - local f = wrap(function() - yield(string.byte(string.rep(" ", 100), 1, 100)) - end) - assert(select('#', f()) == 100) - end)() -end - -do - local function cogen(x) - return wrap(function(n) repeat x = x+n; n = yield(x) until false end), - wrap(function(n) repeat x = x*n; n = yield(x) until false end) - end - - local a,b=cogen(3) - local c,d=cogen(5) - assert(d(b(c(a(d(b(c(a(1)))))))) == 168428160) -end - -do - local function verify(what, expect, ...) - local got = {...} - for i=1,100 do - if expect[i] ~= got[i] then - error("FAIL " .. what) - end - if expect[i] == nil then - break - end - end - end - - local function cofunc(...) - verify("call", { 1, "foo" }, ...) - verify("yield", { "bar" }, yield(2, "test")) - verify("pcall yield", { true, "again" }, pcall(yield, "from pcall")) - return "end" - end - - local co = create(cofunc) - verify("resume", { true, 2, "test" }, resume(co, 1, "foo")) - verify("resume pcall", { true, "from pcall" }, resume(co, "bar")) - verify("resume end", { true, "end" }, resume(co, "again")) -end - -do - local function verify(expect, func, ...) - local co = create(func) - for i=1,100 do - local ok, res = resume(co, ...) - if not ok then - if expect[i] ~= nil then - error("too few results: ["..i.."] = "..tostring(expect[i]).." (got: "..tostring(res)..")") - end - break - end - if expect[i] ~= res then - error("bad result: ["..i.."] = "..tostring(res).." (should be: "..tostring(expect[i])..")") - end - end - end - - verify({ 42, 99 }, - function(x) pcall(yield, x) return 99 end, - 42) - - verify({ 42, 99 }, - function(x) pcall(function(y) yield(y) end, x) return 99 end, - 42) - - verify({ 42, 99 }, - function(x) xpcall(yield, debug.traceback, x) return 99 end, - 42) - - verify({ 45, 44, 43, 42, 99 }, - function(x, y) - for i in - function(o, k) - yield(o+k) - if k ~= 0 then return k-1 end - end,x,y do - end - return 99 - end, - 42, 3) - - verify({ 84, 99 }, - function(x) - local o = setmetatable({ x }, - {__add = function(a, b) yield(a[1]+b[1]) return 99 end }) - return o+o - end, - 42) -end - -- 2.45.2
next prev parent reply other threads:[~2024-08-14 13:59 UTC|newest] Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-08-14 13:55 [Tarantool-patches] [PATCH luajit 00/36] Rearrange LuaJIT misc tests Sergey Kaplun via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 01/36] test: don't run JIT-based LuaJIT tests without JIT Sergey Kaplun via Tarantool-patches 2024-08-15 12:47 ` Sergey Bronnikov via Tarantool-patches 2024-08-19 8:47 ` Sergey Kaplun via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 02/36] test: enable <misc/alias_alloc.lua> LuaJIT test Sergey Kaplun via Tarantool-patches 2024-08-15 12:51 ` Sergey Bronnikov via Tarantool-patches 2024-08-15 13:31 ` Sergey Kaplun via Tarantool-patches 2024-08-30 7:25 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 03/36] test: refactor <lang/coroutine.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:00 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` Sergey Kaplun via Tarantool-patches [this message] 2024-08-15 13:05 ` [Tarantool-patches] [PATCH luajit 04/36] test: remove <misc/coro_yield.lua> " Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 05/36] test: enable <misc/debug_gc.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:09 ` Sergey Bronnikov via Tarantool-patches 2024-08-15 13:25 ` Sergey Kaplun via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 06/36] test: enable <misc/dualnum.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:11 ` Sergey Bronnikov via Tarantool-patches 2024-08-15 13:19 ` Sergey Bronnikov via Tarantool-patches 2024-08-15 13:22 ` Sergey Kaplun via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 07/36] test: remove <misc/fori_coerce.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:20 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 08/36] test: remove <misc/fori_dir.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:21 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 09/36] test: remove <misc/gc_rechain.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:22 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 10/36] test: enable <misc/gc_trace.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:24 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 11/36] test: enable <misc/gcstep.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:34 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 12/36] test: enable <misc/hook_active.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:38 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 13/36] test: enable <misc/hook_line.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:42 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 14/36] test: enable <misc/hook_norecord.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:56 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 15/36] test: enable <misc/hook_record.lua> " Sergey Kaplun via Tarantool-patches 2024-08-15 13:57 ` Sergey Bronnikov via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 16/36] test: enable <misc/hook_top.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:55 ` [Tarantool-patches] [PATCH luajit 17/36] test: enable <misc/jit_flush.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 18/36] test: remove <misc/loop_unroll.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 19/36] test: enable <misc/parse_comp.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 20/36] test: enable <misc/parse_esc.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 21/36] test: enable <misc/parse_misc.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 22/36] test: enable <misc/phi_conv.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 23/36] test: enable <misc/recurse_deep.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 24/36] test: remove <misc/recurse_tail.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 25/36] test: enable <misc/stack_gc.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 26/36] test: enable <misc/stack_purge.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 27/36] test: enable <misc/stackov.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 28/36] test: enable <misc/stackovc.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 29/36] test: enable <misc/tcall_base.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 30/36] test: enable <misc/tcall_loop.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 31/36] test: enable <misc/tonumber_scan.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 32/36] test: remove <misc/uclo.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 33/36] test: enable <misc/unordered_jit.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 34/36] test: enable <misc/wbarrier.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 35/36] test: enable <misc/wbarrier_jit.lua> " Sergey Kaplun via Tarantool-patches 2024-08-14 13:56 ` [Tarantool-patches] [PATCH luajit 36/36] test: enable <misc/wbarrier_obar.lua> " Sergey Kaplun via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=86bb00a8c219db705156f4156558129bfe71e109.1723638851.git.skaplun@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 04/36] test: remove <misc/coro_yield.lua> LuaJIT test' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox