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 5AA826ECE3; Tue, 21 Jun 2022 16:50:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5AA826ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1655819407; bh=AExbnY9jh8OUeS6W37GRAJt7OCaC11b+klHwHSPz1Ek=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cJ/wVtxdNuF255HAUA1E3/8wEZT76sJZ55v1U/iuUR7Ac5wAJQLERSUQ7vDVxiILL nFZdt/lgjuofDcneYei/cONZqhqUJ3CJ+2rhgGQHJ5aRBpx1e8g3GEIh7WMFr8rtAI 9FoRL3iijcVkDc03GAJ0PbRVF/KgEENMgLLAPkTI= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (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 7631D6ECE3 for ; Tue, 21 Jun 2022 16:50:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7631D6ECE3 Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1o3eGY-0007FA-QR; Tue, 21 Jun 2022 16:50:03 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) In-Reply-To: <20220512100937.24037-1-skaplun@tarantool.org> Date: Tue, 21 Jun 2022 16:50:02 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <9ACEA7D8-7056-4F3A-88FE-D30045D8FDA6@tarantool.org> References: <20220512100937.24037-1-skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3696.100.31) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9B458E015651D1EC0E9AFF79A4B18C9DBBBC81B5FC9F435C3182A05F538085040B6FD2FB5A3C30808EED5A0EB3B8E2B07E7D8C5BA6FCDDD66ECDBAC179EE2B837 X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E14218311A65942F98E5E37866D6147AF826D80F575F5E3D43C5853B558F78AB8C1700F972CCD2F8FE1EF1CFC4036BBF6A4EA9B11811A4A51E3B0915E2725BA614EAEA1EF972C1F679AE1C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34431D0341F6B74DD3E82CFCE85A955B3912AB3F72EDE2D96F2BDE531F6FC3AF2471434647279893561D7E09C32AA3244CFE7AB7F4ACC58BE392118A472087304AA95CA90A1D8AC565FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+ZQCdndr4HnoLDRpw/jf5w== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE40704594F9007546D6EAA99B912612359FDEC924B4D5A5E1CC319381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit] Flush and close output file after profiling run. 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: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! LGTM. Sergos > On 12 May 2022, at 13:09, Sergey Kaplun wrote: >=20 > From: Mike Pall >=20 > Thanks to Sergey Ostanevich. >=20 > Using `jit.p` with a file argument does not flush result to the > file on profile stop. >=20 > This patch adds missing close for the file descriptor on profile stop. >=20 > Sergey Kaplun: > * added the description and the test for the problem > --- >=20 > LuaJIT PR: https://github.com/LuaJIT/LuaJIT/pull/726 > Branch: = https://github.com/tarantool/luajit/tree/skaplun/lj-726-profile-flush-clos= e-full-ci > Tarantool PR: https://github.com/tarantool/tarantool/pull/7128 >=20 > src/jit/p.lua | 1 + > .../lj-726-profile-flush-close.test.lua | 29 +++++++++++++++++++ > 2 files changed, 30 insertions(+) > create mode 100644 = test/tarantool-tests/lj-726-profile-flush-close.test.lua >=20 > diff --git a/src/jit/p.lua b/src/jit/p.lua > index 7be10586..4569d69e 100644 > --- a/src/jit/p.lua > +++ b/src/jit/p.lua > @@ -238,6 +238,7 @@ local function prof_finish() > prof_count1 =3D nil > prof_count2 =3D nil > prof_ud =3D nil > + if out ~=3D stdout then out:close() end > end > end >=20 > diff --git a/test/tarantool-tests/lj-726-profile-flush-close.test.lua = b/test/tarantool-tests/lj-726-profile-flush-close.test.lua > new file mode 100644 > index 00000000..290bd722 > --- /dev/null > +++ b/test/tarantool-tests/lj-726-profile-flush-close.test.lua > @@ -0,0 +1,29 @@ > +local tap =3D require('tap') > + > +local test =3D tap.test('lj-726-profile-flush-close') > +test:plan(1) > + > +local TEST_FILE =3D 'lj-726-profile-flush-close.profile' > + > +local function payload() > + local r =3D 0 > + for i =3D 1, 1e8 do > + r =3D r + i > + end > + return r > +end > + > +local p =3D require('jit.p') > +p.start("f", TEST_FILE) > +payload() > +p.stop() > + > +local f, err =3D io.open(TEST_FILE) > +assert(f, err) > + > +-- Check that file is not empty. > +test:ok(f:read(0), 'profile output was flushed and closed') I wonder if this will ever cause flakiness?=20 > + > +assert(os.remove(TEST_FILE)) > + > +os.exit(test:check() and 0 or 1) > --=20 > 2.34.1 >=20