aboutsummaryrefslogtreecommitdiffstats
path: root/test/socket
Commit message (Collapse)AuthorAgeFilesLines
* Fixup with review commentMisaki Shioi2023-12-011-1/+1
| | | | https://github.com/ruby/ruby/pull/9088#discussion_r1411490445
* Relax test conditions to velify Socket::ResolutionError#error_codeMisaki Shioi2023-12-011-5/+2
| | | | | | | | | | The test for Socket::ResolutionError#error_code fails in the FreeBSD environment with this test condition. Because Socket::ResolutionError#error_code returns Socket::EAI_FAIL instead of Socket::EAI_FAMILY. https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz This PR avoids the test failure by relaxing the condition. Also changed the domain for testing to `example.com`.
* Skip test_resolurion_error_error_code with FreeBSD environmentHiroshi SHIBATA2023-11-301-0/+3
| | | | https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz
* Fix the argument orderNobuyoshi Nakada2023-11-301-1/+1
|
* Replace SocketError with Socket::ResolutionError in rsock_raise_socket_errorMisaki Shioi2023-11-302-5/+13
| | | | rsock_raise_socket_error is called only when getaddrinfo and getaddrname fail
* Reduce the number of times IO is passed in send_io/recv_io testYusuke Endoh2023-10-251-7/+2
| | | | | | | | | | | | | | | | Since Linux 4.5, sendmsg(2) fails with ETOOMANYREFS if the number of "in-flight" IOs, which has been sent by sendmsg(2) but has not yet accepted by recvmsg(2), exceeds the RLIMIT_NOFILE resource limit. https://rubyci.s3.amazonaws.com/arm64-neoverse-n1/ruby-master/log/20231025T090004Z.fail.html.gz ``` 1) Error: TestSocket_UNIXSocket#test_fd_passing_race_condition: Errno::ETOOMANYREFS: Too many references: cannot splice - sendmsg(2) ``` This change reduces the number of times of IO passing under 1024, which is a default limit in many environments.
* Strip trailing spaces [ci skip]Nobuyoshi Nakada2023-10-251-1/+1
|
* Fixup 5461bc18f88Hiroshi SHIBATA2023-10-251-4/+6
|
* omit failing test at arm64-neoverse-n1Hiroshi SHIBATA2023-10-251-0/+3
|
* Fix failures when all network interfaces are downNobuyoshi Nakada2023-09-301-1/+1
|
* Fix test thread leakageNobuyoshi Nakada2023-09-241-6/+10
|
* TestSocket_UNIXSocket: stop testing empty packetsJean Boussier2023-08-311-2/+0
| | | | | | | | | | | | | | OpenBSD and Solaris behave differently here. Linux does deliver the empty packet, which is questionable as it's undistinguishable from a closed connection. It seems that OpenBSD and Solaris simply drop it. We could test the platform before doing the assertion, but it would likely be fragile, and the entire web recommend to not ever send an empty packet, so the value of this assertion is low.
* BasicSocket#recv* return `nil` rather than an empty packetJean Boussier2023-08-301-2/+66
| | | | | | | | | | | | | [Bug #19012] man recvmsg(2) states: > Return Value > These calls return the number of bytes received, or -1 if an error occurred. > The return value will be 0 when the peer has performed an orderly shutdown. Not too sure how one is supposed to make the difference between a packet of size 0 and a closed connection.
* Skip test_udp_server on s390x RHEL 7.1Takashi Kokubun2023-03-111-0/+4
| | | | It seems like it never succeeds on this CI.
* s/MJIT/RJIT/Takashi Kokubun2023-03-061-1/+1
|
* test/socket/test_addrinfo.rb: Suppress Errno::EACCES on WindowsNobuyoshi Nakada2022-12-211-2/+2
|
* Prevent a "warning: assigned but unused variable - s2"Yusuke Endoh2022-11-181-1/+1
|
* Add support for `sockaddr_un` on Windows. (#6513)Samuel Williams2022-11-172-43/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Windows: Fix warning about undefined if_indextoname() * Windows: Fix UNIXSocket on MINGW and make .pair more reliable * Windows: Use nonblock=true for read tests with scheduler * Windows: Move socket detection from File.socket? to File.stat Add S_IFSOCK to Windows and interpret reparse points accordingly. Enable tests that work now. * Windows: Use wide-char functions to UNIXSocket This fixes behaviour with non-ASCII characters. It also fixes deletion of temporary UNIXSocket.pair files. * Windows: Add UNIXSocket tests for specifics of Windows impl. * Windows: fix VC build due to missing _snwprintf Avoid usage of _snwprintf, since it fails linking ruby.dll like so: linking shared-library x64-vcruntime140-ruby320.dll x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l whereas linking miniruby.exe succeeds. This patch uses snprintf on the UTF-8 string instead. Also remove branch GetWindowsDirectoryW, since it doesn't work. * Windows: Fix dangling symlink test failures Co-authored-by: Lars Kanis <kanis@comcard.de>
* Add IO#timeout attribute and use it for blocking IO operations. (#5653)Samuel Williams2022-10-071-1/+1
|
* fixup 8cd6f2a0872e74c6cc089d2a4f8140483080c67aHiroshi SHIBATA2022-09-071-3/+1
| | | | we should handle ensure block when omit this test
* omit random failure tests with FreeBSDHiroshi SHIBATA2022-09-061-0/+2
| | | | | http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220906T043002Z.fail.html.gz http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220905T103002Z.fail.html.gz
* Use omit instead of skip: test/socket/**/*.rbHiroshi SHIBATA2021-12-286-11/+11
|
* Prepare for removing RubyVM::JIT (#5262)Takashi Kokubun2021-12-131-1/+1
|
* Revert "test/socket/test_socket.rb: skip on Solaris"Naohisa Goto2021-11-301-4/+0
| | | | | | | | | This reverts commit 27fb9d272daaae89089dfb61849ebe8e7aa6c833. The test failure on Solaris 10 is due to incomplete IPv6 configuration on the CI server, that have already been fixed. Reference for the fix: https://centrify.force.com/support/Article/KB-1179-X11-Forwarding-fails-with-Centrify-OpenSSH-5-0-Solaris/
* Use Test::Unit::AssertionFailedError instead of MiniTest::Assertion for ↵Hiroshi SHIBATA2021-09-062-2/+2
| | | | test-unit migration
* test/socket/test_socket.rb: skip on SolarisYusuke Endoh2021-07-291-0/+4
| | | | | | | | The test fails on Solaris 10. Maybe due to the IPv6 configuration on the server, but I have no idea at all. I've asked @ngoto to investigate the issue, so will tentatively skip the tests on Solaris http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20210729T040002Z.fail.html.gz
* Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]Nobuyoshi Nakada2021-05-212-2/+10
|
* Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]Nobuyoshi Nakada2021-05-201-1/+6
|
* Fixed FD leaksNobuyoshi Nakada2021-03-081-1/+1
|
* added mutexes for socket and connection lists on win32Andrew Aladjev2021-02-231-0/+25
|
* Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun2021-01-131-1/+1
| | | | | | | | because the name "MJIT" is an internal code name, it's inconsistent with --jit while they are related to each other, and I want to discourage future JIT implementation-specific (e.g. MJIT-specific) APIs by this rename. [Feature #17490]
* Skip test when UDP server is no response.Hiroshi SHIBATA2021-01-131-0/+3
|
* Add connect_timeout to TCPSocketMasaki Matsushita2020-12-101-0/+6
| | | | | | Add connect_timeout to TCPSocket.new in the same way as Socket.tcp. Closes [Feature #17187]
* Revert getaddrinfo_a()Masaki Matsushita2020-12-071-10/+0
| | | | | | | | getaddrinfo_a() gets stuck after fork(). To avoid this, we need 1 second sleep to wait for internal worker threads of getaddrinfo_a() to be finished, but that is unacceptable. [Bug #17220] [Feature #17134] [Feature #17187]
* Reduce timeout of test_getaddrinfo_after_forkMasaki Matsushita2020-12-051-1/+1
|
* Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&Benoit Daloze2020-12-041-1/+1
| | | | * Otherwise those tests, etc cannot run on alternative Ruby implementations.
* Add a hook before fork() for getaddrinfo_a()Masaki Matsushita2020-12-041-0/+10
| | | | | | | | | We need stop worker threads in getaddrinfo_a() before fork(). This change adds a hook before fork() that cancel all outstanding requests and wait for all ongoing requests. Then, it waits for all worker threads to be finished. Fixes [Bug #17220]
* Add resolve_timeout to TCPSocket [Feature #17134]Masaki Matsushita2020-09-251-0/+14
|
* Update UnixSocket#recv_io tests to handle receiving a UnixSocketJeremy Evans2020-09-221-2/+8
| | | | | | | | Receiving UnixSocket works fine if you don't provide a mode, and I think it is reasonable to expect that you should not provide a mode if klass.for_fd would not accept a mode. Fixes [Bug #11778]
* Make Socket.getaddrinfo interruptible (#2827)Kir Shatrov2020-08-271-1/+1
| | | | | | | | | | | | | | | | | | | Before, Socket.getaddrinfo was using a blocking getaddrinfo(3) call. That didn't allow to wrap it into Timeout.timeout or interrupt the thread in any way. Combined with the default 10 sec resolv timeout on many Unix systems, this can have a very noticeable effect on production Ruby apps being not resilient to DNS outages and timing out name resolution, and being unable to fail fast even with Timeout.timeout. Since we already have support for getaddrinfo_a(3), the async version of getaddrinfo, we should be able to make Socket.getaddrinfo leverage that when getaddrinfo_a version is available in the system (hence #ifdef HAVE_GETADDRINFO_A). Related tickets: https://bugs.ruby-lang.org/issues/16476 https://bugs.ruby-lang.org/issues/16381 https://bugs.ruby-lang.org/issues/14997
* test/socket/test_addrinfo.rb: Fix syntax errorYusuke Endoh2020-06-041-1/+1
| | | | Sorry!
* test/socket/test_addrinfo.rb: Suppress Errno::EACCES when addr is in useYusuke Endoh2020-06-041-1/+4
| | | | | | | | | | | | | | | | | | MinGW seems to raise Errno::EACCES instead of EADDRINUSE when bind fails due to in use. https://github.com/ruby/ruby/runs/736825846 ``` 2) Error: TestSocketAddrinfo#test_connect_from: Errno::EACCES: Permission denied - bind(2) for 0.0.0.0:49721 D:/a/ruby/ruby/build/.ext/common/socket.rb:54:in `bind' D:/a/ruby/ruby/build/.ext/common/socket.rb:54:in `connect_internal' D:/a/ruby/ruby/build/.ext/common/socket.rb:114:in `connect_from' D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:379:in `block in test_connect_from' D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:374:in `open' D:/a/ruby/ruby/src/test/socket/test_addrinfo.rb:374:in `test_connect_from' ```
* Thread scheduler for light weight concurrency.Samuel Williams2020-05-141-2/+0
|
* Fixed leaked fdsNobuyoshi Nakada2020-05-061-3/+7
|
* Test interfaces include localhostKazuhiro NISHIYAMA2019-12-061-0/+9
| | | | | When interfaces do not include localhost, some other tests may fail.
* Remove check of ai.protocolMasaki Matsushita2019-09-101-1/+0
| | | | Solaris 10 returns addrinfo.ai_protocol as 0, not 6.
* Support timeout for AddrinfoMasaki Matsushita2019-09-101-0/+5
| | | | | | | | | | | | Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as a keyword argument. If getaddrinfo_a(3) is available, the timeout will be applied for name resolution. Otherwise, it will be ignored. Socket.tcp accepts :resolv_timeout to use this feature. This commit is retry of 6382f5cc91ac9e36776bc854632d9a1237250da7. Test was failed on Solaris machines which don't have "http" in /etc/services. In this commit, use "ssh" instead.
* Revert "Support timeout for Addrinfo"Masaki Matsushita2019-09-091-5/+0
| | | | | This reverts commit 6382f5cc91ac9e36776bc854632d9a1237250da7. test failed on Solaris.
* Fix expected ip_portMasaki Matsushita2019-09-091-1/+1
|
* Fix service name for testMasaki Matsushita2019-09-091-1/+1
| | | | change service name to fix failed test on Solaris