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 5EE8C6EC40; Fri, 24 Sep 2021 20:25:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5EE8C6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632504324; bh=VwCetdkbsE5ME9ABmRt4kZb3Ccxja9u2jG+Pk6U1WgM=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IEL3zNNmYhhiqJjiKw5W1X/87jz6qu4ZulwtlS/hHEI1NspOjaHQ5YbXbCVjuIeXy Hrbe8/G+HMj7eyc/5YR6uw/qDXuZQc34Kgvsw0H+DI2xg8GSGAB86CpTjwgDtMyaRp UBVAkLJ1fhlSAnyS2CTpfIeXly9xMZH7CzYitE1s= Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 64BFA6EC40 for ; Fri, 24 Sep 2021 20:25:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 64BFA6EC40 Received: by mail-lf1-f43.google.com with SMTP id t10so43170867lfd.8 for ; Fri, 24 Sep 2021 10:25:23 -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=h8kscX4fFar2YcOZtIeaNpoya47kmkdECFVBLokZpRw=; b=FU1IZ1NdlJYiXXXktnAoa5sN1W67Cvon9XKhT6u1Ed/w5hVULlTFhInELJD/HmPU/K Yf8hAWciy9yYb2MnVjRNi7yfKv0JmKAKc0FPcaM/vLEqmwNpBmQ86CgZNfNQvUoKWMrB 1IAUfCrCiGBGkKH9nZZfqFzr+nHoUutCmB84C88KafCzJurh+QyZu9wFkUAQhfByl4zr TsiK/kuF7SInEPPJY1HsWvyZmz6H6FIb5zmcaHaf3z3DwA6A3cH8Oshs0m0u4fWwpVSw qy5s33fTtAmP13Dp4ruR5NrR2pwgNtDgjE3LghJ7ZcMOlaBL5PdslGabK3J760W4xOug ooAg== X-Gm-Message-State: AOAM5300nd7zQBGR8d95TFOvpaKbEN0APOOKo8Z825c+sQYEuPcqZORf Kl4FydEJ14/OfBtfWYx3y+7w0rmUaW4AJSKq X-Google-Smtp-Source: ABdhPJwlQQwqtyo0gAo73UgK7+WxQundbZ8xI8gIkJh9Dk7bBoRPQRZi3xKNSobWt+L+p7Vcswb4PA== X-Received: by 2002:a05:651c:110f:: with SMTP id d15mr11981443ljo.99.1632504322172; Fri, 24 Sep 2021 10:25:22 -0700 (PDT) Received: from localhost.localdomain ([93.175.11.199]) by smtp.gmail.com with ESMTPSA id l13sm595209lfk.211.2021.09.24.10.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 10:25:21 -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 20:25:19 +0300 Message-Id: <20210924172519.121517-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 tests checking traceback in tail call 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 does not provide information about tail calls unlike, Lua 5.1 does, so a traceback in LuaJIT may be different. Consider this chunck of code: ``` local function checktraceback (co, p) local tb = debug.traceback(co) local i = 0 for l in string.gmatch(tb, "[^\n]+\n?") do assert(i == 0 or string.find(l, p[i])) i = i+1 end assert(p[i] == nil) end local function f (n) if n > 0 then return f(n-1) else coroutine.yield() end end local co = coroutine.create(f) coroutine.resume(co, 3) checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"}) ``` For LuaJIT traceback looks like the following: ``` stack traceback: [C]: in function 'yield' db.lua:436: in function ``` And for Lua 5.1 it looks like the following: ``` stack traceback: [C]: in function 'yield' db.lua:436: in function (tail call): ? (tail call): ? (tail call): ? ``` Closes tarantool/tarantool#5703 Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 --- Issue: https://github.com/tarantool/tarantool/issues/5703 GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5703-adapt-traceback-tail-call-PUC-Rio test/PUC-Rio-Lua-5.1-tests/db.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua index 56f59ea8..f254cde6 100644 --- a/test/PUC-Rio-Lua-5.1-tests/db.lua +++ b/test/PUC-Rio-Lua-5.1-tests/db.lua @@ -475,9 +475,8 @@ end local co = coroutine.create(f) coroutine.resume(co, 3) --- FIXME: Behavior is different for LuaJIT. --- See the comment to `h()` above. Test is disabled for LuaJIT. --- checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"}) +-- Test is adapted to the behaviour of LuaJIT. +checktraceback(co, {"yield", "db.lua"}) co = coroutine.create(function (x) -- 2.33.0