From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id F1F5E22A6B for ; Thu, 25 Jul 2019 08:05:15 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eR5I4njGKwow for ; Thu, 25 Jul 2019 08:05:15 -0400 (EDT) Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B54DF22A4B for ; Thu, 25 Jul 2019 08:05:15 -0400 (EDT) Received: from [185.6.245.156] (port=9763 helo=linuxkit-025000000001.mail.msk) by smtp5.mail.ru with esmtpa (envelope-from ) id 1hqcUk-0006sA-9F for tarantool-patches@freelists.org; Thu, 25 Jul 2019 15:05:14 +0300 From: sergos@tarantool.org Subject: [tarantool-patches] [PATCH] Test for LuaJIT fold machinery incorrect behavior Date: Thu, 25 Jul 2019 12:05:14 +0000 Message-Id: <20190725120514.849-1-sergos@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org There's a problem in LuaJIT fold transformations machinery. The test exposes the wrong behavior and will be used for local temporary fix in Tarantool repo. Follow up for the problem resolution is planned. https://github.com/LuaJIT/LuaJIT/issues/505 Follow-up #4376 --- test/luajit-tap/fold_bug_LuaJIT_505.test.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 test/luajit-tap/fold_bug_LuaJIT_505.test.lua diff --git a/test/luajit-tap/fold_bug_LuaJIT_505.test.lua b/test/luajit-tap/fold_bug_LuaJIT_505.test.lua new file mode 100755 index 000000000..666a08eaf --- /dev/null +++ b/test/luajit-tap/fold_bug_LuaJIT_505.test.lua @@ -0,0 +1,20 @@ +#!/usr/bin/env tarantool + +tap = require('tap') + +test = tap.test("505") +test:plan(1) + +-- Test file to demonstrate Lua table hash chain bugs discussed in +-- https://github.com/LuaJIT/LuaJIT/issues/505 + +jit.opt.start("hotloop=1") +for _ = 1, 20 do + local value = "abc" + local pos_c = string.find(value, "c", 1, true) + local value2 = string.sub(value, 1, pos_c - 1) + local pos_b = string.find(value2, "b", 2, true) + assert(pos_b == 2, "FAIL: position of 'b' is " .. pos_b) +end + +test:ok("PASS") -- 2.17.1