[Tarantool-patches] [PATCH luajit 3/7] test: stop using utils.selfrun in tests

Sergey Kaplun skaplun at tarantool.org
Mon Feb 27 12:28:22 MSK 2023


Hi, Igor!
Thanks for the fixes!

LGTM, just a minor nit below!

On 27.02.23, Igor Munkin wrote:
> Sergey,
> 
> Thanks for your review! See my answers below.
> 

<snipped>

> > 
> > > +    REDIRECT = opts and opts.redirect or '',
> > > +  }, {
> > > +    __call = function(self, ...)
> > > +      local cmd = ('<ENV> <LUABIN> <REDIRECT> <SCRIPT>'):gsub('%<(%w+)>', self)
> > > +                  .. (' %s'):rep(select('#', ...)):format(...)
> > 
> > It's good to comment that we just format arguments to strings for the
> > script invocaiton.
> 
> Well, yeah... my Perl background is coming out ;)
> 
> Anyway, here is the comment:
> 
> ================================================================================
> 
> diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua
> index ac04c01d..f5e08043 100644
> --- a/test/tarantool-tests/tap.lua
> +++ b/test/tarantool-tests/tap.lua
> @@ -60,8 +65,17 @@ function M.makecmd(arg, opts)
>      REDIRECT = opts and opts.redirect or '',
>    }, {
>      __call = function(self, ...)
> +      -- This line just makes the command for <io.popen> by the
> +      -- following steps:
> +      -- 1. Replace the placeholders with the corresponding values
> +      --    given to the command constructor (e.g. script, env)
> +      -- 2. Join all CLI arguments given to the __call metamethod
> +      -- 3. Concatenate the results of step 1 and step 2 to obtain
> +      --    the resulting command.

Extra dot in the end of the list (or missing in the previous bullets).

>        local cmd = ('<ENV> <LUABIN> <REDIRECT> <SCRIPT>'):gsub('%<(%w+)>', self)
>                    .. (' %s'):rep(select('#', ...)):format(...)
> +      -- Trim both leading and trailing whitespace from the output
> +      -- produced by the child process.
>        return io.popen(cmd):read('*all'):gsub('^%s+', ''):gsub('%s+$', '')
>      end
>    })
> 
> ================================================================================
> 
> > 
> > > +      return io.popen(cmd):read('*all'):gsub('^%s+', ''):gsub('%s+$', '')
> > > +    end
> > > +  })
> > >  end
> > >  
> > >  function M.skipcond(condition, message)
> > > -- 
> > > 2.30.2
> > > 
> > 
> > -- 
> > Best regards,
> > Sergey Kaplun
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list