summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-18 14:25:01 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-18 14:25:01 +0000
commit148f1b91176fb2f68dfbdf85720f18901d6e4b60 (patch)
treef1258336fcef5b9fdd81d231db97f3d414a1f51b /test
parent89ceb340ac674debd2858cf8eef698116cfd70ed (diff)
merge revision(s) 58769,59710,59712: [Backport #13566]
Treat NULL reference case [Bug #13566] Fix C level backtrace on Darwin SEGV caused by invalid instruction call. skip unless PLATFORM is darwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_vm_dump.rb21
1 files changed, 21 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..7144a0cbc6
--- /dev/null
+++ b/test/ruby/test_vm_dump.rb
@@ -0,0 +1,21 @@
+# 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, "", [], [:*, /^.* main \+ \d+$/, :*, /^\[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).class'])
+ end
+end