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 03383CE8A24; Tue, 16 Apr 2024 15:02:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 03383CE8A24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1713268935; bh=tkE/Dukcgj+bY0REDJMD+QTWc3f81IRer00N/qK2qYQ=; 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=VpQgTr3pKlVcvJO3XVNi6x6OXsHw87ypVikjxNzj1WG25Xb3HRAgr9cGgLSHn7mse veiPvx+ug8RSyLfrmieWSgyfC870gYgPEiYmPBbQn/2gta/IRXfG89OC38uPWxhUem GWvmCvhVmQ7eegXAaVS0CA44oFIT5hnlSo8wMk5I= Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [95.163.41.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 85047CE8A2F for ; Tue, 16 Apr 2024 15:02:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 85047CE8A2F Received: by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1rwhVs-0000000EKk6-35WX; Tue, 16 Apr 2024 15:02:13 +0300 Content-Type: multipart/alternative; boundary="------------yl2SMI23kMUzQd24Y2pFw5xA" Message-ID: <1ef94cc7-3019-41f6-bec8-f97430549f54@tarantool.org> Date: Tue, 16 Apr 2024 15:02:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Sergey Bronnikov References: <9234535074cc11e0682353c0e5e865bb22cd88f0.1712841312.git.sergeyb@tarantool.org> In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D327C87852EB66D3EF14B4DA64C5A2F0D1685CB8F07D9C77182A05F53808504089F8BDCF42C33B8F03ED270C30F246C5CAC1C9AB87890D12860EB0E208F3F73A670C804921C9F221 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C6068CE86C2B75F5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637802D3462438662818638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83E822B2C4AB1FAF42B75589A73B32B8DFF17A1F6E224EB1FCC7F00164DA146DAFE8445B8C89999728AA50765F790063735D2385A5E2B3AC3389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC878444BBB7636F62AF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C5E3BF8C76DC23F74302FCEF25BFAB3454AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3663A3A66E4CB0153BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF17B107DEF921CE791DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C328505141BAE32B3435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5012F5221F2BC11B75002B1117B3ED6965B2DC576468F8E42886DC9BC01168B20823CB91A9FED034534781492E4B8EEAD69BF13FED57427F1BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF718BE97C9F4C6CB8DD9D54156657E04046FEE673ED7902F644094E410D6DF6C59AB7DC20417E2115C84F44966DD9651B7FAF69CEFB25566507BE10BBDA2B7352626105D5CB82F72EC226CC413062362A913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojwhzzK0WJvz17DEJMpe+bMg== X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B595F6700BAB7F0C86C03ED270C30F246C5CAC1C9AB87890D12B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/4][v2] test: introduce a helper read_file 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------yl2SMI23kMUzQd24Y2pFw5xA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey On 12.04.2024 13:47, Sergey Kaplun wrote: > Hi, Sergey! > Thanks for the fixes! > LGTM, after fixing two nits below. > > On 11.04.24, Sergey Bronnikov wrote: >> From: Sergey Bronnikov >> > > >> diff --git a/test/tarantool-tests/lj-366-strtab-correct-size.test.lua b/test/tarantool-tests/lj-366-strtab-correct-size.test.lua >> index 8a97a441..580fce09 100644 >> --- a/test/tarantool-tests/lj-366-strtab-correct-size.test.lua >> +++ b/test/tarantool-tests/lj-366-strtab-correct-size.test.lua >> @@ -9,6 +9,7 @@ local test = tap.test('lj-366-strtab-correct-size'):skipcond({ >> }) >> >> local ffi = require 'ffi' >> +local utils = require('utils') > > >> -- Parses a buffer in an ELF format and returns an offset and a size of strtab >> -- and symtab sections. >> local function read_elf(elf_content) >> @@ -172,7 +165,7 @@ end >> test:plan(3) >> >> local elf_filename = create_obj_file(MODULE_NAME) >> -local elf_content = read_file(elf_filename) >> +local elf_content = require('utils').tools.read_file(elf_filename) > Nit: s/require('utils')/utils/ > Rationale: `utils` are already required above. Fixed. > >> assert(#elf_content ~= 0, 'cannot read an object file') >> >> local strtab, symtab = read_elf(elf_content) >> diff --git a/test/tarantool-tests/utils/tools.lua b/test/tarantool-tests/utils/tools.lua >> index f35c6922..a2556e32 100644 >> --- a/test/tarantool-tests/utils/tools.lua >> +++ b/test/tarantool-tests/utils/tools.lua >> @@ -12,4 +12,12 @@ function M.profilename(name) >> return (arg[0]:gsub('^(.+)/([^/]+)%.test%.lua$', replacepattern)) >> end >> >> +-- Reads a file located at a specified path and returns its content. > Nit: Comment line width is more than 66 symbols. Fixed. > >> +function M.read_file(path) >> + local file = assert(io.open(path), 'cannot open an object file') >> + local content =file:read('*a') >> +file:close() >> + return content >> +end >> + >> return M >> -- >> 2.34.1 >> --------------yl2SMI23kMUzQd24Y2pFw5xA Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey

On 12.04.2024 13:47, Sergey Kaplun wrote:
Hi, Sergey!
Thanks for the fixes!
LGTM, after fixing two nits below.

On 11.04.24, Sergey Bronnikov wrote:
From: Sergey Bronnikov <sergeyb@tarantool.org>

<snipped>

diff --git a/test/tarantool-tests/lj-366-strtab-correct-size.test.lua b/test/tarantool-tests/lj-366-strtab-correct-size.test.lua
index 8a97a441..580fce09 100644
--- a/test/tarantool-tests/lj-366-strtab-correct-size.test.lua
+++ b/test/tarantool-tests/lj-366-strtab-correct-size.test.lua
@@ -9,6 +9,7 @@ local test = tap.test('lj-366-strtab-correct-size'):skipcond({
 })
 
 local ffi = require 'ffi'
+local utils = require('utils')
<snipped>

 -- Parses a buffer in an ELF format and returns an offset and a size of strtab
 -- and symtab sections.
 local function read_elf(elf_content)
@@ -172,7 +165,7 @@ end
 test:plan(3)
 
 local elf_filename = create_obj_file(MODULE_NAME)
-local elf_content = read_file(elf_filename)
+local elf_content = require('utils').tools.read_file(elf_filename)
Nit: s/require('utils')/utils/
Rationale: `utils` are already required above.
Fixed.

 assert(#elf_content ~= 0, 'cannot read an object file')
 
 local strtab, symtab = read_elf(elf_content)
diff --git a/test/tarantool-tests/utils/tools.lua b/test/tarantool-tests/utils/tools.lua
index f35c6922..a2556e32 100644
--- a/test/tarantool-tests/utils/tools.lua
+++ b/test/tarantool-tests/utils/tools.lua
@@ -12,4 +12,12 @@ function M.profilename(name)
   return (arg[0]:gsub('^(.+)/([^/]+)%.test%.lua$', replacepattern))
 end
 
+-- Reads a file located at a specified path and returns its content.
Nit: Comment line width is more than 66 symbols.
Fixed.

+function M.read_file(path)
+  local file = assert(io.open(path), 'cannot open an object file')
+  local content = file:read('*a')
+  file:close()
+  return content
+end
+
 return M
-- 
2.34.1


    
--------------yl2SMI23kMUzQd24Y2pFw5xA--