summaryrefslogtreecommitdiff
path: root/test/ruby/test_vm_dump.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 01:13:53 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 01:13:53 +0000
commit3bd01f99f0093c7a42a4d9d9cb7ee98869027910 (patch)
tree761894b66b190a26b00c6d1ffab040908aee34ce /test/ruby/test_vm_dump.rb
parentb8243bb8f29621612481a6bb3dd5e7abbcb541f5 (diff)
Fix C level backtrace on Darwin
SEGV caused by invalid instruction call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_vm_dump.rb')
-rw-r--r--test/ruby/test_vm_dump.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_vm_dump.rb b/test/ruby/test_vm_dump.rb
new file mode 100644
index 0000000000..9ea725f233
--- /dev/null
+++ b/test/ruby/test_vm_dump.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+require 'test/unit'
+
+class TestVMDump < Test::Unit::TestCase
+ def assert_vm_dump_works(args)
+ assert_in_out_err(args, "", [], [:*, /^.* main \+ \d+$/, :*, /^\[IMPORTANT\]/, :*])
+ end
+
+ def test_darwin_invalid_call
+ assert_vm_dump_works(['-rfiddle', '-eFiddle::Function.new(Fiddle::Pointer.new(1), [], Fiddle::TYPE_VOID).call'])
+ end
+
+ def test_darwin_segv_in_syscall
+ assert_vm_dump_works('-e1.times{Process.kill :SEGV,$$}')
+ end
+
+ def test_darwin_invalid_access
+ assert_vm_dump_works(['-rfiddle', '-eFiddle.dlunwrap(100).class'])
+ end
+end