[tarantool-patches] [PATCH] Test for LuaJIT fold machinery incorrect behavior
sergos at tarantool.org
sergos at tarantool.org
Thu Jul 25 15:05:14 MSK 2019
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
More information about the Tarantool-patches
mailing list