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 2F3E56EC55; Tue, 20 Jul 2021 19:31:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2F3E56EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626798696; bh=udvVs03TxuNSZ5LLlE6feI6W0mnO8vBmSvWayTN3h10=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CgZMKOeJ4yB/JdAn0WFPx+IS8jEQZ4ejHOzdpKijT+UGcSOSEWmSik+S8c39nOiJD wp015mHf7OJJZfB7HzYnaq3qmnTiK+7MNyLel88yDPZmcbMZ28FMf0E51KK4uNtcT3 hOrv+cxy18ajHgCc4G8i8V5VyXlcYLjI5VXW5JGU= Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 2BF9B6EC55 for ; Tue, 20 Jul 2021 19:28:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2BF9B6EC55 Received: by mail-lj1-f176.google.com with SMTP id e14so13340293ljo.7 for ; Tue, 20 Jul 2021 09:28:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J707uGRb9j5PpB8PH1ggj0KZWd6WCtekMZi6ZKi4FjA=; b=rD4LE44fLYftXmlK6Y1NlQgg2iUb3Iaei3d/71dfp6NLaGEf8RVwTgmgeYzNFrXqkg APTn4ptwp4mF0l9PER7nmMrr6u93I9FkUhsI2V2Pc88eA5m/I5Xq0ERQ6uJJMzSRs5KD J2b8M4SI9CUkjpYiBZFGFKZrrbns/cmgoI9VSgpa2Ku4SEA2oksK7GuwExShVYdQZTqS mzJRehyER8xkLqx5Fht3zAb9D3BAhCFesokSRX9j84+AsG9DDYid6J4oUo8rw3DaV3zS 7KNOi/qg+ePXW2+hiSLCwHtWFuEkijLyT8varK1L5I5ofwLiEJuh6PGwxL61wubzUMox JvKw== X-Gm-Message-State: AOAM5337GtR/50zvCbXiqOhPZUXILxIgsDmKbyTPb4/m/nd8GEVJ14r3 6/v9BKrLk6eP8O4so169OMCEoGc7kO8HVVOr X-Google-Smtp-Source: ABdhPJxG6dJQ8nopLdrP4WvgM5HD+/2Imt8v8m0vhJ40r6i4G8mHYRujVL6aWBNzpty3fCltUZtBPw== X-Received: by 2002:a05:651c:169c:: with SMTP id bd28mr4325038ljb.286.1626798481428; Tue, 20 Jul 2021 09:28:01 -0700 (PDT) Received: from localhost.localdomain ([2a00:1fa0:44c8:ff00:875c:6e54:99e0:fb4a]) by smtp.gmail.com with ESMTPSA id d8sm1562660lfi.129.2021.07.20.09.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 09:28:00 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Tue, 20 Jul 2021 19:26:56 +0300 Message-Id: <39f288e9c6c4722433599ab33371ecd2470f1125.1626797225.git.m.kokryashkin@tarantool.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 08/10] test: support tarantool cli in lua-Harness 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --]] 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