[Tarantool-patches] [PATCH v2 luajit 41/45] test: enable <misc/unordered_jit.lua> LuaJIT test
Sergey Kaplun
skaplun at tarantool.org
Wed Aug 21 11:58:44 MSK 2024
This patch moves the aforementioned test from the <misc> to the <trace/>
directory, includes it in <index>, and names the subtests.
Part of tarantool/tarantool#9398
---
test/LuaJIT-tests/misc/unordered_jit.lua | 96 ---------
test/LuaJIT-tests/trace/index | 1 +
test/LuaJIT-tests/trace/unordered_jit.lua | 240 ++++++++++++++++++++++
3 files changed, 241 insertions(+), 96 deletions(-)
delete mode 100644 test/LuaJIT-tests/misc/unordered_jit.lua
create mode 100644 test/LuaJIT-tests/trace/unordered_jit.lua
diff --git a/test/LuaJIT-tests/misc/unordered_jit.lua b/test/LuaJIT-tests/misc/unordered_jit.lua
deleted file mode 100644
index 5ff1a1ba..00000000
--- a/test/LuaJIT-tests/misc/unordered_jit.lua
+++ /dev/null
@@ -1,96 +0,0 @@
-
-local nan = 0/0
-local t = {}
-for i=1,100 do t[i] = i+0.5 end
-for i=101,200 do t[i] = nan end
-
-do
- local z = 0
- for i=1,200 do if t[i] > 1000 then z=i end end
- assert(z == 0)
-end
-
-do
- local z = 0
- for i=1,200 do if not (t[i] < 1000) then z=i end end
- assert(z == 200)
-end
-
-do
- local z = 0
- for i=1,200 do if t[i] <= 1000 then z=i end end
- assert(z == 100)
-end
-
-do
- local z = 0
- for i=1,200 do if not (t[i] >= 1000) then z=i end end
- assert(z == 200)
-end
-
-do
- local z = 0
- for i=1,200 do if t[i] > 0 then z=i end end
- assert(z == 100)
-end
-
-do
- local z = 0
- for i=1,200 do if not (t[i] < 0) then z=i end end
- assert(z == 200)
-end
-
-do
- local z = 0
- for i=1,200 do if t[i] <= 0 then z=i end end
- assert(z == 0)
-end
-
-do
- local z = 0
- for i=1,200 do if not (t[i] >= 0) then z=i end end
- assert(z == 200)
-end
-
-do local z; for i=1,100 do z = 0/0 end; assert(z ~= z) end
-
-do local z; for i=1,100 do z = nan == nan end; assert(z == false) end
-do local z; for i=1,100 do z = nan == 1 end; assert(z == false) end
-do local z; for i=1,100 do z = 1 == nan end; assert(z == false) end
-
-do local z; for i=1,100 do z = nan ~= nan end; assert(z == true) end
-do local z; for i=1,100 do z = nan ~= 1 end; assert(z == true) end
-do local z; for i=1,100 do z = 1 ~= nan end; assert(z == true) end
-
-do local z; for i=1,100 do z = nan < nan end; assert(z == false) end
-do local z; for i=1,100 do z = nan < 1 end; assert(z == false) end
-do local z; for i=1,100 do z = 1 < nan end; assert(z == false) end
-
-do local z; for i=1,100 do z = not (nan < nan) end; assert(z == true) end
-do local z; for i=1,100 do z = not (nan < 1) end; assert(z == true) end
-do local z; for i=1,100 do z = not (1 < nan) end; assert(z == true) end
-
-do local z; for i=1,100 do z = nan > nan end; assert(z == false) end
-do local z; for i=1,100 do z = nan > 1 end; assert(z == false) end
-do local z; for i=1,100 do z = 1 > nan end; assert(z == false) end
-
-do local z; for i=1,100 do z = not (nan > nan) end; assert(z == true) end
-do local z; for i=1,100 do z = not (nan > 1) end; assert(z == true) end
-do local z; for i=1,100 do z = not (1 > nan) end; assert(z == true) end
-
-do local z; for i=1,100 do z = nan <= nan end; assert(z == false) end
-do local z; for i=1,100 do z = nan <= 1 end; assert(z == false) end
-do local z; for i=1,100 do z = 1 <= nan end; assert(z == false) end
-
-do local z; for i=1,100 do z = not (nan <= nan) end; assert(z == true) end
-do local z; for i=1,100 do z = not (nan <= 1) end; assert(z == true) end
-do local z; for i=1,100 do z = not (1 <= nan) end; assert(z == true) end
-
-do local z; for i=1,100 do z = nan >= nan end; assert(z == false) end
-do local z; for i=1,100 do z = nan >= 1 end; assert(z == false) end
-do local z; for i=1,100 do z = 1 >= nan end; assert(z == false) end
-
-do local z; for i=1,100 do z = not (nan >= nan) end; assert(z == true) end
-do local z; for i=1,100 do z = not (nan >= 1) end; assert(z == true) end
-do local z; for i=1,100 do z = not (1 >= nan) end; assert(z == true) end
-
diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
index 1b8fb8f4..c7fbbe57 100644
--- a/test/LuaJIT-tests/trace/index
+++ b/test/LuaJIT-tests/trace/index
@@ -12,3 +12,4 @@ stack_purge.lua
stitch.lua
tcall_base.lua
tcall_loop.lua
+unordered_jit.lua
diff --git a/test/LuaJIT-tests/trace/unordered_jit.lua b/test/LuaJIT-tests/trace/unordered_jit.lua
new file mode 100644
index 00000000..0aa7bde3
--- /dev/null
+++ b/test/LuaJIT-tests/trace/unordered_jit.lua
@@ -0,0 +1,240 @@
+-- All cases below use constants on the trace.
+local nan = 0/0
+local t = {}
+for i = 1, 100 do t[i] = i + 0.5 end
+for i = 101, 200 do t[i] = nan end
+
+do --- Branch is never taken, NaN > 1000.
+ local z = 0
+ for i = 1, 200 do if t[i] > 1000 then z = i end end
+ assert(z == 0)
+end
+
+do --- Branch begins to be taken on the trace, not (NaN < 1000).
+ local z = 0
+ for i = 1, 200 do if not (t[i] < 1000) then z = i end end
+ assert(z == 200)
+end
+
+do --- Branch ends to be taken on the trace, NaN <= 1000.
+ local z = 0
+ for i = 1, 200 do if t[i] <= 1000 then z = i end end
+ assert(z == 100)
+end
+
+do --- Branch is always taken, not (NaN >= 1000).
+ local z = 0
+ for i = 1, 200 do if not (t[i] >= 1000) then z = i end end
+ assert(z == 200)
+end
+
+do --- Branch ends to be taken on the trace, NaN > 0.
+ local z = 0
+ for i = 1, 200 do if t[i] > 0 then z = i end end
+ assert(z == 100)
+end
+
+do --- Branch is always taken, not (NaN < 0).
+ local z = 0
+ for i = 1, 200 do if not (t[i] < 0) then z = i end end
+ assert(z == 200)
+end
+
+do --- Branch is never taken, NaN <= 0.
+ local z = 0
+ for i = 1, 200 do if t[i] <= 0 then z = i end end
+ assert(z == 0)
+end
+
+do --- Branch begins to be taken on the trace, not (NaN >= 0).
+ local z = 0
+ for i = 1, 200 do if not (t[i] >= 0) then z = i end end
+ assert(z == 200)
+end
+
+do --- NaN assign on trace.
+ local z
+ for _ = 1, 100 do z = 0/0 end
+ assert(z ~= z)
+end
+
+do --- Nan == NaN.
+ local z
+ for _ = 1, 100 do z = nan == nan end
+ assert(z == false)
+end
+
+do --- NaN == 1.
+ local z
+ for _ = 1, 100 do z = nan == 1 end
+ assert(z == false)
+end
+
+do --- 1 == NaN.
+ local z
+ local z
+ for _ = 1, 100 do z = 1 == nan end
+ assert(z == false)
+end
+
+do --- NaN ~= NaN.
+ local z
+ for _ = 1, 100 do z = nan ~= nan end
+ assert(z == true)
+end
+
+do --- NaN ~= 1.
+ local z
+ for _ = 1, 100 do z = nan ~= 1 end
+ assert(z == true)
+end
+
+do --- 1 ~= NaN.
+ local z
+ for _ = 1, 100 do z = 1 ~= nan end
+ assert(z == true)
+end
+
+do --- NaN < NaN.
+ local z
+ for _ = 1, 100 do z = nan < nan end
+ assert(z == false)
+end
+
+do --- NaN < 1.
+ local z
+ for _ = 1, 100 do z = nan < 1 end
+ assert(z == false)
+end
+
+do --- 1 < NaN.
+ local z
+ for _ = 1, 100 do z = 1 < nan end
+ assert(z == false)
+end
+
+do --- not (NaN < NaN).
+ local z
+ for _ = 1, 100 do z = not (nan < nan) end
+ assert(z == true)
+end
+
+do --- not (NaN < 1).
+ local z
+ for _ = 1, 100 do z = not (nan < 1) end
+ assert(z == true)
+end
+
+do --- not (1 < NaN).
+ local z
+ for _ = 1, 100 do z = not (1 < nan) end
+ assert(z == true)
+end
+
+do --- NaN > NaN.
+ local z
+ for _ = 1, 100 do z = nan > nan end
+ assert(z == false)
+end
+
+do --- NaN > 1.
+ local z
+ for _ = 1, 100 do z = nan > 1 end
+ assert(z == false)
+end
+
+do --- 1 > NaN.
+ local z
+ for _ = 1, 100 do z = 1 > nan end
+ assert(z == false)
+end
+
+do --- not (NaN > NaN).
+ local z
+ for _ = 1, 100 do z = not (nan > nan) end
+ assert(z == true)
+end
+
+do --- not (NaN > 1).
+ local z
+ for _ = 1, 100 do z = not (nan > 1) end
+ assert(z == true)
+end
+
+do --- not (1 > NaN).
+ local z
+ for _ = 1, 100 do z = not (1 > nan) end
+ assert(z == true)
+end
+
+do --- NaN <= NaN.
+ local z
+ for _ = 1, 100 do z = nan <= nan end
+ assert(z == false)
+end
+
+do --- NaN <= 1.
+ local z
+ for _ = 1, 100 do z = nan <= 1 end
+ assert(z == false)
+end
+
+do --- 1 <= NaN.
+ local z
+ for _ = 1, 100 do z = 1 <= nan end
+ assert(z == false)
+end
+
+do --- not (NaN <= NaN).
+ local z
+ for _ = 1, 100 do z = not (nan <= nan) end
+ assert(z == true)
+end
+
+do --- not (NaN <= 1).
+ local z
+ for _ = 1, 100 do z = not (nan <= 1) end
+ assert(z == true)
+end
+
+do --- not (1 <= NaN).
+ local z
+ for _ = 1, 100 do z = not (1 <= nan) end
+ assert(z == true)
+end
+
+do --- NaN >= NaN.
+ local z
+ for _ = 1, 100 do z = nan >= nan end
+ assert(z == false)
+end
+
+do --- NaN >= 1.
+ local z
+ for _ = 1, 100 do z = nan >= 1 end
+ assert(z == false)
+end
+
+do --- 1 >= NaN.
+ local z
+ for _ = 1, 100 do z = 1 >= nan end
+ assert(z == false)
+end
+
+do --- not (NaN >= NaN).
+ local z
+ for _ = 1, 100 do z = not (nan >= nan) end
+ assert(z == true)
+end
+
+do --- not (NaN >= 1).
+ local z
+ for _ = 1, 100 do z = not (nan >= 1) end
+ assert(z == true)
+end
+
+do --- not (1 >= NaN).
+ local z
+ for _ = 1, 100 do z = not (1 >= nan) end
+ assert(z == true)
+end
--
2.45.2
More information about the Tarantool-patches
mailing list