Skip to content

Commit 0bc40cd

Browse files
committed
Add exceptions to thread sanitizer tests.
1 parent 30ba306 commit 0bc40cd

File tree

7 files changed

+160
-20
lines changed

7 files changed

+160
-20
lines changed

source/ports/node_port/CMakeLists.txt

+22
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,28 @@ set(node_port_test "${target}_test")
9191
# Define test
9292
#
9393

94+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
95+
# TODO: This test fails when run with thread sanitizer:
96+
#
97+
# WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=13328)
98+
# #0 free ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:706 (libtsan.so.2+0x47e82)
99+
# #1 _IO_setb <null> (libc.so.6+0x818a4)
100+
# #2 <null> <null> (libruby-2.7.so.2.7+0x237b64)
101+
# #3 simple_netcore_create /usr/local/metacall/source/loaders/cs_loader/source/simple_netcore.cpp:42 (libcs_loaderd.so+0x108de)
102+
# #4 cs_loader_impl_initialize /usr/local/metacall/source/loaders/cs_loader/source/cs_loader_impl.c:236 (libcs_loaderd.so+0xf5fe)
103+
# #5 loader_impl_initialize /usr/local/metacall/source/loader/source/loader_impl.c:367 (libmetacalld.so+0x306a3)
104+
# #6 loader_impl_load_from_file /usr/local/metacall/source/loader/source/loader_impl.c:822 (libmetacalld.so+0x308b8)
105+
# #7 loader_load_from_file /usr/local/metacall/source/loader/source/loader.c:307 (libmetacalld.so+0x2e101)
106+
# #8 metacall_load_from_file /usr/local/metacall/source/metacall/source/metacall.c:348 (libmetacalld.so+0x32bef)
107+
# #9 node_loader_port_load_from_file_export(napi_env__*, napi_callback_info__*) /usr/local/metacall/source/loaders/node_loader/source/node_loader_port.cpp:395 (libnode_loaderd.so+0x113c5)
108+
# #10 <null> <null> (libnode.so.72+0x7b6344)
109+
#
110+
# SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal (/lib/x86_64-linux-gnu/libc.so.6+0x818a4) in _IO_setb
111+
#
112+
# For solving this, we should enable C# support for sanitizers and debug it properly
113+
return()
114+
endif()
115+
94116
if(WIN32)
95117
set(TEST_COMMAND cmd /c)
96118
set(GREP_COMMAND findstr)

source/tests/metacall_distributable_test/CMakeLists.txt

+23
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,29 @@ target_link_libraries(${target}
122122
# Define test
123123
#
124124

125+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
126+
# TODO: This test fails when run with thread sanitizer (this happens when C# loader is enabled):
127+
#
128+
# WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=13717)
129+
# #0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:647 (libtsan.so.2+0x3ebb8)
130+
# #1 <null> <null> (ld-linux-x86-64.so.2+0x28df)
131+
# #2 <null> <null> (libruby-2.7.so.2.7+0x237879)
132+
# #3 simple_netcore_create /usr/local/metacall/source/loaders/cs_loader/source/simple_netcore.cpp:42 (libcs_loaderd.so+0x108de)
133+
# #4 cs_loader_impl_initialize /usr/local/metacall/source/loaders/cs_loader/source/cs_loader_impl.c:236 (libcs_loaderd.so+0xf5fe)
134+
# #5 loader_impl_initialize /usr/local/metacall/source/loader/source/loader_impl.c:367 (libmetacalld.so+0x306a3)
135+
# #6 loader_impl_load_from_file /usr/local/metacall/source/loader/source/loader_impl.c:822 (libmetacalld.so+0x308b8)
136+
# #7 loader_load_from_file /usr/local/metacall/source/loader/source/loader.c:307 (libmetacalld.so+0x2e101)
137+
# #8 metacall_load_from_file /usr/local/metacall/source/metacall/source/metacall.c:348 (libmetacalld.so+0x32bef)
138+
# #9 metacall_distributable_test_DefaultConstructor_Test::TestBody() /usr/local/metacall/source/tests/metacall_distributable_test/source/metacall_distributable_test.cpp:262 (metacall-distributable-testd+0x23e3d)
139+
# #10 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (metacall-distributable-testd+0x58686)
140+
# #11 <null> <null> (libc.so.6+0x29209)
141+
#
142+
# SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal (/lib64/ld-linux-x86-64.so.2+0x28df)
143+
#
144+
# For solving this, we should enable C# support for sanitizers and debug it properly
145+
return()
146+
endif()
147+
125148
add_test(NAME ${target}
126149
COMMAND $<TARGET_FILE:${target}>
127150
)

source/tests/metacall_inspect_test/CMakeLists.txt

+23
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,29 @@ target_link_libraries(${target}
122122
# Define test
123123
#
124124

125+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
126+
# TODO: This test fails when run with thread sanitizer (this happens when C# loader is enabled):
127+
#
128+
# WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=13749)
129+
# #0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:647 (libtsan.so.2+0x3ebb8)
130+
# #1 <null> <null> (ld-linux-x86-64.so.2+0x28df)
131+
# #2 <null> <null> (libruby-2.7.so.2.7+0x237879)
132+
# #3 simple_netcore_create /usr/local/metacall/source/loaders/cs_loader/source/simple_netcore.cpp:42 (libcs_loaderd.so+0x108de)
133+
# #4 cs_loader_impl_initialize /usr/local/metacall/source/loaders/cs_loader/source/cs_loader_impl.c:236 (libcs_loaderd.so+0xf5fe)
134+
# #5 loader_impl_initialize /usr/local/metacall/source/loader/source/loader_impl.c:367 (libmetacalld.so+0x306a3)
135+
# #6 loader_impl_load_from_file /usr/local/metacall/source/loader/source/loader_impl.c:822 (libmetacalld.so+0x308b8)
136+
# #7 loader_load_from_file /usr/local/metacall/source/loader/source/loader.c:307 (libmetacalld.so+0x2e101)
137+
# #8 metacall_load_from_file /usr/local/metacall/source/metacall/source/metacall.c:348 (libmetacalld.so+0x32bef)
138+
# #9 metacall_inspect_test_DefaultConstructor_Test::TestBody() /usr/local/metacall/source/tests/metacall_inspect_test/source/metacall_inspect_test.cpp:101 (metacall-inspect-testd+0x20eaa)
139+
# #10 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (metacall-inspect-testd+0x54156)
140+
# #11 <null> <null> (libc.so.6+0x29209)
141+
#
142+
# SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal (/lib64/ld-linux-x86-64.so.2+0x28df)
143+
#
144+
# For solving this, we should enable C# support for sanitizers and debug it properly
145+
return()
146+
endif()
147+
125148
add_test(NAME ${target}
126149
COMMAND $<TARGET_FILE:${target}>
127150
)

source/tests/metacall_node_port_test/CMakeLists.txt

+22
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,28 @@ target_link_libraries(${target}
122122
# Define test
123123
#
124124

125+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
126+
# TODO: This test fails when run with thread sanitizer (this happens when C# loader is enabled):
127+
#
128+
# WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=13603)
129+
# #0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:647 (libtsan.so.2+0x3ebb8)
130+
# #1 <null> <null> (ld-linux-x86-64.so.2+0x28df)
131+
# #2 <null> <null> (libruby-2.7.so.2.7+0x237879)
132+
# #3 simple_netcore_create /usr/local/metacall/source/loaders/cs_loader/source/simple_netcore.cpp:42 (libcs_loaderd.so+0x108de)
133+
# #4 cs_loader_impl_initialize /usr/local/metacall/source/loaders/cs_loader/source/cs_loader_impl.c:236 (libcs_loaderd.so+0xf5fe)
134+
# #5 loader_impl_initialize /usr/local/metacall/source/loader/source/loader_impl.c:367 (libmetacalld.so+0x306a3)
135+
# #6 loader_impl_load_from_file /usr/local/metacall/source/loader/source/loader_impl.c:822 (libmetacalld.so+0x308b8)
136+
# #7 loader_load_from_file /usr/local/metacall/source/loader/source/loader.c:307 (libmetacalld.so+0x2e101)
137+
# #8 metacall_load_from_file /usr/local/metacall/source/metacall/source/metacall.c:348 (libmetacalld.so+0x32bef)
138+
# #9 node_loader_port_load_from_file_export(napi_env__*, napi_callback_info__*) /usr/local/metacall/source/loaders/node_loader/source/node_loader_port.cpp:395 (libnode_loaderd.so+0x113c5)
139+
# #10 <null> <null> (libnode.so.72+0x7b6344)
140+
#
141+
# SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal (/lib64/ld-linux-x86-64.so.2+0x28df)
142+
#
143+
# For solving this, we should enable C# support for sanitizers and debug it properly
144+
return()
145+
endif()
146+
125147
add_test(NAME ${target}
126148
COMMAND $<TARGET_FILE:${target}>
127149
)

source/tests/metacall_python_port_import_test/CMakeLists.txt

+36
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,42 @@ target_link_libraries(${target}
122122
# Define test
123123
#
124124

125+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
126+
# TODO: This test fails when run with thread sanitizer (this happens when C# loader is enabled):
127+
#
128+
# WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=13823)
129+
# #0 free ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:706 (libtsan.so.2+0x47e82)
130+
# #1 <null> <null> (libdw.so.1+0x56c62)
131+
# #2 backward::TraceResolverImpl<backward::system_tag::linux_tag>::~TraceResolverImpl() /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:3479 (libbacktrace_plugind.so+0xf95c)
132+
# #3 backward::TraceResolver::~TraceResolver() /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:3694 (libbacktrace_plugind.so+0xf95c)
133+
# #4 backward::Printer::~Printer() /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:3986 (libbacktrace_plugind.so+0xf95c)
134+
# #5 backward::SignalHandling::handleSignal(int, siginfo_t*, void*) /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:4265 (libbacktrace_plugind.so+0xf95c)
135+
# #6 backward::SignalHandling::sig_handler(int, siginfo_t*, void*) /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:4276 (libbacktrace_plugind.so+0xfff0)
136+
# #7 <null> <null> (libcoreclr.so+0x4afbdc)
137+
# #8 backward::SignalHandling::sig_handler(int, siginfo_t*, void*) /usr/local/metacall/build/_deps/backwardcpp-src/backward.hpp:4279 (libbacktrace_plugind.so+0xffff)
138+
# #9 <null> <null> (libcoreclr.so+0x4afbdc)
139+
# #10 simple_netcore_create /usr/local/metacall/source/loaders/cs_loader/source/simple_netcore.cpp:42 (libcs_loaderd.so+0x108de)
140+
# #11 cs_loader_impl_initialize /usr/local/metacall/source/loaders/cs_loader/source/cs_loader_impl.c:236 (libcs_loaderd.so+0xf5fe)
141+
# #12 loader_impl_initialize /usr/local/metacall/source/loader/source/loader_impl.c:367 (libmetacalld.so+0x306a3)
142+
# #13 loader_impl_load_from_file /usr/local/metacall/source/loader/source/loader_impl.c:822 (libmetacalld.so+0x308b8)
143+
# #14 loader_load_from_file /usr/local/metacall/source/loader/source/loader.c:307 (libmetacalld.so+0x2e101)
144+
# #15 metacall_load_from_file /usr/local/metacall/source/metacall/source/metacall.c:348 (libmetacalld.so+0x32bef)
145+
# #16 py_loader_port_load_from_file_impl /usr/local/metacall/source/loaders/py_loader/source/py_loader_port.c:190 (libpy_loaderd.so+0x10a02)
146+
# #17 py_loader_port_load_from_file_export /usr/local/metacall/source/loaders/py_loader/source/py_loader_port.c:244 (libpy_loaderd.so+0x10d34)
147+
# #18 <null> <null> (libpython3.9.so.1.0+0x10cc73)
148+
# #19 loader_impl_load_from_memory /usr/local/metacall/source/loader/source/loader_impl.c:968 (libmetacalld.so+0x30eba)
149+
# #20 loader_load_from_memory /usr/local/metacall/source/loader/source/loader.c:327 (libmetacalld.so+0x2e201)
150+
# #21 metacall_load_from_memory /usr/local/metacall/source/metacall/source/metacall.c:357 (libmetacalld.so+0x32c30)
151+
# #22 metacall_python_port_import_test_DefaultConstructor_Test::TestBody() /usr/local/metacall/source/tests/metacall_python_port_import_test/source/metacall_python_port_import_test.cpp:48 (metacall-python-port-import-testd+0x20aa5)
152+
# #23 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (metacall-python-port-import-testd+0x4e186)
153+
# #24 <null> <null> (libc.so.6+0x29209)
154+
#
155+
# SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal (/usr/lib/x86_64-linux-gnu/libdw.so.1+0x56c62)
156+
#
157+
# For solving this, we should enable C# support for sanitizers and debug it properly
158+
return()
159+
endif()
160+
125161
add_test(NAME ${target}
126162
COMMAND $<TARGET_FILE:${target}>
127163
WORKING_DIRECTORY ${LOADER_SCRIPT_PATH}/ramda

source/tests/metacall_test/CMakeLists.txt

+23-19
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,27 @@ target_link_libraries(${target}
114114
# Define test
115115
#
116116

117+
if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
118+
# TODO: This test fails when run with thread sanitizer (this happens when C# loader is enabled):
119+
#
120+
# WARNING: ThreadSanitizer: data race (pid=13427)
121+
# Write of size 8 at 0x7b5c00010680 by thread T8:
122+
# #0 free ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:706 (libtsan.so.2+0x47e82)
123+
# #1 <null> <null> (libcoreclr.so+0x36ba88)
124+
#
125+
# Previous write of size 8 at 0x7b5c00010680 by main thread:
126+
# [failed to restore the stack]
127+
#
128+
# Thread T8 '.NET ThreadPool' (tid=13563, running) created by thread T7 at:
129+
# #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1001 (libtsan.so.2+0x5e686)
130+
# #1 <null> <null> (libcoreclr.so+0x4e90ce)
131+
#
132+
# SUMMARY: ThreadSanitizer: data race (/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.17/libcoreclr.so+0x36ba88)
133+
#
134+
# For solving this, we should enable C# support for sanitizers and debug it properly
135+
return()
136+
endif()
137+
117138
add_test(NAME ${target}
118139
COMMAND $<TARGET_FILE:${target}>
119140
)
@@ -142,31 +163,14 @@ set_property(TEST ${target}
142163
PROPERTY LABELS ${target} MEMCHECK_IGNORE
143164
)
144165

145-
if((OPTION_BUILD_SANITIZER OR OPTION_BUILD_SANITIZER) AND OPTION_BUILD_LOADERS_CS)
146-
# TODO: This test fails when run with sanitizers (this happens when C# loader is enabled):
166+
if(OPTION_BUILD_SANITIZER AND OPTION_BUILD_LOADERS_CS)
167+
# TODO: This test fails when run with sanitizer (this happens when C# loader is enabled):
147168
#
148-
# Sanitizer:
149169
# Tracer caught signal 11: addr=0x600000690 pc=0x7f3a7b6710f0 sp=0x7f3a75e32d10
150170
# LeakSanitizer has encountered a fatal error.
151171
# HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
152172
# HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
153173
#
154-
# Thread Sanitizer:
155-
# WARNING: ThreadSanitizer: data race (pid=13427)
156-
# Write of size 8 at 0x7b5c00010680 by thread T8:
157-
# #0 free ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:706 (libtsan.so.2+0x47e82)
158-
# #1 <null> <null> (libcoreclr.so+0x36ba88)
159-
#
160-
# Previous write of size 8 at 0x7b5c00010680 by main thread:
161-
# [failed to restore the stack]
162-
#
163-
# Thread T8 '.NET ThreadPool' (tid=13563, running) created by thread T7 at:
164-
# #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1001 (libtsan.so.2+0x5e686)
165-
# #1 <null> <null> (libcoreclr.so+0x4e90ce)
166-
#
167-
# SUMMARY: ThreadSanitizer: data race (/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.17/libcoreclr.so+0x36ba88)
168-
#
169-
#
170174
# For solving this, we should enable C# support for sanitizers and debug it properly
171175
set_tests_properties(${target} PROPERTIES
172176
PASS_REGULAR_EXPRESSION "[ PASSED ]"

source/tests/sanitizer/tsan.supp

+11-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626
called_from_lib:libcoreclr*
2727
called_from_lib:libclrjit*
2828
#
29+
# Java
30+
#
31+
called_from_lib:libjvm*
32+
#
33+
# WASM (TODO: This must be reviewed, probably it's a false positive)
34+
#
35+
called_from_lib:libwasmtime*
36+
#
2937
# Rust
3038
#
31-
called_from_lib:libLLVM*
39+
called_from_lib:libLLVM*
40+
called_from_lib:librustc_driver-*
41+
called_from_lib:libstd-*

0 commit comments

Comments
 (0)