1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/ruby/test_vm_dump.rb
Koichi Sasada c9fe4ebd29 cause SEGV for the test.
21991e6ca5 enables `__builtin_assume()` for clang and it seems
skip SEGV on rb_class_of() with unexpected value. This test expects
a [BUG] output, so this patch causes [BUG] to show [BUG] message.

https://github.com/ruby/ruby/runs/707088232?check_suite_focus=true#step:12:230
```
  1) Failure:
TestVMDump#test_darwin_invalid_access [/Users/runner/runners/2.262.1/work/ruby/ruby/src/test/ruby/test_vm_dump.rb:19]:
pid 43128 exit 0.

1. [2/2] Assertion for "stderr"
   | Expected /^\[IMPORTANT\]/ to match "".
```
2020-05-26 04:49:11 +09:00

21 lines
624 B
Ruby

# frozen_string_literal: true
require 'test/unit'
class TestVMDump < Test::Unit::TestCase
def assert_darwin_vm_dump_works(args)
skip if RUBY_PLATFORM !~ /darwin/
assert_in_out_err(args, "", [], /^\[IMPORTANT\]/)
end
def test_darwin_invalid_call
assert_darwin_vm_dump_works(['-rfiddle', '-eFiddle::Function.new(Fiddle::Pointer.new(1), [], Fiddle::TYPE_VOID).call'])
end
def test_darwin_segv_in_syscall
assert_darwin_vm_dump_works('-e1.times{Process.kill :SEGV,$$}')
end
def test_darwin_invalid_access
assert_darwin_vm_dump_works(['-rfiddle', '-eFiddle.dlunwrap(100).inspect'])
end
end