summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-10 12:22:59 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-10 12:22:59 +0000
commit31c42482de33d35fff78c1f3d9eed812800f743b (patch)
treeb40a6053b299d027b2f177907566a98f321d6f50 /test
parent99de39097c62cf0245a700f9535e520b696cb6ee (diff)
downloadruby-31c42482de33d35fff78c1f3d9eed812800f743b.tar.gz
ruby-31c42482de33d35fff78c1f3d9eed812800f743b.tar.xz
ruby-31c42482de33d35fff78c1f3d9eed812800f743b.zip
* test/dl/test_cptr.rb (test_free=): test SEGV at first.
[ruby-dev:39269] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/dl/test_cptr.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb
index 3ff811f6e..07ad05ba2 100644
--- a/test/dl/test_cptr.rb
+++ b/test/dl/test_cptr.rb
@@ -1,4 +1,5 @@
require 'test_base'
+require_relative '../ruby/envutil'
module DL
class TestCPtr < TestBase
@@ -8,6 +9,20 @@ module DL
end
def test_free=
+ assert_normal_exit(<<-"End", '[ruby-dev:39269]')
+ require 'dl'
+ DL::LIBC_SO = #{DL::LIBC_SO.dump}
+ DL::LIBM_SO = #{DL::LIBM_SO.dump}
+ include DL
+ @libc = dlopen(LIBC_SO)
+ @libm = dlopen(LIBM_SO)
+ free = CFunc.new(@libc['free'], TYPE_VOID, 'free')
+ ptr = CPtr.malloc(4)
+ ptr.free = free
+ free.ptr
+ ptr.free.ptr
+ End
+
free = CFunc.new(@libc['free'], TYPE_VOID, 'free')
ptr = CPtr.malloc(4)
ptr.free = free