summaryrefslogtreecommitdiff
path: root/test/ruby/test_vm_dump.rb
blob: 9c06ec14fb27360d0a6b697bde621e16fdf30994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true
require 'test/unit'

class TestVMDump < Test::Unit::TestCase
  def assert_darwin_vm_dump_works(args)
    omit 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