2017-08-31 21:13:53 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'test/unit'
|
|
|
|
|
|
|
|
class TestVMDump < Test::Unit::TestCase
|
2017-08-31 22:09:02 -04:00
|
|
|
def assert_darwin_vm_dump_works(args)
|
|
|
|
skip if RUBY_PLATFORM !~ /darwin/
|
2017-12-15 19:36:31 -05:00
|
|
|
assert_in_out_err(args, "", [], /^\[IMPORTANT\]/)
|
2017-08-31 21:13:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_darwin_invalid_call
|
2017-08-31 22:09:02 -04:00
|
|
|
assert_darwin_vm_dump_works(['-rfiddle', '-eFiddle::Function.new(Fiddle::Pointer.new(1), [], Fiddle::TYPE_VOID).call'])
|
2017-08-31 21:13:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_darwin_segv_in_syscall
|
2017-08-31 22:09:02 -04:00
|
|
|
assert_darwin_vm_dump_works('-e1.times{Process.kill :SEGV,$$}')
|
2017-08-31 21:13:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_darwin_invalid_access
|
2017-08-31 22:09:02 -04:00
|
|
|
assert_darwin_vm_dump_works(['-rfiddle', '-eFiddle.dlunwrap(100).class'])
|
2017-08-31 21:13:53 -04:00
|
|
|
end
|
|
|
|
end
|