Skip to content

Commit 89dc79e

Browse files
committed
Ignore thread not suspended warning messages in LSAN
When a process with multiple threads is forked, LSAN outputs warning messages to stderr like: ==276855==Running thread 276851 was not suspended. False leaks are possible. We should ignore messages like this in tests.
1 parent d036dc0 commit 89dc79e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tool/lib/core_assertions.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **o
328328
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
329329
args << "--debug" if RUBY_ENGINE == 'jruby' # warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
330330
stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt)
331+
332+
if Test::Sanitizers.lsan_enabled?
333+
# LSAN may output messages like the following line into stderr. We should ignore it.
334+
# ==276855==Running thread 276851 was not suspended. False leaks are possible.
335+
# See https://github.com/google/sanitizers/issues/1479
336+
stderr.gsub!(/==\d+==Running thread \d+ was not suspended\. False leaks are possible\.\n/, "")
337+
end
331338
ensure
332339
if res_c
333340
res_c.close

0 commit comments

Comments
 (0)