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 782316EC40; Fri, 24 Sep 2021 21:20:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 782316EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632507651; bh=ohKy1sbWzI/C9Jo6qi3ZpDjpa9s1WLZPVAWSCGpucYA=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lK63PWCX7tGtx1JSiRzFfBsJTb1/yPR6SDe6CPOK08JxIWxXsZO5//Emrs/m21IXT wz0Xg+jVNHvn/BlCdNS1vCCZ4NRHl80OX3NoIBwFhxFt3eweSlGhc0b9bAhzz0EEZA 1xzmcm1tmLK8dXO8rAYJTOvXWb/9zBgtWCdAPzQs= Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 1FFD56EC40 for ; Fri, 24 Sep 2021 21:20:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1FFD56EC40 Received: by mail-lf1-f53.google.com with SMTP id y26so4361429lfa.11 for ; Fri, 24 Sep 2021 11:20:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PWvf1/9L0E6RZe9/B7+mIlatZhY5Y2K6H2DkcqR5mFQ=; b=R56pFKhrFgbmh/7e0WFRYGP/93xXUbnPmonZ84eYoR2Vv3q1Qj60qWVuY4zkfnanz4 yX72/4b3VzhEtgMGk5T7JTjvq9BSERLarkBqySAPS80ZauGExeMS2A9wncPfFUIPiGfM evUvyIKdM5ZWPz0tMGnvXE7/zGIEeiqHhALvZp+cxdr6RQtMm8qZFHxkcrTHiVdEfBTC OgH7igGWdM5qmFLlk4E+vEOgKUTDRTpuH8lo8J6cgZvAVubCthJMM1VPk5HSBvw5eHdg 4yzYQT2umWCzyexiDRCiw8KdB33edBwR/sB8CUGg2+I2mbjycxmDUepfUxDw5E7hB/+q tCdg== X-Gm-Message-State: AOAM533zyuUndExx098FreVmwNiPpLVTNGXj9BUqjiiMkYbGlqO6EmYf xnW2xzzKr7bwiE/gC8UpstJGl7HctVrdqYOo X-Google-Smtp-Source: ABdhPJz18uCWkAAkrBpURg5pcXX+xUq68jPm1ki1nfMuYdFEwNQ9eC8EZ/xXpJXjyytg+2YVIi6/ZQ== X-Received: by 2002:a2e:b894:: with SMTP id r20mr12466323ljp.291.1632507649196; Fri, 24 Sep 2021 11:20:49 -0700 (PDT) Received: from localhost.localdomain ([93.175.11.199]) by smtp.gmail.com with ESMTPSA id h12sm706360ljc.65.2021.09.24.11.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 11:20:48 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Fri, 24 Sep 2021 21:20:46 +0300 Message-Id: <20210924182046.134195-1-m.kokryashkin@tarantool.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit] test: adapt test checking global environment 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" LuaJIT doesn't take into account tail calls for call-level counting, so `getfenv()` behaviour is different in tail calls. getfenv()` default level is 1 which is invalid for the test case when is called from tail call (`lj_debug_frame()` returns NULL). This commits adds local varible, so there is no tail call any more. Closes tarantool/tarantool#5713 Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 --- Issue: https://github.com/tarantool/tarantool/issues/5713 GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5713-adapt-test-global-environment-PUC-Rio test/PUC-Rio-Lua-5.1-tests/closure.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/PUC-Rio-Lua-5.1-tests/closure.lua b/test/PUC-Rio-Lua-5.1-tests/closure.lua index 551fe70d..c0377179 100644 --- a/test/PUC-Rio-Lua-5.1-tests/closure.lua +++ b/test/PUC-Rio-Lua-5.1-tests/closure.lua @@ -167,22 +167,24 @@ local function foo (a) assert(getfenv(0) == a) assert(getfenv(1) == _G) assert(getfenv(loadstring"") == a) - return getfenv() + local env = getfenv() + return env end f = coroutine.wrap(foo) local a = {} assert(f(a) == _G) local a,b = pcall(f) --- FIXME: LuaJIT doesn't take into account tail calls for +-- LuaJIT doesn't take into account tail calls for -- call-level counting, so `getfenv()` behaviour is different -- in tail calls. For example, this `pcall()` returns false, -- because `getfenv()` default level is 1 which is invalid for -- this case when is called from tail call (`lj_debug_frame()` -- returns NULL). -- See also https://github.com/tarantool/tarantool/issues/5713. --- Test is disabled for LuaJIT for now. --- assert(a and b == _G) + +-- Test is adapted to the behavior LuaJIT. +assert(a and b == _G) -- tests for multiple yield/resume arguments -- 2.33.0