[PATCH v1 1/1] tests: fix flaky hints test

Kirill Shcherbatov kshcherbatov at tarantool.org
Wed Mar 27 17:16:56 MSK 2019


We must use long long unsigned numbers on ffi types build to
avoid precision lost.

Follow-up
        f5721edc825b test: check hints corner cases

Closes #4080
---
https://github.com/tarantool/tarantool/issues/4080
https://github.com/tarantool/tarantool/tree/kshch/gh-4080-hints-fixup

 test/engine/hints.result   | 60 ++++++++++++++++++++------------------
 test/engine/hints.test.lua |  4 +--
 2 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/test/engine/hints.result b/test/engine/hints.result
index 946f82039..9841341ce 100644
--- a/test/engine/hints.result
+++ b/test/engine/hints.result
@@ -21,8 +21,8 @@ inspector:cmd("setopt delimiter ';'");
 ...
 function insert_values(type)
         local x = 54
-        while (x <= 64) do
-                local val = ffi.new(type, 2^x-1)
+        while (x < 64) do
+                local val = ffi.new(type, (2LLU^x)-1)
                 s:replace({val})
                 x = x + 1
         end
@@ -46,17 +46,16 @@ insert_values('uint64_t')
 ...
 s:select()
 ---
-- - [0]
-  - [18014398509481984]
-  - [36028797018963968]
-  - [72057594037927936]
-  - [144115188075855872]
-  - [288230376151711744]
-  - [576460752303423488]
-  - [1152921504606846976]
-  - [2305843009213693952]
-  - [4611686018427387904]
-  - [9223372036854775808]
+- - [18014398509481983]
+  - [36028797018963967]
+  - [72057594037927935]
+  - [144115188075855871]
+  - [288230376151711743]
+  - [576460752303423487]
+  - [1152921504606846975]
+  - [2305843009213693951]
+  - [4611686018427387903]
+  - [9223372036854775807]
 ...
 i1:alter{parts = {1, 'integer'}}
 ---
@@ -66,18 +65,16 @@ insert_values('int64_t')
 ...
 s:select()
 ---
-- - [-9223372036854775808]
-  - [0]
-  - [18014398509481984]
-  - [36028797018963968]
-  - [72057594037927936]
-  - [144115188075855872]
-  - [288230376151711744]
-  - [576460752303423488]
-  - [1152921504606846976]
-  - [2305843009213693952]
-  - [4611686018427387904]
-  - [9223372036854775808]
+- - [18014398509481983]
+  - [36028797018963967]
+  - [72057594037927935]
+  - [144115188075855871]
+  - [288230376151711743]
+  - [576460752303423487]
+  - [1152921504606846975]
+  - [2305843009213693951]
+  - [4611686018427387903]
+  - [9223372036854775807]
 ...
 i1:alter{parts = {1, 'number'}}
 ---
@@ -87,19 +84,26 @@ insert_values('double')
 ...
 s:select()
 ---
-- - [-9223372036854775808]
-  - [0]
+- - [18014398509481983]
   - [18014398509481984]
+  - [36028797018963967]
   - [36028797018963968]
+  - [72057594037927935]
   - [72057594037927936]
+  - [144115188075855871]
   - [144115188075855872]
+  - [288230376151711743]
   - [288230376151711744]
+  - [576460752303423487]
   - [576460752303423488]
+  - [1152921504606846975]
   - [1152921504606846976]
+  - [2305843009213693951]
   - [2305843009213693952]
+  - [4611686018427387903]
   - [4611686018427387904]
+  - [9223372036854775807]
   - [9223372036854775808]
-  - [1.844674407371e+19]
 ...
 s:drop()
 ---
diff --git a/test/engine/hints.test.lua b/test/engine/hints.test.lua
index 266516ec9..f081ebed1 100644
--- a/test/engine/hints.test.lua
+++ b/test/engine/hints.test.lua
@@ -12,8 +12,8 @@ engine = inspector:get_cfg('engine')
 inspector:cmd("setopt delimiter ';'");
 function insert_values(type)
         local x = 54
-        while (x <= 64) do
-                local val = ffi.new(type, 2^x-1)
+        while (x < 64) do
+                local val = ffi.new(type, (2LLU^x)-1)
                 s:replace({val})
                 x = x + 1
         end
-- 
2.21.0




More information about the Tarantool-patches mailing list