Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Test for LuaJIT fold machinery incorrect behavior
@ 2019-07-25 12:05 sergos
  0 siblings, 0 replies; only message in thread
From: sergos @ 2019-07-25 12:05 UTC (permalink / raw)
  To: tarantool-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-25 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 12:05 [tarantool-patches] [PATCH] Test for LuaJIT fold machinery incorrect behavior sergos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox