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 3FD616F15B; Thu, 11 Aug 2022 14:28:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3FD616F15B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1660217289; bh=sRYeMqV7p1wEKSxKpwkTH4kJ6cHfRBO9Ykl514UDKFE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=X/4GXJpSGmuWGbI090/Ap3q7WMg7aH1j0jAXzmxXTjOEjS2efC9vKwNwMrQaizXny tQbvZoApcTmDhLiNQ3c1YUplI79cnjgj9UsKvpiPH2Mvv1UR7mq71PKRVFnoEnHonk NM0UK66hWHtjZbPk1jwADKBdFCWCj7YcSf+UaPgA= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 C44C56F15B for ; Thu, 11 Aug 2022 14:27:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C44C56F15B Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1oM6Lh-0002YE-U1; Thu, 11 Aug 2022 14:27:38 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Thu, 11 Aug 2022 14:17:40 +0300 Message-Id: X-Mailer: git-send-email 2.34.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD999D8F08CF16C6CA79ACFAA45972A9968752632FD6EF6491E00894C459B0CD1B9E898FAAE5987E987EDE604CBC408BE0E1C9930A848CFA68E45849E6DFAE0F427 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72E4E5201E1C2E308EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372CFCDE0CF3C283B78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8A76DF9F92CD3241E256513BE45968D76117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC59F0E22272DBA2DBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B569F1129A2C6445075ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C41E93BD56E7067354307CAA32FF218580205367B2BCC23E5B0D53CE0FDF8446B28329FE0B6AC8C886CFC4036BBF6A4EA9BF8C51168CD8EBDB73EEC7B84CCB0707EA2342758AE768C2AA817B2FB80CBF9EDBE8DEE28BC9005C607A166577E963308859CA687ABA27BA3F35CF8C0A0451E8631B59FF249C74D7589120F7DAE46353205367B2BCC23E5B01D2833353C8CBA3638A446BE3E5C627BF0CFE790FC11A7261332C5CB50AE517886A5961035A09600383DAD389E261318FB05168BE4CE3AF X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34181D1E89D5A0B42F29C8B17BB625B9BB0C32614D1CC3763628B9FA4678044008ADFA9C297692F7D81D7E09C32AA3244C876C776FC3170CE0F385883BC1837C9533C9DC155518937F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojfXJM3siCnClvApobGlbisg== X-Mailru-Sender: 689FA8AB762F7393CC2E0F076E87284E2C2C64FB880E539A856C6A9D5C528FDEA7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 1/8] test: introduce LUAJIT_TEST_VARDIR variable 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Before the patch both memprof and sysprof artefacts are generated within the binary artefacts tree (i.e. in the same directory LuaJIT binary is generated). However, more convenient way is producing these temporary profiles in a separate directory (e.g. located on the partition with more strict space limits). As a result of the patch all memprof and sysprof test chunks consider LUAJIT_TEST_VARDIR environment variable to set the directory where test profiles are generated. For the case when LUAJIT_TEST_VARDIR is not set, everything works as before. Part of tarantool/tarantool#7472 Signed-off-by: Igor Munkin --- .../gh-5813-resolving-of-c-symbols.test.lua | 6 +++-- .../misclib-memprof-lapi.test.lua | 22 ++++++++++--------- .../misclib-sysprof-lapi.test.lua | 8 ++++--- test/tarantool-tests/utils.lua | 12 ++++++++++ 4 files changed, 33 insertions(+), 15 deletions(-) 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 d589dddf..e0b6d86d 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 @@ -1,5 +1,7 @@ -- Memprof is implemented for x86 and x64 architectures only. -require("utils").skipcond( +local utils = require("utils") + +utils.skipcond( jit.arch ~= "x86" and jit.arch ~= "x64" or jit.os ~= "Linux", jit.arch.." architecture or "..jit.os.. " OS is NIY for memprof c symbols resolving" @@ -18,7 +20,7 @@ local testboth = require "resboth" local testhash = require "reshash" local testgnuhash = require "resgnuhash" -local TMP_BINFILE = arg[0]:gsub(".+/([^/]+)%.test%.lua$", "%.%1.memprofdata.tmp.bin") +local TMP_BINFILE = utils.profilename("memprofdata.tmp.bin") local function tree_contains(node, name) if node == nil then diff --git a/test/tarantool-tests/misclib-memprof-lapi.test.lua b/test/tarantool-tests/misclib-memprof-lapi.test.lua index a11f0be1..bae0c27c 100644 --- a/test/tarantool-tests/misclib-memprof-lapi.test.lua +++ b/test/tarantool-tests/misclib-memprof-lapi.test.lua @@ -1,5 +1,7 @@ -- Memprof is implemented for x86 and x64 architectures only. -require("utils").skipcond( +local utils = require("utils") + +utils.skipcond( jit.arch ~= "x86" and jit.arch ~= "x64", jit.arch.." architecture is NIY for memprof" ) @@ -26,8 +28,8 @@ local memprof = require "memprof.parse" local process = require "memprof.process" local symtab = require "utils.symtab" -local TMP_BINFILE = arg[0]:gsub(".+/([^/]+)%.test%.lua$", "%.%1.memprofdata.tmp.bin") -local BAD_PATH = arg[0]:gsub(".+/([^/]+)%.test%.lua$", "%1/memprofdata.tmp.bin") +local TMP_BINFILE = utils.profilename("memprofdata.tmp.bin") +local BAD_PATH = utils.profilename("memprofdata/tmp.bin") local SRC_PATH = "@"..arg[0] local function default_payload() @@ -189,9 +191,9 @@ test:test("output", function(subtest) -- one is the number of allocations. 1 event - alocation of -- table by itself + 1 allocation of array part as far it is -- bigger than LJ_MAX_COLOSIZE (16). - subtest:ok(check_alloc_report(alloc, { line = 35, linedefined = 33 }, 2)) + subtest:ok(check_alloc_report(alloc, { line = 37, linedefined = 35 }, 2)) -- 20 strings allocations. - subtest:ok(check_alloc_report(alloc, { line = 40, linedefined = 33 }, 20)) + subtest:ok(check_alloc_report(alloc, { line = 42, linedefined = 35 }, 20)) -- Collect all previous allocated objects. subtest:ok(free.INTERNAL.num == 22) @@ -199,8 +201,8 @@ test:test("output", function(subtest) -- Tests for leak-only option. -- See also https://github.com/tarantool/tarantool/issues/5812. local heap_delta = process.form_heap_delta(events, symbols) - local tab_alloc_stats = heap_delta[form_source_line(35)] - local str_alloc_stats = heap_delta[form_source_line(40)] + local tab_alloc_stats = heap_delta[form_source_line(37)] + local str_alloc_stats = heap_delta[form_source_line(42)] subtest:ok(tab_alloc_stats.nalloc == tab_alloc_stats.nfree) subtest:ok(tab_alloc_stats.dbytes == 0) subtest:ok(str_alloc_stats.nalloc == str_alloc_stats.nfree) @@ -291,10 +293,10 @@ test:test("jit-output", function(subtest) -- 10 allocations in interpreter mode, 1 allocation for a trace -- recording and assembling and next 9 allocations will happen -- while running the trace. - subtest:ok(check_alloc_report(alloc, { line = 40, linedefined = 33 }, 11)) - subtest:ok(check_alloc_report(alloc, { traceno = 1, line = 38 }, 9)) + subtest:ok(check_alloc_report(alloc, { line = 42, linedefined = 35 }, 11)) + subtest:ok(check_alloc_report(alloc, { traceno = 1, line = 40 }, 9)) -- See same checks with jit.off(). - subtest:ok(check_alloc_report(alloc, { line = 35, linedefined = 33 }, 2)) + subtest:ok(check_alloc_report(alloc, { line = 37, linedefined = 35 }, 2)) -- Restore default JIT settings. jit.opt.start(unpack(jit_opt_default)) diff --git a/test/tarantool-tests/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/misclib-sysprof-lapi.test.lua index 9e0a8a77..dbff41b0 100644 --- a/test/tarantool-tests/misclib-sysprof-lapi.test.lua +++ b/test/tarantool-tests/misclib-sysprof-lapi.test.lua @@ -1,6 +1,8 @@ -- Sysprof is implemented for x86 and x64 architectures only. local ffi = require("ffi") -require("utils").skipcond( +local utils = require("utils") + +utils.skipcond( jit.arch ~= "x86" and jit.arch ~= "x64" or jit.os ~= "Linux" or ffi.abi("gc64"), jit.arch.." architecture or "..jit.os.. @@ -19,8 +21,8 @@ local bufread = require("utils.bufread") local symtab = require("utils.symtab") local sysprof = require("sysprof.parse") -local TMP_BINFILE = arg[0]:gsub(".+/([^/]+)%.test%.lua$", "%.%1.sysprofdata.tmp.bin") -local BAD_PATH = arg[0]:gsub(".+/([^/]+)%.test%.lua$", "%1/sysprofdata.tmp.bin") +local TMP_BINFILE = utils.profilename("sysprofdata.tmp.bin") +local BAD_PATH = utils.profilename("sysprofdata/tmp.bin") local function payload() local function fib(n) diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua index a1906498..87f7ff15 100644 --- a/test/tarantool-tests/utils.lua +++ b/test/tarantool-tests/utils.lua @@ -123,4 +123,16 @@ function M.hasbc(f, bytecode) return hasbc end +function M.profilename(name) + local vardir = os.getenv('LUAJIT_TEST_VARDIR') + -- Replace pattern will change directory name of the generated + -- profile to LUAJIT_TEST_VARDIR if it is set in the process + -- environment. Otherwise, the original dirname is left intact. + -- As a basename for this profile the test name is concatenated + -- with the name given as an argument. + local replacepattern = ('%s/%s-%s'):format(vardir or '%1', '%2', name) + -- XXX: return only the resulting string. + return (arg[0]:gsub('^(.+)/([^/]+)%.test%.lua$', replacepattern)) +end + return M -- 2.34.0