Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite
@ 2021-04-16 18:21 Sergey Kaplun via Tarantool-patches
  2021-04-19 13:42 ` Igor Munkin via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2021-04-16 18:21 UTC (permalink / raw)
  To: Igor Munkin, Sergey Ostanevich; +Cc: tarantool-patches

<314-regex.t> uses `arg[0]:find'314'` to determine the name of the
directory where rx_* files are located. This leads to the test
failure, when lua-Harness suite run in the directory containing
"314" in its name, because the found path doesn't contain the required
files.

This patch fixes directory name detection.

Follows up tarantool/tarantool#5844
---

I tested it locally on branch in directory containing "314" in the name.
Also, I grepped the test suites with "find", "match", "sub" patterns,
but didn't see other places with such bug like that.

Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-harness-314-find-bug
Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-harness-314-find-bug

 test/lua-Harness-tests/314-regex.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lua-Harness-tests/314-regex.t b/test/lua-Harness-tests/314-regex.t
index ad4554cd..58cdb66e 100755
--- a/test/lua-Harness-tests/314-regex.t
+++ b/test/lua-Harness-tests/314-regex.t
@@ -164,7 +164,7 @@ local function split (line)
 end
 
 local test_number = 0
-local dirname = arg[0]:sub(1, arg[0]:find'314' -1)
+local dirname = arg[0]:gsub('([^/]+)%.t$', '')
 for _, filename in ipairs(test_files) do
     local f, msg = io.open(dirname .. filename, 'r')
     if f == nil then
-- 
2.31.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite
  2021-04-16 18:21 [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite Sergey Kaplun via Tarantool-patches
@ 2021-04-19 13:42 ` Igor Munkin via Tarantool-patches
  2021-04-19 14:09 ` Sergey Ostanevich via Tarantool-patches
  2021-04-19 19:39 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2021-04-19 13:42 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Sergey,

Nice catch, thanks! The bug is awesome, like it! The patch itself LGTM.

On 16.04.21, Sergey Kaplun wrote:
> <314-regex.t> uses `arg[0]:find'314'` to determine the name of the
> directory where rx_* files are located. This leads to the test
> failure, when lua-Harness suite run in the directory containing
> "314" in its name, because the found path doesn't contain the required
> files.
> 
> This patch fixes directory name detection.
> 
> Follows up tarantool/tarantool#5844
> ---
> 
> I tested it locally on branch in directory containing "314" in the name.
> Also, I grepped the test suites with "find", "match", "sub" patterns,
> but didn't see other places with such bug like that.

Great, thanks! I'll report the bug to François later.

> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-harness-314-find-bug
> Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-harness-314-find-bug
> 
>  test/lua-Harness-tests/314-regex.t | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/lua-Harness-tests/314-regex.t b/test/lua-Harness-tests/314-regex.t
> index ad4554cd..58cdb66e 100755
> --- a/test/lua-Harness-tests/314-regex.t
> +++ b/test/lua-Harness-tests/314-regex.t
> @@ -164,7 +164,7 @@ local function split (line)
>  end
>  
>  local test_number = 0
> -local dirname = arg[0]:sub(1, arg[0]:find'314' -1)
> +local dirname = arg[0]:gsub('([^/]+)%.t$', '')
>  for _, filename in ipairs(test_files) do
>      local f, msg = io.open(dirname .. filename, 'r')
>      if f == nil then
> -- 
> 2.31.0
> 

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite
  2021-04-16 18:21 [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite Sergey Kaplun via Tarantool-patches
  2021-04-19 13:42 ` Igor Munkin via Tarantool-patches
@ 2021-04-19 14:09 ` Sergey Ostanevich via Tarantool-patches
  2021-04-19 19:39 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Sergey Ostanevich via Tarantool-patches @ 2021-04-19 14:09 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Hi!

Thanks for the patch! 
Just couple nits, LGTM.

Sergos

> On 16 Apr 2021, at 21:21, Sergey Kaplun <skaplun@tarantool.org> wrote:
> 
> <314-regex.t> uses `arg[0]:find'314'` to determine the name of the
 ^
A test ... 

Perhaps it’s just me, but I had a hard time to get rid of feeling I read
a hypertext in plain format. 

> directory where rx_* files are located. This leads to the test
> failure, when lua-Harness suite run in the directory containing
                                         ^ a
You do not refer to a particular directory here, rather say ‘consider it is
run in a directory …'

> "314" in its name, because the found path doesn't contain the required
> files.
> 
> This patch fixes directory name detection.
> 
> Follows up tarantool/tarantool#5844
> ---
> 
> I tested it locally on branch in directory containing "314" in the name.
> Also, I grepped the test suites with "find", "match", "sub" patterns,
> but didn't see other places with such bug like that.
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-harness-314-find-bug
> Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-harness-314-find-bug
> 
> test/lua-Harness-tests/314-regex.t | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/lua-Harness-tests/314-regex.t b/test/lua-Harness-tests/314-regex.t
> index ad4554cd..58cdb66e 100755
> --- a/test/lua-Harness-tests/314-regex.t
> +++ b/test/lua-Harness-tests/314-regex.t
> @@ -164,7 +164,7 @@ local function split (line)
> end
> 
> local test_number = 0
> -local dirname = arg[0]:sub(1, arg[0]:find'314' -1)
> +local dirname = arg[0]:gsub('([^/]+)%.t$', '')
> for _, filename in ipairs(test_files) do
>     local f, msg = io.open(dirname .. filename, 'r')
>     if f == nil then
> -- 
> 2.31.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite
  2021-04-16 18:21 [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite Sergey Kaplun via Tarantool-patches
  2021-04-19 13:42 ` Igor Munkin via Tarantool-patches
  2021-04-19 14:09 ` Sergey Ostanevich via Tarantool-patches
@ 2021-04-19 19:39 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2021-04-19 19:39 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Sergey,

I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in 1.10, 2.6, 2.7 and master.

On 16.04.21, Sergey Kaplun wrote:
> <314-regex.t> uses `arg[0]:find'314'` to determine the name of the
> directory where rx_* files are located. This leads to the test
> failure, when lua-Harness suite run in the directory containing
> "314" in its name, because the found path doesn't contain the required
> files.
> 
> This patch fixes directory name detection.
> 
> Follows up tarantool/tarantool#5844
> ---
> 
> I tested it locally on branch in directory containing "314" in the name.
> Also, I grepped the test suites with "find", "match", "sub" patterns,
> but didn't see other places with such bug like that.
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-harness-314-find-bug
> Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-harness-314-find-bug
> 
>  test/lua-Harness-tests/314-regex.t | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

<snipped>

> -- 
> 2.31.0
> 

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-19 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 18:21 [Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite Sergey Kaplun via Tarantool-patches
2021-04-19 13:42 ` Igor Munkin via Tarantool-patches
2021-04-19 14:09 ` Sergey Ostanevich via Tarantool-patches
2021-04-19 19:39 ` Igor Munkin via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox