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 A5F266EC56; Tue, 20 Jul 2021 19:29:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A5F266EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626798573; bh=JFbzXGXopuH7sffEyAg4d5bR6Y4fB7BlI74PCWIO2d0=; 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=M8WohfAXfxhUgUmEh+JSAIR99r/C64g2ByjMGuUhBltIAHVeuMvSExtQRJyh07VMP kgtkfiS6NT3kPurJAcnZl26ANFbY2Xa9icd6QtwStj2gBECS0x2Cmkl7eyrBs43Te/ nKfELsmevsm8yS3WCDjPy7VU5SzyzT2o5+lU4kF4= Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 E1DF46EC5C for ; Tue, 20 Jul 2021 19:27:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E1DF46EC5C Received: by mail-lf1-f52.google.com with SMTP id 8so36605110lfp.9 for ; Tue, 20 Jul 2021 09:27:52 -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=ITg8Mf50HkSiPBzOxVXC7ax1eTEtNipWBsqMxxtdq6Q=; b=LgJvbhK7vyKlfRgjQk0qamKY4ZG4oeuWxx2YpoIxlrF6ttQJZp1aYK6yPFiGUKNtP2 80Qw1j2bBlrQ0zQ6RX9l/nQ+TDI8h57L6gBc94nJMzaUyN1Ywfz3PjGvPy1Cba2URsPY GKgjdQtn2gMz0jFJV3MaWsVH9BsPlet42Yt/JAd0Wa0IN2nDNP9KhX/0/E0N6ItiYHR/ Zt78981HG7CNBxQUrstMx9KOxCzpLyfk8NvDK3xgrXWUPQUbb625pBMUDOJNiiGiWCKd BBaGDJgp1nTAC/wySmBLUV89NC6z3WG5LNeLSPX43OCNSrEJCNIBoFQg8qn0O66/j+mE TPRQ== X-Gm-Message-State: AOAM531qwb+txl7HI1CtSm9lTDE5zCWRE7pvG89r8v/8sake5FAL0Dga VL04LuWxdGPnTquWI1ZdOAxVJQpLTfaHRo4f X-Google-Smtp-Source: ABdhPJzL2KhzuoMeRORB37oN3fBD+k7+kcYttb2xiyVUGHFZIjJIPQdZov8jCi4O+qvKKUbZFmqI9Q== X-Received: by 2002:a05:6512:3148:: with SMTP id s8mr21982666lfi.513.1626798472207; Tue, 20 Jul 2021 09:27:52 -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.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 09:27:51 -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:52 +0300 Message-Id: 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 04/10] test: refactor with _retrieve_progname 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 fixes the same issue commit 837688590919fcf8de47ef90479fd2a640c8fddc ('test: adjust lua-Harness suite to CMake machinery') does except the single difference: `get_lua_binary_name()` is called `_retrieved_progname()`. As a result of this patch the function is renamed to follow the original naming. [1]: https://framagit.org/fperrad/lua-Harness/-/commit/1be25a8 Part of tarantool/tarantool#5970 Part of tarantool/tarantool#4473 --- .../241-standalone.t.disabled | 2 +- test/lua-Harness-tests/242-luac.t | 2 +- test/lua-Harness-tests/301-basic.t | 2 +- test/lua-Harness-tests/308-io.t | 2 +- test/lua-Harness-tests/309-os.t | 2 +- test/lua-Harness-tests/320-stdin.t | 2 +- test/lua-Harness-tests/411-luajit.t.disabled | 2 +- test/lua-Harness-tests/test_assertion.lua | 18 ++++++++---------- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/test/lua-Harness-tests/241-standalone.t.disabled b/test/lua-Harness-tests/241-standalone.t.disabled index a02ed5bf..47c50a6b 100755 --- a/test/lua-Harness-tests/241-standalone.t.disabled +++ b/test/lua-Harness-tests/241-standalone.t.disabled @@ -41,7 +41,7 @@ elseif ravi then banner = '^Ravi %d%.%d%.%d' end -local lua = get_lua_binary_name() +local lua = _retrieve_progname() local luac = jit and lua or (lua .. 'c') if not pcall(io.popen, lua .. [[ -e "a=1"]]) then diff --git a/test/lua-Harness-tests/242-luac.t b/test/lua-Harness-tests/242-luac.t index 0a2e160e..526b31fe 100755 --- a/test/lua-Harness-tests/242-luac.t +++ b/test/lua-Harness-tests/242-luac.t @@ -38,7 +38,7 @@ if ravi then skip_all("ravi") end -local lua = get_lua_binary_name() +local lua = _retrieve_progname() local luac = lua .. 'c' if not pcall(io.popen, lua .. [[ -e "a=1"]]) then diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t index 63f0004a..c45b2558 100755 --- a/test/lua-Harness-tests/301-basic.t +++ b/test/lua-Harness-tests/301-basic.t @@ -48,7 +48,7 @@ local has_warn = _VERSION >= 'Lua 5.4' local has_xpcall52 = _VERSION >= 'Lua 5.2' or jit local has_xpcall53 = _VERSION >= 'Lua 5.3' or jit -local lua = get_lua_binary_name() +local lua = _retrieve_progname() plan'no_plan' diff --git a/test/lua-Harness-tests/308-io.t b/test/lua-Harness-tests/308-io.t index 5ea3afc7..af2b3232 100755 --- a/test/lua-Harness-tests/308-io.t +++ b/test/lua-Harness-tests/308-io.t @@ -40,7 +40,7 @@ local has_read53 = _VERSION >= 'Lua 5.3' or luajit21 local has_meta53 = _VERSION >= 'Lua 5.3' local has_meta54 = _VERSION >= 'Lua 5.4' -local lua = get_lua_binary_name() +local lua = _retrieve_progname() plan'no_plan' diff --git a/test/lua-Harness-tests/309-os.t b/test/lua-Harness-tests/309-os.t index 14cbb89a..fbc2d24b 100755 --- a/test/lua-Harness-tests/309-os.t +++ b/test/lua-Harness-tests/309-os.t @@ -34,7 +34,7 @@ require'test_assertion' local profile = require'profile' local luajit20 = jit and (jit.version_num < 20100 and not jit.version:match'^RaptorJIT') local has_execute51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit) -local lua = get_lua_binary_name() +local lua = _retrieve_progname() plan'no_plan' diff --git a/test/lua-Harness-tests/320-stdin.t b/test/lua-Harness-tests/320-stdin.t index b65b8f37..bff63760 100755 --- a/test/lua-Harness-tests/320-stdin.t +++ b/test/lua-Harness-tests/320-stdin.t @@ -26,7 +26,7 @@ Tests Lua Basic & IO Libraries with stdin require'test_assertion' -local lua = get_lua_binary_name() +local lua = _retrieve_progname() if not pcall(io.popen, lua .. [[ -e "a=1"]]) then skip_all "io.popen not supported" diff --git a/test/lua-Harness-tests/411-luajit.t.disabled b/test/lua-Harness-tests/411-luajit.t.disabled index 39cca5b0..7830df4f 100755 --- a/test/lua-Harness-tests/411-luajit.t.disabled +++ b/test/lua-Harness-tests/411-luajit.t.disabled @@ -31,7 +31,7 @@ if not jit or ujit then skip_all("only with LuaJIT") end -local lua = get_lua_binary_name() +local lua = _retrieve_progname() if not pcall(io.popen, lua .. [[ -e "a=1"]]) then skip_all("io.popen not supported") diff --git a/test/lua-Harness-tests/test_assertion.lua b/test/lua-Harness-tests/test_assertion.lua index f50cc319..f126eab1 100644 --- a/test/lua-Harness-tests/test_assertion.lua +++ b/test/lua-Harness-tests/test_assertion.lua @@ -9,6 +9,14 @@ ]] +function _retrieve_progname () + local i = 0 + while arg[i] do + i = i - 1 + end + return arg[i + 1] +end + if pcall(require, 'Test.Assertion') then diag 'Test.Assertion loaded' return @@ -219,16 +227,6 @@ function todo (reason, count) todo_reason = reason end --- The least arg element is guaranteed to be the name --- of the tested binary. -function get_lua_binary_name () - local i = 0 - while arg[i] do - i = i - 1 - end - return arg[i + 1] -end - -- XXX: If tests is run out of the tests source tree, the -- relative paths below become invalid. Hence, we need to -- prepend the directory from the script (i.e. test) name to -- 2.32.0