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 543F76EC56; Tue, 20 Jul 2021 19:30:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 543F76EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626798604; bh=NWorc4Q3Ybd7VBiNWR0vO5owVyulIdsr6HA4FRLDUac=; 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=R8ziBxg336n5Ee6va1UDJUWrHeqyn4btjmVqM8FysF0Yx4A+UlUOy5PNIUA/Bwnna l888jQ2hVZE28rhPk0bbDCahpAIuGpTjn+fGMlGj5dLuhB6lZhxSYfsrl7Agf5Wfvq lFYtzhr/mYTeHqHAVm6u+U7HziiUU14HGjo5jQO4= Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 760346EC6E for ; Tue, 20 Jul 2021 19:27:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 760346EC6E Received: by mail-lf1-f47.google.com with SMTP id g22so24741653lfu.0 for ; Tue, 20 Jul 2021 09:27:55 -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=p2PtJhKJF3/rcvJAPLY74olsOZshN3dw86Jzk2Wvekk=; b=gkj+JLiJyW1kVP1dkQ5mO+mxLm/qv2g8hMrD5yghCu9b7Zskqx4xYnyTj23HOonj2+ cotCW8UQvkWAPbQAN3acgYQdYJ2cXr2SheODWieMxv+f8yReQKuI2/KItXfuO0NiRK86 gRTAz/JcoT1rwh+Jv1hVmo8/FRFX0FqgiAYD2Q/3L/Nm+eaj/zoBQs/TvBG3BV63Dp5w 1t8OHsMr3Bmv0ELrkRh2w6hSyutsxAHpub4eXe+94gNtzXh5OvQ5KpYFj2KG3Xl/Rsd5 EJFNovtdEnf2jsdib/8Jc3b5r971Y8A6XYUeEJVen+ADu8j5Yicl6i+bxZv+WURlJLIs sR4A== X-Gm-Message-State: AOAM5316DBpsqWcUZ+MJu43TjaoUD9nZohI9eq1c7vQv6SE95qW+HSTe i0MrP4+ySS7X+d99LfgBwcUohh3O9sDXUqLr X-Google-Smtp-Source: ABdhPJy0uKmjiFO1ivTBClQ+FNvWmubpK3hs4XldfBR7XJbraAZw9eQVzS0ZGFiHpYqzPwGiAhZC0w== X-Received: by 2002:ac2:5d4c:: with SMTP id w12mr23068435lfd.494.1626798474469; Tue, 20 Jul 2021 09:27:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 09:27:54 -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:53 +0300 Message-Id: <34c2c2f332776613a3fd456ea62d00e892ad6369.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 05/10] test: refactor with _dofile 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 is quite similar to commit d11c5bbc08a118b11167c5d455d4024607dab662 ('test: adjust lua-Harness tests that use dofile'), with the one difference (except the naming): `make_specific_checks()` provides the particular behaviour to run the tests for out-of-source build, however `_dofile()` allows user to overload this function considering his purposes. If user leave `_dofile()` untouched, it defaults to `dofile()` Lua standard library function. It's worth to mention, that LuaJIT testing machinery has been using such approach since commit 734cc0f1d508429c2c3c46bd1860398db0051060 ('test: adapt PUC-Rio suite for out-of-source build') and `_dofile()` behaviour for running tests when out of source build is used is already defined in luajit-test-init.lua. [1]: https://framagit.org/fperrad/lua-Harness/-/commit/60da289 Part of tarantool/tarantool#5970 Part of tarantool/tarantool#4473 --- test/lua-Harness-tests/101-boolean.t | 2 +- test/lua-Harness-tests/102-function.t | 2 +- test/lua-Harness-tests/103-nil.t | 2 +- test/lua-Harness-tests/104-number.t | 2 +- test/lua-Harness-tests/105-string.t | 2 +- test/lua-Harness-tests/106-table.t | 2 +- test/lua-Harness-tests/107-thread.t | 2 +- test/lua-Harness-tests/108-userdata.t | 2 +- test/lua-Harness-tests/203-lexico.t | 8 ++++---- test/lua-Harness-tests/231-metatable.t | 2 +- test/lua-Harness-tests/301-basic.t | 2 +- test/lua-Harness-tests/305-utf8.t | 4 ++-- test/lua-Harness-tests/404-ext.t | 2 +- test/lua-Harness-tests/test_assertion.lua | 10 ++-------- test/luajit-test-init.lua | 2 ++ 15 files changed, 21 insertions(+), 25 deletions(-) diff --git a/test/lua-Harness-tests/101-boolean.t b/test/lua-Harness-tests/101-boolean.t index eb8b6bbd..9b36174f 100755 --- a/test/lua-Harness-tests/101-boolean.t +++ b/test/lua-Harness-tests/101-boolean.t @@ -114,7 +114,7 @@ error_matches(function () local a = true; a[1] = 1; end, "index") if has_op53 then - make_specific_checks'lexico53/boolean.t' + _dofile'lexico53/boolean.t' end done_testing() diff --git a/test/lua-Harness-tests/102-function.t b/test/lua-Harness-tests/102-function.t index a0a3ad33..f144f702 100755 --- a/test/lua-Harness-tests/102-function.t +++ b/test/lua-Harness-tests/102-function.t @@ -193,7 +193,7 @@ t[print] = true truthy(t[print]) if has_op53 then - make_specific_checks'lexico53/function.t' + _dofile'lexico53/function.t' end done_testing() diff --git a/test/lua-Harness-tests/103-nil.t b/test/lua-Harness-tests/103-nil.t index 718fde16..d7cab0da 100755 --- a/test/lua-Harness-tests/103-nil.t +++ b/test/lua-Harness-tests/103-nil.t @@ -114,7 +114,7 @@ error_matches(function () local a = nil; a[1] = 1; end, "index") if has_op53 then - make_specific_checks'lexico53/nil.t' + _dofile'lexico53/nil.t' end done_testing() diff --git a/test/lua-Harness-tests/104-number.t b/test/lua-Harness-tests/104-number.t index 872042c0..9dd3ffa0 100755 --- a/test/lua-Harness-tests/104-number.t +++ b/test/lua-Harness-tests/104-number.t @@ -233,7 +233,7 @@ error_matches(function () local a = 3.14; a[1] = 1; end, "index") if has_op53 then - make_specific_checks'lexico53/number.t' + _dofile'lexico53/number.t' end done_testing() diff --git a/test/lua-Harness-tests/105-string.t b/test/lua-Harness-tests/105-string.t index 22e6cfa6..3d167840 100755 --- a/test/lua-Harness-tests/105-string.t +++ b/test/lua-Harness-tests/105-string.t @@ -264,7 +264,7 @@ error_matches(function () a = 'text'; a[1] = 1; end, "index") if has_op53 then - make_specific_checks'lexico53/string.t' + _dofile'lexico53/string.t' end done_testing() diff --git a/test/lua-Harness-tests/106-table.t b/test/lua-Harness-tests/106-table.t index ecb761d2..6beb2a5e 100755 --- a/test/lua-Harness-tests/106-table.t +++ b/test/lua-Harness-tests/106-table.t @@ -122,7 +122,7 @@ error_matches(function () t = {}; t[0/0] = 42 end, "table index is NaN") if has_op53 then - make_specific_checks'lexico53/table.t' + _dofile'lexico53/table.t' end done_testing() diff --git a/test/lua-Harness-tests/107-thread.t b/test/lua-Harness-tests/107-thread.t index 33ebf769..e9b17139 100755 --- a/test/lua-Harness-tests/107-thread.t +++ b/test/lua-Harness-tests/107-thread.t @@ -122,7 +122,7 @@ t[co] = true truthy(t[co]) if has_op53 then - make_specific_checks'lexico53/thread.t' + _dofile'lexico53/thread.t' end done_testing() diff --git a/test/lua-Harness-tests/108-userdata.t b/test/lua-Harness-tests/108-userdata.t index 314a60e7..0c7f0c24 100755 --- a/test/lua-Harness-tests/108-userdata.t +++ b/test/lua-Harness-tests/108-userdata.t @@ -119,7 +119,7 @@ t[u] = true truthy(t[u]) if has_op53 then - make_specific_checks'lexico53/userdata.t' + _dofile'lexico53/userdata.t' end done_testing() diff --git a/test/lua-Harness-tests/203-lexico.t b/test/lua-Harness-tests/203-lexico.t index c9345c71..396a167f 100755 --- a/test/lua-Harness-tests/203-lexico.t +++ b/test/lua-Harness-tests/203-lexico.t @@ -118,19 +118,19 @@ do end if _VERSION >= 'Lua 5.2' or jit then - make_specific_checks'lexico52/lexico.t' + _dofile'lexico52/lexico.t' end if _VERSION >= 'Lua 5.3' or luajit21 then - make_specific_checks'lexico53/lexico.t' + _dofile'lexico53/lexico.t' end if _VERSION >= 'Lua 5.4' then - make_specific_checks'lexico54/lexico.t' + _dofile'lexico54/lexico.t' end if jit and pcall(require, 'ffi') then - make_specific_checks'lexicojit/lexico.t' + _dofile'lexicojit/lexico.t' end done_testing() diff --git a/test/lua-Harness-tests/231-metatable.t b/test/lua-Harness-tests/231-metatable.t index 15625c11..06cc902c 100755 --- a/test/lua-Harness-tests/231-metatable.t +++ b/test/lua-Harness-tests/231-metatable.t @@ -589,7 +589,7 @@ do end if has_anno_toclose then - make_specific_checks'lexico54/metatable.t' + _dofile'lexico54/metatable.t' end done_testing() diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t index c45b2558..01e187d9 100755 --- a/test/lua-Harness-tests/301-basic.t +++ b/test/lua-Harness-tests/301-basic.t @@ -843,7 +843,7 @@ do -- xpcall end if jit and pcall(require, 'ffi') then - make_specific_checks'lexicojit/basic.t' + _dofile'lexicojit/basic.t' end done_testing() diff --git a/test/lua-Harness-tests/305-utf8.t b/test/lua-Harness-tests/305-utf8.t index e448a448..2ba48c08 100755 --- a/test/lua-Harness-tests/305-utf8.t +++ b/test/lua-Harness-tests/305-utf8.t @@ -40,9 +40,9 @@ if not utf8 then falsy(has_utf8, "no has_utf8") else plan'no_plan' - make_specific_checks'lexico53/utf8.t' + _dofile'lexico53/utf8.t' if _VERSION >= 'Lua 5.4' then - make_specific_checks'lexico54/utf8.t' + _dofile'lexico54/utf8.t' end done_testing() end diff --git a/test/lua-Harness-tests/404-ext.t b/test/lua-Harness-tests/404-ext.t index 7239e5df..45701671 100755 --- a/test/lua-Harness-tests/404-ext.t +++ b/test/lua-Harness-tests/404-ext.t @@ -158,7 +158,7 @@ end -- thread.exdata if pcall(require, 'ffi') and (profile.openresty or jit.version:match'moonjit') then - make_specific_checks'lexicojit/ext.t' + _dofile'lexicojit/ext.t' end done_testing() diff --git a/test/lua-Harness-tests/test_assertion.lua b/test/lua-Harness-tests/test_assertion.lua index f126eab1..67cf37f9 100644 --- a/test/lua-Harness-tests/test_assertion.lua +++ b/test/lua-Harness-tests/test_assertion.lua @@ -9,6 +9,8 @@ ]] +_dofile = _dofile or dofile -- could be defined in profile + function _retrieve_progname () local i = 0 while arg[i] do @@ -227,14 +229,6 @@ function todo (reason, count) todo_reason = reason 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 --- the auxiliary files to be loaded and executed. -function make_specific_checks (filename) - return dofile(arg[0]:gsub('([^/]+)%.t$', '') .. filename) -end - -- -- Copyright (c) 2009-2021 Francois Perrad -- diff --git a/test/luajit-test-init.lua b/test/luajit-test-init.lua index 54a1f815..feec17cf 100644 --- a/test/luajit-test-init.lua +++ b/test/luajit-test-init.lua @@ -2,6 +2,8 @@ -- `_loadfile()` exists and uses it for code loading from test -- files. If the variable is not defined then suite uses -- `loadfile()` as default. Same for the `_dofile()`. +-- Lua-Harness also uses the same implementation of `dofile()` +-- fot he same reason -- XXX: Some tests in PUC Rio Lua 5.1 test suite clean `arg` -- variable, so evaluate this once and use later. -- 2.32.0