summaryrefslogtreecommitdiff
path: root/test/dl
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-20 15:20:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-20 15:20:14 +0000
commit4aa9e1ace0c240a99bd41b59a3df736948198480 (patch)
treed01731ee4b0c9f7a42a9ae5cf54e3e11aa90b72c /test/dl
parent4c58bed876c2c3646d031a2f7e8facee8b50c2be (diff)
Add test for r32586.
FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if it calls _nss_cache_cycle_prevention_function with dlsym(3). So our DL::Handle#sym must call dlerror(3) before call dlsym. In general uses of dlerror(3) should call it before use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl')
-rw-r--r--test/dl/test_handle.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
index 3f423925d9..cc4df49c84 100644
--- a/test/dl/test_handle.rb
+++ b/test/dl/test_handle.rb
@@ -169,5 +169,16 @@ module DL
handle = DL::Handle::DEFAULT
assert_not_nil handle['malloc']
end unless /mswin|mingw/ =~ RUBY_PLATFORM
+
+ def test_dlerror
+ # FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls
+ # getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if
+ # it calls _nss_cache_cycle_prevention_function with dlsym(3).
+ # So our DL::Handle#sym must call dlerror(3) before call dlsym.
+ # In general uses of dlerror(3) should call it before use it.
+ require 'socket'
+ Socket.gethostbyname("localhost")
+ DL.dlopen("/usr/lib/libc.so").sym('strcpy')
+ end if /freebsd/=~ RUBY_PLATFORM
end
end