From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>,
Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 24/25] test: enable <catch_wrap.lua> LuaJIT test
Date: Fri, 19 Jan 2024 14:32:47 +0300 [thread overview]
Message-ID: <f72c5b1ed8eaceb03913a560c6572fdb0a7d007d.1705661401.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1705661401.git.skaplun@tarantool.org>
This patch moves the <catch_wrap.lua> test from the <misc> to <lang>
directory, includes it in <index>, and names subtests. Also, since the
tests may be shuffled, `cp.wrapon()` and `cp.wrapoff()` are used for
each test separately. Also, this patch adds a workaround for the
internal ASAN bug, see details in the comment in the <CMakeLists.txt>.
Part of tarantool/tarantool#9398
---
test/LuaJIT-tests/CMakeLists.txt | 16 ++++++++++
.../{misc => lang}/catch_wrap.lua | 29 +++++++++++++------
test/LuaJIT-tests/lang/index | 1 +
3 files changed, 37 insertions(+), 9 deletions(-)
rename test/LuaJIT-tests/{misc => lang}/catch_wrap.lua (74%)
diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
index c52bcc71..8ecfe3f6 100644
--- a/test/LuaJIT-tests/CMakeLists.txt
+++ b/test/LuaJIT-tests/CMakeLists.txt
@@ -24,6 +24,22 @@ else()
list(APPEND LUAJIT_TESTS_ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}")
endif()
+if(LUAJIT_USE_ASAN)
+ # When running LuaJIT-tests under ASAN, the internal ASAN check
+ # failed:
+ # AddressSanitizer: CHECK failed: asan_interceptors.cpp:356
+ # "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0)
+ # This is a workaround suggested at
+ # https://github.com/google/sanitizers/issues/934.
+ execute_process(
+ COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.so
+ OUTPUT_VARIABLE LIB_STDCPP
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ # Fortunately, we are not interested in macOS here.
+ list(APPEND LUAJIT_TESTS_ENV LD_PRELOAD="${LIB_STDCPP}")
+endif()
+
add_custom_command(TARGET LuaJIT-tests
COMMENT "Running LuaJIT-tests"
COMMAND
diff --git a/test/LuaJIT-tests/misc/catch_wrap.lua b/test/LuaJIT-tests/lang/catch_wrap.lua
similarity index 74%
rename from test/LuaJIT-tests/misc/catch_wrap.lua
rename to test/LuaJIT-tests/lang/catch_wrap.lua
index 7f656bcc..fa54cd67 100644
--- a/test/LuaJIT-tests/misc/catch_wrap.lua
+++ b/test/LuaJIT-tests/lang/catch_wrap.lua
@@ -1,45 +1,56 @@
-
local cp = require("cpptest")
-cp.wrapon()
-do
+local unwind
+
+do --- catch, no error
+ cp.wrapon()
local a, b = pcall(cp.catch, function() return "x" end)
assert(a == true and b == "x")
+ cp.wrapoff()
end
-do
+do --- pcall throw
+ cp.wrapon()
local a, b = pcall(function() cp.throw("foo") end)
assert(a == false and b == "foo")
+ cp.wrapoff()
end
-local unwind
-do
+do --- catch throw
+ cp.wrapon()
local a, b = pcall(cp.catch, function() cp.throw("foo") end)
unwind = a
assert((a == false and b == "foo") or (a == true and b == "catch ..."))
+ cp.wrapoff()
end
-do
+do --- alloc, no error
+ cp.wrapon()
local st = cp.alloc(function() return cp.isalloc() end)
assert(st == true)
assert(cp.isalloc() == false)
+ cp.wrapoff()
end
-do
+do --- throw in alloc
+ cp.wrapon()
local a, b = pcall(cp.alloc, function()
assert(cp.isalloc() == true)
return "foo", cp.throw
end)
assert(a == false and b == "foo")
assert(cp.isalloc() == false)
+ cp.wrapoff()
end
-do
+do --- error in alloc
+ cp.wrapon()
local a, b = pcall(cp.alloc, function()
assert(cp.isalloc() == true)
return "foo", error
end)
assert(a == false and b == "foo")
if unwind then assert(cp.isalloc() == false) end
+ cp.wrapoff()
end
diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index dc0c2e14..87b0c5a0 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -1,6 +1,7 @@
andor.lua
api_call.lua
assignment.lua
+catch_wrap.lua
compare.lua
compare_nan.lua
constant
--
2.43.0
next prev parent reply other threads:[~2024-01-19 11:49 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 11:32 [Tarantool-patches] [PATCH luajit 00/25] More tests from LuaJIT-tests, part 1 Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 01/25] test: prepare lauxilarily libs for LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-23 9:10 ` Sergey Bronnikov via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 02/25] test: separate LuaJIT helpers from ffi_util.inc Sergey Kaplun via Tarantool-patches
2024-01-23 9:17 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:35 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 03/25] test: enable <ffi_arith_ptr.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-23 9:21 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 13:10 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 04/25] test: enable <ffi_bitfield.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 05/25] test: enable <ffi_call.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23 9:32 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:46 ` Sergey Kaplun via Tarantool-patches
2024-01-24 11:05 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 06/25] test: enable <ffi_callback.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23 9:36 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:01 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:58 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 07/25] test: enable <ffi_const.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23 9:38 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 11:59 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:52 ` Sergey Kaplun via Tarantool-patches
2024-01-23 12:49 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 08/25] test: enable <ffi_convert.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23 9:39 ` Sergey Bronnikov via Tarantool-patches
2024-01-23 12:51 ` Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 09/25] test: enable <ffi_enum.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 10/25] test: enable <ffi_gcstep_recursive.lua> Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 11/25] test: enable <ffi_jit_arith.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 12/25] test: enable <ffi_jit_call.lua> " Sergey Kaplun via Tarantool-patches
2024-01-24 14:43 ` Sergey Bronnikov via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 13/25] test: enable <ffi_jit_conv.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 14/25] test: enable <ffi_lex_number.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 15/25] test: enable <ffi_metatype.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 16/25] test: enable <ffi_new.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 17/25] test: enable <ffi_parse_array.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 18/25] test: enable <ffi_parse_basic.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 19/25] test: enable <ffi_parse_cdef.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 20/25] test: enable <ffi_parse_struct.lua> LuaJIT test Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 21/25] test: enable <ffi_tabov.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 22/25] test: enable <lightud.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 23/25] test: enable <api_call.lua> " Sergey Kaplun via Tarantool-patches
2024-01-19 11:32 ` Sergey Kaplun via Tarantool-patches [this message]
2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 25/25] test: enable <catch_cpp.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23 9:01 ` [Tarantool-patches] [PATCH luajit 00/25] More tests from LuaJIT-tests, part 1 Sergey Bronnikov via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f72c5b1ed8eaceb03913a560c6572fdb0a7d007d.1705661401.git.skaplun@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=m.kokryashkin@tarantool.org \
--cc=sergeyb@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 24/25] test: enable <catch_wrap.lua> LuaJIT test' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox