From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id C121926B4AF; Wed, 15 Feb 2023 11:49:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C121926B4AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1676450984; bh=bxBJN6Ezq4501FwEJi+9uHwKKLjiU3ywcXNefjzeYes=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gRhOy/ElhySnsOvIScQYUWm8lMmxfyJUJJ9EcdbKS2FyDmXrp+i36uIR0bgQcK2pn fAQpW3I8xAfD2cCO3woSDjElcn8JE830Q4s51YDkpGzMcMBOVSxg6FriAbjR2DAd3u lvCE1AipJnnEDlluTMC1mzEMXxLISny5B7dw26ek= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 287191A4E58 for ; Wed, 15 Feb 2023 11:49:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 287191A4E58 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1pSDTy-0003tU-39; Wed, 15 Feb 2023 11:49:42 +0300 Date: Wed, 15 Feb 2023 11:46:09 +0300 To: Igor Munkin Message-ID: References: <813a3dbf14ec517cbfe7313c77aba3adbd5113ff.1676304797.git.imun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <813a3dbf14ec517cbfe7313c77aba3adbd5113ff.1676304797.git.imun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9806C989EC2150E3379A3C40B9AC0CB6A78DC697FD8BD72D3182A05F538085040E2F11868A48F230F8434BEB35275464C52749C07904BE145B80AA4DDD8BB1D31 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74FC9C1E089083C84EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378D546FBECC9DB5E18638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D873ADD6DB0B0ABE325A66905B361019AB117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCFF6C1D329F95ABD4A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520599709FD55CB46A66FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3433E9BC74ABA5769F38680E652A37770085BC44C85BB2E79AA00526F670615E5A4382FEBD97C1B4541D7E09C32AA3244CC52B87C62F66E4CC4295A71F01A437665595C85A795C7BAEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojeiW+ccsIdaWwm6SFRpThlw== X-DA7885C5: 0666A6F09AF4EB2B6E284D48F83EF415A864656D4D4CFDA1D4AA176473A8CBA9262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73933AF1F914F131DBF50D75336F3F629AEC0408A97EADD4217B0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 4/7] test: make skipcond helper more convenient X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Igor! Thanks for the patch! `skipcond` improvement is delightful, I realy like it! Please, consider my comments below. On 13.02.23, Igor Munkin wrote: > This patch provides two enhancements for : > 1. As a result of the patch, becomes multi-conditional, > so there is no need to concatenate one huge and complex condition > with one huge unreadable reason. Now skipcond receives the table with > conditions and skips the test if one of the given conditions is met. > 2. yields the test object, that allows to chain > skipcond call right next to the test constructor. > > Finally as a result of the aforementioned changes is > moved to tap.lua. > > Relates to tarantool/tarantool#8252 > > Co-authored-by: Sergey Kaplun > Signed-off-by: Igor Munkin > --- > 16 files changed, 104 insertions(+), 125 deletions(-) > > diff --git a/test/tarantool-tests/gh-4199-gc64-fuse.test.lua b/test/tarantool-tests/gh-4199-gc64-fuse.test.lua > index 4d69250f..65f9faac 100644 > --- a/test/tarantool-tests/gh-4199-gc64-fuse.test.lua > +++ b/test/tarantool-tests/gh-4199-gc64-fuse.test.lua > diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > index f4795db0..2d6c3b06 100644 > --- a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > +++ b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > diff --git a/test/tarantool-tests/gh-5813-resolving-of-c-symbols.test.lua b/test/tarantool-tests/gh-5813-resolving-of-c-symbols.test.lua > index e0b6d86d..019fed29 100644 > --- a/test/tarantool-tests/gh-5813-resolving-of-c-symbols.test.lua > +++ b/test/tarantool-tests/gh-5813-resolving-of-c-symbols.test.lua > > -jit.off() > -jit.flush() > +-- XXX: Run JIT tuning functions in a safe frame to avoid errors > +-- thrown when LuaJIT is compiled with JIT engine disabled. > +pcall(jit.off) > +pcall(jit.flush) Should this be the part of the next patch? > > local bufread = require "utils.bufread" > local symtab = require "utils.symtab" > @@ -20,7 +17,7 @@ local testboth = require "resboth" > diff --git a/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua b/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > index 15bd0a8b..f139b6b5 100644 > --- a/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > +++ b/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua > index 8bc523c2..633ab676 100644 > --- a/test/tarantool-tests/lj-430-maxirconst.test.lua > +++ b/test/tarantool-tests/lj-430-maxirconst.test.lua > diff --git a/test/tarantool-tests/lj-603-err-snap-restore.test.lua b/test/tarantool-tests/lj-603-err-snap-restore.test.lua > index b5353e85..c67da00e 100644 > --- a/test/tarantool-tests/lj-603-err-snap-restore.test.lua > +++ b/test/tarantool-tests/lj-603-err-snap-restore.test.lua > @@ -1,9 +1,15 @@ > local tap = require('tap') > - > -- Test to demonstrate the incorrect JIT behaviour when an error > -- is raised on restoration from the snapshot. > -- See also https://github.com/LuaJIT/LuaJIT/issues/603. > -local test = tap.test('lj-603-err-snap-restore.test.lua') > +local test = tap.test('lj-603-err-snap-restore'):skipcond({ > + ['Disabled on *BSD due to #4819'] = jit.os == 'BSD', Side note: discussed offline that we can disable the whole test file, even that the first test check the behaviour for the VM too. > + -- XXX: The different amount of stack slots is in-use for > + -- Tarantool at start, so just skip test for it. > + -- luacheck: no global > + ['Disable test for Tarantool'] = _TARANTOOL, > +}) > + > test:plan(2) > > -- XXX: This is fragile. We need a specific amount of Lua stack > @@ -15,7 +21,7 @@ test:plan(2) > -- error handling"), etc.). > -- This amount is suited well for GC64 and non-GC64 mode. > -- luacheck: no unused > -local _, _, _, _, _, _ > +local _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ Side note: Is necessary due to different allocations and memory mapping, so we can hit `ERRERR` error during raising the `STKOV` error and handler will be called. > > local handler_is_called = false > local recursive_f > @@ -38,11 +44,7 @@ end > diff --git a/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua b/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua > index 1dc741d8..2165afe3 100644 > --- a/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua > +++ b/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua > diff --git a/test/tarantool-tests/lj-906-fix-err-mem.test.lua b/test/tarantool-tests/lj-906-fix-err-mem.test.lua > index 450beeff..6c6df338 100644 > --- a/test/tarantool-tests/lj-906-fix-err-mem.test.lua > +++ b/test/tarantool-tests/lj-906-fix-err-mem.test.lua > diff --git a/test/tarantool-tests/lj-flush-on-trace.test.lua b/test/tarantool-tests/lj-flush-on-trace.test.lua > index cf92757c..60a0ccbd 100644 > --- a/test/tarantool-tests/lj-flush-on-trace.test.lua > +++ b/test/tarantool-tests/lj-flush-on-trace.test.lua > diff --git a/test/tarantool-tests/misclib-getmetrics-capi.test.lua b/test/tarantool-tests/misclib-getmetrics-capi.test.lua > index 42a9adf9..a41a1c7a 100644 > --- a/test/tarantool-tests/misclib-getmetrics-capi.test.lua > +++ b/test/tarantool-tests/misclib-getmetrics-capi.test.lua > @@ -1,12 +1,15 @@ > +local maxnins = require('utils').const.maxnins Minor: since this is the constant for the test should we name it in the upper-case? > local jit_opt_default = { > - jit.opt.start(0, "hotloop=1", "hotexit=2", > - ("minstitch=%d"):format(utils.const.maxnins)) > + jit.opt.start(0, "hotloop=1", "hotexit=2", ("minstitch=%d"):format(maxnins)) > > local function foo(i) > -- math.fmod is not yet compiled! > diff --git a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua > index 0c170d0c..e5ee7902 100644 > --- a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua > +++ b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua > > +local maxnins = require('utils').const.maxnins Ditto. > local jit_opt_default = { > 3, -- level > "hotloop=56", > diff --git a/test/tarantool-tests/misclib-memprof-lapi.test.lua b/test/tarantool-tests/misclib-memprof-lapi.test.lua > index bae0c27c..accb1ee1 100644 > --- a/test/tarantool-tests/misclib-memprof-lapi.test.lua > +++ b/test/tarantool-tests/misclib-memprof-lapi.test.lua > @@ -28,8 +28,8 @@ local memprof = require "memprof.parse" > local process = require "memprof.process" > local symtab = require "utils.symtab" > > -local TMP_BINFILE = utils.profilename("memprofdata.tmp.bin") > -local BAD_PATH = utils.profilename("memprofdata/tmp.bin") > +local TMP_BINFILE = require("utils").profilename("memprofdata.tmp.bin") Don't get the point. Why do not require this module once, so there is no need to change these lines? > +local BAD_PATH = require("utils").profilename("memprofdata/tmp.bin") > local SRC_PATH = "@"..arg[0] > > local function default_payload() > diff --git a/test/tarantool-tests/misclib-sysprof-capi.test.lua b/test/tarantool-tests/misclib-sysprof-capi.test.lua > index dad0fe4a..2b0e25ae 100644 > --- a/test/tarantool-tests/misclib-sysprof-capi.test.lua > +++ b/test/tarantool-tests/misclib-sysprof-capi.test.lua > diff --git a/test/tarantool-tests/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/misclib-sysprof-lapi.test.lua > index 4bf10e8d..8dc36592 100644 > --- a/test/tarantool-tests/misclib-sysprof-lapi.test.lua > +++ b/test/tarantool-tests/misclib-sysprof-lapi.test.lua > @@ -18,8 +13,8 @@ local bufread = require("utils.bufread") > local symtab = require("utils.symtab") > local sysprof = require("sysprof.parse") > > -local TMP_BINFILE = utils.profilename("sysprofdata.tmp.bin") > -local BAD_PATH = utils.profilename("sysprofdata/tmp.bin") > +local TMP_BINFILE = require("utils").profilename("sysprofdata.tmp.bin") > +local BAD_PATH = require("utils").profilename("sysprofdata/tmp.bin") Ditto. > > local function payload() > local function fib(n) > diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua > index a1f54d20..ac04c01d 100644 > --- a/test/tarantool-tests/tap.lua > +++ b/test/tarantool-tests/tap.lua > @@ -304,6 +304,17 @@ local function check(test) > return test.planned == test.total and test.failed == 0 > end > > +local function skipcond(test, conditions) > + for message, condition in pairs(conditions) do > + if condition then > + test:plan(1) > + test:skip(message) > + os.exit(test:check() and 0 or 1) Does this mean that the subtest should be the last test to run in the file? It's kinda not obvious. Also, I suggest the following approach: Keep that condition search result, and skip every test (and subtest) if the condition met. We can still skip full test, like you done, if it has no parent test to run (has no test.parent). > + end > + end > + return test > +end > + > test_mt = { > __index = { > test = new, > @@ -313,6 +324,7 @@ test_mt = { > ok = ok, > fail = fail, > skip = skip, > + skipcond = skipcond, > is = is, > isnt = isnt, > isnil = isnil, > diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua > index 41a7c22a..4fb66600 100644 > --- a/test/tarantool-tests/utils.lua > +++ b/test/tarantool-tests/utils.lua > -- > 2.30.2 > -- Best regards, Sergey Kaplun