Only test on known good platforms. (#13123)
This commit is contained in:
parent
c4ae6cb500
commit
06a7b3c144
Notes:
git
2025-04-17 16:19:22 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
@ -17,8 +17,19 @@ stack_alloca_overflow(VALUE self)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
asan_p(VALUE klass)
|
||||||
|
{
|
||||||
|
#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
|
||||||
|
return Qtrue;
|
||||||
|
#else
|
||||||
|
return Qfalse;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_stack(VALUE klass)
|
Init_stack(VALUE klass)
|
||||||
{
|
{
|
||||||
rb_define_singleton_method(rb_cThread, "alloca_overflow", stack_alloca_overflow, 0);
|
rb_define_singleton_method(rb_cThread, "alloca_overflow", stack_alloca_overflow, 0);
|
||||||
|
rb_define_singleton_method(rb_cThread, "asan?", asan_p, 0);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,15 @@
|
|||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
class Test_StackOverflow < Test::Unit::TestCase
|
class Test_StackOverflow < Test::Unit::TestCase
|
||||||
def test_proc_overflow
|
def setup
|
||||||
omit("Windows stack overflow handling is missing") if RUBY_PLATFORM =~ /mswin|win32|mingw/
|
omit "Stack overflow tests are not supported on this platform: #{RUBY_PLATFORM.inspect}" unless RUBY_PLATFORM =~ /x86_64-linux|darwin/
|
||||||
|
|
||||||
|
require '-test-/stack'
|
||||||
|
|
||||||
|
omit "Stack overflow tests are not supported with ASAN" if Thread.asan?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_overflow
|
||||||
assert_separately([], <<~RUBY)
|
assert_separately([], <<~RUBY)
|
||||||
# GC may try to scan the top of the stack and cause a SEGV.
|
# GC may try to scan the top of the stack and cause a SEGV.
|
||||||
GC.disable
|
GC.disable
|
||||||
@ -17,8 +23,6 @@ class Test_StackOverflow < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_thread_stack_overflow
|
def test_thread_stack_overflow
|
||||||
omit("Windows stack overflow handling is missing") if RUBY_PLATFORM =~ /mswin|win32|mingw/
|
|
||||||
|
|
||||||
assert_separately([], <<~RUBY)
|
assert_separately([], <<~RUBY)
|
||||||
require '-test-/stack'
|
require '-test-/stack'
|
||||||
GC.disable
|
GC.disable
|
||||||
@ -35,8 +39,6 @@ class Test_StackOverflow < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_fiber_stack_overflow
|
def test_fiber_stack_overflow
|
||||||
omit("Windows stack overflow handling is missing") if RUBY_PLATFORM =~ /mswin|win32|mingw/
|
|
||||||
|
|
||||||
assert_separately([], <<~RUBY)
|
assert_separately([], <<~RUBY)
|
||||||
require '-test-/stack'
|
require '-test-/stack'
|
||||||
GC.disable
|
GC.disable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user