зеркало из https://github.com/github/ruby.git
* test/socket/test_socket.rb (test_setsockopt): use SO_LINGER instead
of SO_BINDTODEVICE. fixed: [ruby-dev:25133] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bfb31fdd22
Коммит
32481c4126
17
ChangeLog
17
ChangeLog
|
@ -1,29 +1,34 @@
|
|||
Thu Dec 9 10:19:18 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/socket/test_socket.rb (test_setsockopt): use SO_LINGER instead
|
||||
of SO_BINDTODEVICE. fixed: [ruby-dev:25133]
|
||||
|
||||
Thu Dec 9 03:08:36 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tcltklib/tcltklib.c (ip_init): set root-win title to "ruby" when
|
||||
the running script is '-e one-liner' or '-' (stdin).
|
||||
the running script is '-e one-liner' or '-' (stdin).
|
||||
|
||||
* ext/tcltklib/extconf.rb: add find_library("#{lib}#{ver}",..) for
|
||||
stub libs
|
||||
stub libs
|
||||
|
||||
* ext/tk/lib/tk/textmark.rb: TkTextMarkCurrent and TkTextMarkAnchor
|
||||
have a wrong parent class.
|
||||
have a wrong parent class.
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: rename TkDialog2 --> TkDialogObj and
|
||||
* ext/tk/lib/tk/dialog.rb: rename TkDialog2 --> TkDialogObj and
|
||||
TkWarning2 --> TkWarningObj (old names are changed to alias names)
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: bug fix of treatment of 'prev_command'
|
||||
option and hashes for configuration
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: add TkDialogObj#name to return the
|
||||
button name
|
||||
button name
|
||||
|
||||
* ext/tk/lib/tk/radiobutton.rb: rename enbugged method value() ==>
|
||||
get_value() and value=(val) ==> set_value(val).
|
||||
|
||||
* ext/tk/lib/tk/menu.rb: add TkMenu.new_menuspec
|
||||
|
||||
* ext/tk/lib/tk/menu.rb: add alias (TkMenuButton = TkMenubutton,
|
||||
* ext/tk/lib/tk/menu.rb: add alias (TkMenuButton = TkMenubutton,
|
||||
TkOptionMenuButton = TkOptionMenubutton)
|
||||
|
||||
* ext/tk/lib/tk/event.rb: new method aliases (same as option keys of
|
||||
|
|
|
@ -5,15 +5,56 @@ rescue LoadError
|
|||
end
|
||||
|
||||
class TestBasicSocket < Test::Unit::TestCase
|
||||
def inet_stream
|
||||
sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
|
||||
yield sock
|
||||
ensure
|
||||
assert_raise(IOError) {sock.close}
|
||||
end
|
||||
|
||||
def test_getsockopt
|
||||
inet_stream do |s|
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n)
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
|
||||
assert_equal([0].pack("i"), n)
|
||||
val = Object.new
|
||||
class << val; self end.send(:define_method, :to_int) {
|
||||
s.close
|
||||
Socket::SO_TYPE
|
||||
}
|
||||
assert_raise(IOError) {
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, val)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def test_setsockopt # [ruby-dev:25039]
|
||||
s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
|
||||
s = nil
|
||||
linger = [0, 0].pack("ii")
|
||||
|
||||
val = Object.new
|
||||
class << val; self end.send(:define_method, :to_str) {
|
||||
s.close
|
||||
"eth0"
|
||||
linger
|
||||
}
|
||||
assert_raise(IOError) {
|
||||
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_BINDTODEVICE, val)
|
||||
inet_stream do |s|
|
||||
assert_equal(0, s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger))
|
||||
|
||||
assert_raise(IOError) {
|
||||
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, val)
|
||||
}
|
||||
end
|
||||
|
||||
val = Object.new
|
||||
class << val; self end.send(:define_method, :to_int) {
|
||||
s.close
|
||||
Socket::SO_LINGER
|
||||
}
|
||||
inet_stream do |s|
|
||||
assert_raise(IOError) {
|
||||
s.setsockopt(Socket::SOL_SOCKET, val, linger)
|
||||
}
|
||||
end
|
||||
end
|
||||
end if defined?(Socket)
|
||||
|
|
|
@ -9,7 +9,7 @@ class TestTCPSocket < Test::Unit::TestCase
|
|||
def test_recvfrom # [ruby-dev:24705]
|
||||
c = s = nil
|
||||
svr = TCPServer.new("localhost", 0)
|
||||
Thread.new {
|
||||
th = Thread.new {
|
||||
c = svr.accept
|
||||
ObjectSpace.each_object(String) {|s|
|
||||
s.replace "a" if s.length == 0x10000 and !s.frozen?
|
||||
|
@ -21,5 +21,7 @@ class TestTCPSocket < Test::Unit::TestCase
|
|||
assert_raise(RuntimeError, SocketError) {
|
||||
sock.recvfrom(0x10000)
|
||||
}
|
||||
ensure
|
||||
th.join
|
||||
end
|
||||
end if defined?(TCPSocket)
|
||||
|
|
Загрузка…
Ссылка в новой задаче