Tarantool development patches archive
 help / color / mirror / Atom feed
From: Maxim Kokryashkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, imun@tarantool.org,
	skaplun@tarantool.org
Subject: [Tarantool-patches] [PATCH v2 08/10] test: support tarantool cli in lua-Harness
Date: Tue, 20 Jul 2021 19:26:56 +0300	[thread overview]
Message-ID: <39f288e9c6c4722433599ab33371ecd2470f1125.1626797225.git.m.kokryashkin@tarantool.org> (raw)
In-Reply-To: <cover.1626797225.git.m.kokryashkin@tarantool.org>

The patch[1] from lua-Harness suite adds some specific checks to
lua-Harness tests, so they are compatible with Tarantool now.

Considering this, commit d4e12d7ac28e3bc857d30971dd77deec66a67297('test:
disable LuaJIT CLI tests in lua-Harness suite'), which disabled
tarantool cli tests, can be superseded.

As a result, the introduced assertion for Tarantool error message fails
on MacOS, since getopt_long(3) yields the error message without single
quotes wrapping the flag. Hence, this commit also includes fix for that
from patch[2] in the trunk.

[1]: https://framagit.org/fperrad/lua-Harness/-/commit/1da5b1b3
[2]: https://framagit.org/fperrad/lua-Harness/-/commit/a0532c5
---
Additional information on issue with MacOS:
https://github.com/tarantool/tarantool/issues/5970#issuecomment-880158605

NOTICE: tests for this separate commit are failing on FreeBSD

 test/lua-Harness-tests/241-standalone.t | 79 +++++++++++++++++++------
 1 file changed, 61 insertions(+), 18 deletions(-)

diff --git a/test/lua-Harness-tests/241-standalone.t b/test/lua-Harness-tests/241-standalone.t
index 57d9e5bd..e4cf83b5 100755
--- a/test/lua-Harness-tests/241-standalone.t
+++ b/test/lua-Harness-tests/241-standalone.t
@@ -29,21 +29,18 @@ L<https://www.lua.org/manual/5.4/manual.html#7>
 --]]
 
 require'test_assertion'
-
-if _TARANTOOL then
-    skip_all("tarantool")
-end
-
-local has_bytecode = not ujit and not ravi
+local has_bytecode = not ujit and not ravi and not _TARANTOOL
 local has_error52 = _VERSION >= 'Lua 5.2'
 local has_error53 = _VERSION >= 'Lua 5.3'
-local has_opt_E = _VERSION >= 'Lua 5.2' or jit
+local has_opt_E = _VERSION >= 'Lua 5.2' or (jit and not _TARANTOOL)
 local has_opt_W = _VERSION >= 'Lua 5.4'
 local banner = '^[%w%s%-%.]-Copyright %(C%) %d%d%d%d'
 if jit and jit.version:match'^RaptorJIT' then
     banner = '^[%w%s%.]- %-%- '
 elseif ravi then
     banner = '^Ravi %d%.%d%.%d'
+elseif _TARANTOOL then
+    banner = '^Tarantool %d%.%d+%.%d+'
 end
 
 local lua = _retrieve_progname()
@@ -74,7 +71,11 @@ f:close()
 
 cmd = lua .. " no_file-241.lua 2>&1"
 f = io.popen(cmd)
-matches(f:read'*l', "^[^:]+: cannot open no_file%-241%.lua", "no file")
+if _TARANTOOL then
+    matches(f:read'*l', "Can't open script no_file%-241%.lua", "no file")
+else
+    matches(f:read'*l', "^[^:]+: cannot open no_file%-241%.lua", "no file")
+end
 f:close()
 
 if has_bytecode then
@@ -121,6 +122,9 @@ if ravi then
     matches(f:read'*l', '^Portions Copyright %(C%)')
     matches(f:read'*l', '^Options')
 end
+if _TARANTOOL then
+    matches(f:read'*l', "^type 'help' for interactive help")
+end
 equals(f:read'*l', 'Hello World')
 f:close()
 
@@ -131,18 +135,26 @@ f:close()
 
 cmd = lua .. [[ -e "error('msg')"  2>&1]]
 f = io.popen(cmd)
-equals(f:read'*l', lua .. [[: (command line):1: msg]], "error")
-equals(f:read'*l', "stack traceback:", "backtrace")
+if _TARANTOOL then
+    equals(f:read'*l', "LuajitError: (command line):1: msg", "error")
+    equals(f:read'*l', "fatal error, exiting the event loop")
+else
+    equals(f:read'*l', lua .. [[: (command line):1: msg]], "error")
+    equals(f:read'*l', "stack traceback:", "backtrace")
+end
 f:close()
 
 cmd = lua .. [[ -e "error(setmetatable({}, {__tostring=function() return 'MSG' end}))"  2>&1]]
 f = io.popen(cmd)
-if has_error52 or jit then
+if _TARANTOOL then
+    equals(f:read'*l', "LuajitError: MSG", "error with object")
+    equals(f:read'*l', "fatal error, exiting the event loop")
+elseif has_error52 or jit then
     equals(f:read'*l', lua .. [[: MSG]], "error with object")
 else
     equals(f:read'*l', lua .. [[: (error object is not a string)]], "error with object")
 end
-if jit then
+if jit and not _TARANTOOL then
     equals(f:read'*l', "stack traceback:", "backtrace")
 else
     equals(f:read'*l', nil, "not backtrace")
@@ -157,6 +169,10 @@ if has_error53 then
 elseif has_error52 then
     equals(f:read'*l', lua .. [[: (no error message)]], "error")
     equals(f:read'*l', nil, "not backtrace")
+elseif _TARANTOOL then
+    matches(f:read'*l', "^LuajitError: table: ", "error")
+    equals(f:read'*l', "fatal error, exiting the event loop")
+    equals(f:read'*l', nil, "not backtrace")
 else
     equals(f:read'*l', lua .. [[: (error object is not a string)]], "error")
     equals(f:read'*l', nil, "not backtrace")
@@ -184,12 +200,21 @@ f = io.popen(cmd)
 if _VERSION ~= 'Lua 5.1' then
     matches(f:read'*l', "^[^:]+: '%-e' needs argument", "-e w/o arg")
 end
-matches(f:read'*l', "^usage: ")
+if _TARANTOOL then
+    matches(f:read'*l', "^[^:]+: option requires an argument %-%- '?e'?", "-e w/o arg")
+else
+    matches(f:read'*l', "^usage: ")
+end
 f:close()
 
 cmd = lua .. [[ -v 2>&1]]
 f = io.popen(cmd)
 matches(f:read'*l', banner, "-v")
+if _TARANTOOL then
+    matches(f:read'*l', '^Target: ')
+    matches(f:read'*l', '^Build options: ')
+    matches(f:read'*l', '^Compiler: ')
+end
 f:close()
 
 cmd = lua .. [[ -v hello-241.lua 2>&1]]
@@ -200,12 +225,24 @@ if ravi then
     matches(f:read'*l', '^Portions Copyright %(C%)')
     matches(f:read'*l', '^Options')
 end
-equals(f:read'*l', 'Hello World')
+if _TARANTOOL then
+    matches(f:read'*l', '^Target: ')
+    matches(f:read'*l', '^Build options: ')
+    matches(f:read'*l', '^Compiler: ')
+    -- script is not runned
+else
+    equals(f:read'*l', 'Hello World')
+end
 f:close()
 
 cmd = lua .. [[ -v -- 2>&1]]
 f = io.popen(cmd)
 matches(f:read'*l', banner, "-v --")
+if _TARANTOOL then
+    matches(f:read'*l', '^Target: ')
+    matches(f:read'*l', '^Build options: ')
+    matches(f:read'*l', '^Compiler: ')
+end
 f:close()
 
 if has_opt_E then
@@ -222,15 +259,21 @@ f = io.popen(cmd)
 if _VERSION ~= 'Lua 5.1' then
     matches(f:read'*l', "^[^:]+: unrecognized option '%-u'", "unknown option")
 end
-matches(f:read'*l', "^usage: ")
+if _TARANTOOL then
+    matches(f:read'*l', "^[^:]+: invalid option %-%- '?u'?", "unknown option")
+else
+    matches(f:read'*l', "^usage: ")
+end
 f:close()
 
 cmd = lua .. [[ --u 2>&1]]
 f = io.popen(cmd)
-if _VERSION ~= 'Lua 5.1' then
-    matches(f:read'*l', "^[^:]+: unrecognized option '%-%-u'", "unknown option")
+if _VERSION ~= 'Lua 5.1' or _TARANTOOL then
+    matches(f:read'*l', "^[^:]+: unrecognized option [`']%-%-u'", "unknown option")
+end
+if not _TARANTOOL then
+    matches(f:read'*l', "^usage: ")
 end
-matches(f:read'*l', "^usage: ")
 f:close()
 
 f = io.open('foo.lua', 'w')
-- 
2.32.0


  parent reply	other threads:[~2021-07-20 16:31 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 16:26 [Tarantool-patches] [PATCH v2 00/10] test: lua-Harness suite patch bump Maxim Kokryashkin via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 01/10] test: port lua-Harness to Test.Assertion Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:08   ` Igor Munkin via Tarantool-patches
2021-07-26 10:38     ` Максим Корякшин via Tarantool-patches
2021-07-27  6:41       ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:18         ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 02/10] test: rename lua-Harness tap to test_assertion Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:08   ` Igor Munkin via Tarantool-patches
2021-07-27  6:27   ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 03/10] test: use CI friendly variables in lua-Harness Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:09   ` Igor Munkin via Tarantool-patches
2021-07-27  9:01     ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:23       ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 04/10] test: refactor with _retrieve_progname Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:09   ` Igor Munkin via Tarantool-patches
2021-07-27  9:27     ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:28       ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 05/10] test: refactor with _dofile Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:10   ` Igor Munkin via Tarantool-patches
2021-07-26 12:11     ` Максим Корякшин via Tarantool-patches
2021-07-27  9:34       ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:36         ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 06/10] test: support tarantool in lua-Harness Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:11   ` Igor Munkin via Tarantool-patches
2021-07-26 11:07     ` Максим Корякшин via Tarantool-patches
2021-07-26 19:46       ` Igor Munkin via Tarantool-patches
2021-07-27 10:04   ` Sergey Kaplun via Tarantool-patches
2021-07-28 17:40     ` Максим Корякшин via Tarantool-patches
2021-07-28 17:42     ` Максим Корякшин via Tarantool-patches
2021-07-28 18:34       ` Sergey Kaplun via Tarantool-patches
2021-07-29  9:19         ` Максим Корякшин via Tarantool-patches
2021-07-29  9:22           ` Igor Munkin via Tarantool-patches
2021-07-29 10:12             ` Максим Корякшин via Tarantool-patches
2021-07-29  9:47           ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 07/10] test: backport lua-Harness directory detection Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:12   ` Igor Munkin via Tarantool-patches
2021-07-26 11:13     ` Максим Корякшин via Tarantool-patches
2021-07-28 18:37       ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` Maxim Kokryashkin via Tarantool-patches [this message]
2021-07-25 21:13   ` [Tarantool-patches] [PATCH v2 08/10] test: support tarantool cli in lua-Harness Igor Munkin via Tarantool-patches
2021-07-26 11:17     ` Максим Корякшин via Tarantool-patches
2021-07-26 19:53       ` Igor Munkin via Tarantool-patches
2021-07-28 18:44       ` Sergey Kaplun via Tarantool-patches
2021-07-28 18:50         ` Sergey Kaplun via Tarantool-patches
2021-07-29  9:23         ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 09/10] test: update lua-Harness to b7b1a9a2 Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:14   ` Igor Munkin via Tarantool-patches
2021-07-26 12:21     ` Максим Корякшин via Tarantool-patches
2021-07-26 20:04       ` Igor Munkin via Tarantool-patches
2021-07-28 18:48       ` Sergey Kaplun via Tarantool-patches
2021-07-29  9:27         ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 10/10] test: disable test/lua-Harness-tests/241-standalone.t on FreeBSD Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:17   ` Igor Munkin via Tarantool-patches
2021-07-26 12:31     ` Максим Корякшин via Tarantool-patches
2021-07-26 12:32       ` Максим Корякшин via Tarantool-patches
2021-07-26 12:36         ` Максим Корякшин via Tarantool-patches
2021-07-26 20:13           ` Igor Munkin via Tarantool-patches
2021-07-27  6:21           ` Sergey Kaplun via Tarantool-patches
2021-07-29  9:41             ` Максим Корякшин via Tarantool-patches
2021-07-29  9:45               ` Sergey Kaplun via Tarantool-patches
2021-07-29  9:57                 ` Максим Корякшин via Tarantool-patches
2021-07-30 17:09                   ` Igor Munkin via Tarantool-patches
2021-07-25 21:03 ` [Tarantool-patches] [PATCH v2 00/10] test: lua-Harness suite patch bump Igor Munkin via Tarantool-patches
2021-07-30 19:19 ` 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=39f288e9c6c4722433599ab33371ecd2470f1125.1626797225.git.m.kokryashkin@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 08/10] test: support tarantool cli in lua-Harness' \
    /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