Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Ostanevich via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/3] test: make utils.selfrun usage easier
Date: Wed, 7 Apr 2021 15:16:33 +0300	[thread overview]
Message-ID: <68071F1B-A6AE-4826-BA62-5FFB04A38A51@tarantool.org> (raw)
In-Reply-To: <20210406183208.GG29703@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 4430 bytes --]

Great, thanks for explanation and comments update!

Sergos

> On 6 Apr 2021, at 21:32, Igor Munkin <imun@tarantool.org> wrote:
> 
> Sergos,
> 
> Thanks for your review!
> 
> On 06.04.21, Sergey Ostanevich wrote:
>> Hi!
>> 
>> LGTM with some ignorable nits below.
> 
> Added your tag:
> | Reviewed-by: Sergey Ostanevich <sergos@tarantool.org <mailto:sergos@tarantool.org>>
> 
>> 
>> Sergos
>> 
>> 
>>> On 5 Apr 2021, at 20:11, Igor Munkin <imun@tarantool.org> wrote:
>>> 
>>> Previous implementation of <utils.selfrun> implicitly obliges the
>>> developer to pass the arguments to the test script for the second run.
>>> This has been unnoticed, since the existing tests are invoked for two
>>> different cases, so the script arguments were kinda obligatory, but they
>>> are not required in a general case.
>>> 
>>> As a result the function signals the testing system that the script is
>>> being run the second time via TEST_SELFRUN environment variable.
>>> 
>> 
>> To me it looks like it was an infinite recursion, that was interrupted
>> only by chance in case a test does not tolerate the reentrance. 
> 
> Precisely. Honestly, it was a "soft" requirement for such tests (as I
> have written above), but considering your attempts with implementing
> tests for JIT machinery, I've finally realized this problem.
> 
>> 
>> 
>>> Signed-off-by: Igor Munkin <imun@tarantool.org <mailto:imun@tarantool.org>>
>>> ---
>>> .../gh-4427-ffi-sandwich.test.lua             | 51 +++++++++----------
>>> .../lj-flush-on-trace.test.lua                | 51 +++++++++----------
>>> test/tarantool-tests/utils.lua                |  7 +++
>>> 3 files changed, 57 insertions(+), 52 deletions(-)
> 
> <snipped>
> 
>>> diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua
>>> index aebbf6ac..d2dd71b0 100644
>>> --- a/test/tarantool-tests/utils.lua
>>> +++ b/test/tarantool-tests/utils.lua
>>> @@ -14,6 +14,12 @@ local function luacmd(args)
>>> end
>>> 
>>> function M.selfrun(arg, checks)
>>> +  -- If TEST_SELFRUN is set, just execute the test payload below
>> 
>> To make a symmetry to the next comment: "we’re running the io.popen version
>> of the test, proceed with test payload execution past "
>> 
>>> +  -- <selfrun> call, ...
>>> +  if os.getenv('TEST_SELFRUN') then return end
>>> +
>>> +  -- ... otherwise run this chunk via <io.popen>.
>> 
>> I would add that the test payload won’t be run and the io.popen results
>> will be reported instead.
> 
> I've adjusted the comments the following way:
> 
> ================================================================================
> 
> diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua
> index 9bdb71ec..c0403cf1 100644
> --- a/test/tarantool-tests/utils.lua
> +++ b/test/tarantool-tests/utils.lua
> @@ -25,11 +25,15 @@ local function unshiftenv(variable, value, sep)
> end
> 
> function M.selfrun(arg, checks)
> -  -- If TEST_SELFRUN is set, just execute the test payload below
> -  -- <selfrun> call, ...
> +  -- If TEST_SELFRUN is set, it means the test has been run via
> +  -- <io.popen>, so just return from this routine and proceed
> +  -- the execution to the test payload, ...
>   if os.getenv('TEST_SELFRUN') then return end
> 
> -  -- ... otherwise run this chunk via <io.popen>.
> +  -- ... otherwise initialize <tap>, setup testing environment
> +  -- and run this chunk via <io.popen> for each case in <checks>.
> +  -- XXX: The function doesn't return back from this moment. It
> +  -- checks whether all assertions are fine and exits.
> 
>   local test = tap.test(arg[0]:match('/?(.+)%.test%.lua'))
> 
> 
> ================================================================================
> 
>> 
>>> +
>>>  local test = tap.test(arg[0]:match('/?(.+)%.test%.lua'))
>>> 
>>>  test:plan(#checks)
>>> @@ -28,6 +34,7 @@ function M.selfrun(arg, checks)
>>>  local cmd = string.gsub('LUA_PATH="<PATH>/?.lua;$LUA_PATH" ' ..
>>>                          'LUA_CPATH="<PATH>/?.<SUFFIX>;$LUA_CPATH" ' ..
>>>                          'LD_LIBRARY_PATH=<PATH>:$LD_LIBRARY_PATH ' ..
>>> +                          'TEST_SELFRUN=1' ..
>>>                          '<LUABIN> 2>&1 <SCRIPT>', '%<(%w+)>', vars)
>>> 
>>>  for _, ch in pairs(checks) do
>>> -- 
>>> 2.25.0
>>> 
>> 
> 
> -- 
> Best regards,
> IM


[-- Attachment #2: Type: text/html, Size: 39891 bytes --]

  reply	other threads:[~2021-04-07 12:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 17:11 [Tarantool-patches] [PATCH luajit 0/3] Fix out-of-source testing on MacOS Igor Munkin via Tarantool-patches
2021-04-05 17:11 ` [Tarantool-patches] [PATCH luajit 1/3] test: remove excess dependency for tests target Igor Munkin via Tarantool-patches
2021-04-06  7:38   ` Sergey Kaplun via Tarantool-patches
2021-04-06  8:02     ` Igor Munkin via Tarantool-patches
2021-04-06  9:51       ` Sergey Kaplun via Tarantool-patches
2021-04-06 15:38   ` Sergey Ostanevich via Tarantool-patches
2021-04-06 16:19     ` Igor Munkin via Tarantool-patches
2021-04-05 17:11 ` [Tarantool-patches] [PATCH luajit 2/3] test: make utils.selfrun usage easier Igor Munkin via Tarantool-patches
2021-04-06 13:01   ` Sergey Kaplun via Tarantool-patches
2021-04-06 13:35     ` Igor Munkin via Tarantool-patches
2021-04-06 16:22   ` Sergey Ostanevich via Tarantool-patches
2021-04-06 18:32     ` Igor Munkin via Tarantool-patches
2021-04-07 12:16       ` Sergey Ostanevich via Tarantool-patches [this message]
2021-04-05 17:11 ` [Tarantool-patches] [PATCH luajit 3/3] test: fix dynamic modules loading on MacOS Igor Munkin via Tarantool-patches
2021-04-06 17:02   ` Sergey Ostanevich via Tarantool-patches
2021-04-06 18:05     ` Igor Munkin via Tarantool-patches
2021-04-07 16:38   ` Sergey Kaplun via Tarantool-patches
2021-04-07 17:33     ` Igor Munkin via Tarantool-patches
2021-04-07 21:17 ` [Tarantool-patches] [PATCH luajit 0/3] Fix out-of-source testing " Igor Munkin 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=68071F1B-A6AE-4826-BA62-5FFB04A38A51@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/3] test: make utils.selfrun usage easier' \
    /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