Commit graph

16449 commits

Author SHA1 Message Date
aycabta
9b56668bf8 Omit test_interrupt_in_other_thread with Editline 2021-08-06 03:50:02 +09:00
aycabta
6414334d3c Fix reversal of assertion result 2021-08-06 03:17:51 +09:00
aycabta
cd57b39f79 Fix control structure to preperly catch Timeout::Error 2021-08-06 03:15:58 +09:00
aycabta
1cb5a669d3 Show log when timed out 2021-08-05 19:39:22 +09:00
aycabta
042d4c8133 Remove an unused variable 2021-08-04 23:35:08 +09:00
Nobuyoshi Nakada
594c3df9a9
Tests for Windows can run only on Windows
Should not directly require "reline/windows.rb" which should be
loaded by "reline.rb".
2021-08-05 13:58:07 +09:00
Peter Zhu
1fd0a2e4a6 Reenable GC at the end of test
The test disables GC but never reenables it. Before this patch, running
all tests would have a peak RSS in the main process of >4GB. After this
patch, peak RSS in the main process is <500MB.
2021-08-04 16:11:08 -04:00
aycabta
6e55facdb3 Run interrupt test except on Windows 2021-08-04 18:29:42 +09:00
aycabta
aba10ea61e Add a load path to require 'helper' 2021-08-04 18:29:42 +09:00
aycabta
335c12826a Show the log of test_interrupt_in_other_thread when failed 2021-08-04 18:29:42 +09:00
aycabta
17ef7a98ef Check the existence of the test classes 2021-08-04 18:29:42 +09:00
aycabta
5ca0a51ffd Add a test for handling SIGINT in other thread 2021-08-04 18:29:42 +09:00
Samuel Williams
2d4f29e77e Fix potential hang when joining threads.
If the thread termination invokes user code after `th->status` becomes
`THREAD_KILLED`, and the user unblock function causes that `th->status` to
become something else (e.g. `THREAD_RUNNING`), threads waiting in
`thread_join_sleep` will hang forever. We move the unblock function call
to before the thread status is updated, and allow threads to join as soon
as `th->value` becomes defined.

This reverts commit 6505c77501.
2021-08-03 22:23:48 +12:00
Nobuyoshi Nakada
4c3140d60f
Add keyrest to ruby2_keywords parameters [Bug #18011] 2021-08-03 10:56:50 +09:00
Nobuyoshi Nakada
4453280bb4 Stop infinite object allocation to get rid of OOM killer 2021-08-02 10:18:22 +09:00
Masataka Pocke Kuwabara
242f024bcb [ruby/error_highlight] Keep it work if paren exists after receiver
b79d679bbd
2021-07-31 22:15:16 +09:00
Nobuyoshi Nakada
fd96503f7b
Fix bundled gems locations
Changed since 55bf0ef1aa.
2021-07-30 12:21:38 +09:00
Jeremy Evans
2aecb95acb Skip test_ensure_after_nomemoryerror
This test appears to cause failures in some environments.
2021-07-29 18:54:20 -07:00
Jeremy Evans
9931e2f509 Improve performance of Integer#digits
This speeds up performance by multiple orders of magnitude for
large integers.

Fixes [Bug #14391]

Co-authored-by: tompng (tomoya ishida) <tomoyapenguin@gmail.com>
2021-07-29 15:19:12 -07:00
Jeremy Evans
64ac984129 Make RubyVM::AbstractSyntaxTree.of raise for method/proc created in eval
This changes Thread::Location::Backtrace#absolute_path to return
nil for methods/procs defined in eval.  If the realpath of an iseq
is nil, that indicates it was defined in eval, in which case you
cannot use RubyVM::AbstractSyntaxTree.of.

Fixes [Bug #16983]

Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-07-29 13:51:03 -07:00
aycabta
41e2ab88c3 Use test-unit assertions 2021-07-30 02:56:29 +09:00
SilverPhoenix99
5b9f3ed326 [ruby/reline] Fixed Ctrl+Enter key in Windows.
0c38e39023
2021-07-30 02:27:02 +09:00
aycabta
46c6da9c37 [ruby/reline] Check empty .inputrc
b60b3b76cd
2021-07-30 02:27:02 +09:00
Lars Kanis
03f8c27179 [ruby/reline] Windows cmd: Don't type anything when pressing ALT keys alone
Fixes #298

72acfcd27a
2021-07-30 02:27:02 +09:00
aycabta
5313d234e0 [ruby/reline] Use "omit" instead of "return"
940cdaa301
2021-07-30 02:27:02 +09:00
aycabta
8fc98295cb [ruby/reline] Add Terminfo tests
17721e477e
2021-07-30 02:27:02 +09:00
Jeremy Evans
87b327efe6 Do not check pending interrupts when running finalizers
This fixes cases where exceptions raised using Thread#raise are
swallowed by finalizers and not delivered to the running thread.

This could cause issues with finalizers that rely on pending interrupts,
but that case is expected to be rarer.

Fixes [Bug #13876]
Fixes [Bug #15507]

Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-07-29 09:44:11 -07:00
Nobuyoshi Nakada
7564e066ff
Renamed thraed_fd_close as thread_fd 2021-07-29 21:15:04 +09:00
Hiroshi SHIBATA
f8ad51dd9a Fix test failure of 60b02db516 with Windows 2021-07-29 20:54:54 +09:00
Hiroshi SHIBATA
a4df7cb338
Partly picking 25ef7dbeda (diff-1ce41a048bf2c08aa7bf25b741e9d3a4e08ea03f0d80bc6b8ee6d1c3c259704dR1022) 2021-07-29 16:26:15 +09:00
Pavel Rosický
b11638eed2 [ruby/psych] require 'delegate' explicitly
51a9ce13db
2021-07-29 15:54:34 +09:00
Miguel Teixeira
60b02db516 [ruby/net-http] Enforce write timeout when body_stream is used
The existing implementation of `Net::HTTP#write_timeout` relies on
`Net::BefferedIO` to trigger the `Net::WriteTimeout` error. This commit
changes `send_request_with_body_stream` to remove the optimization that
was making `Net::HTTP#write_timeout` not work when `body_stream` is
used.

Open issue:
https://bugs.ruby-lang.org/issues/17933

a0fab1ab52
2021-07-29 15:53:54 +09:00
Hiroshi SHIBATA
b3413914d9
Partly picked from 20d0b8c065 2021-07-29 15:52:32 +09:00
Jeremy Evans
571dafdc7f [ruby/set] Allow Set#intersect? and #disjoint? to accept array argument
Implements [Feature #17838]

d9b389bafa
2021-07-29 14:18:10 +09:00
Yusuke Endoh
27fb9d272d test/socket/test_socket.rb: skip on Solaris
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

20210729T040002Z.fail.html.gz
2021-07-29 13:51:43 +09:00
Koichi Sasada
fb4cf204a6 use me->def instead of me for opt_table
`vm_opt_method_table` is me=>bop table to manage the optimized
methods (by specialized instruction). However, `me` can be invalidated
to invalidate the method cache entry.
[Bug #17725]

To solve the issue, use `me-def` instead of `me` which simply copied
at invalidation timing.

A test by @jeremyevans https://github.com/ruby/ruby/pull/4376
2021-07-29 00:56:48 +09:00
Jeremy Evans
3b9fe3e15a Handle Timeout::Error instead of NoMemoryError in test
Solaris 11 CI times out instead of raising NoMemoryError for large
allocations, so it cannot test ensure after NoMemoryError.
2021-07-28 08:48:01 -07:00
Benoit Daloze
59a65f2d24 Update to latest uri
* bc47bf71df
* To include the fix from https://github.com/ruby/uri/pull/27
2021-07-28 12:26:31 +02:00
Jeremy Evans
b3d62a77d9 [ruby/zlib] Synchronize access to zstream to prevent segfault in multithreaded use
I'm not sure whether this handles all multithreaded use cases,
but this handles the example that crashes almost immediately
and does 10,000,000 total deflates using 100 separate threads.

To prevent the tests from taking forever, the committed test
for this uses only 10,000 deflates across 10 separate threads,
which still causes a segfault in the previous implementation
almost immediately.

Fixes [Bug #17803]

4b1023b3f2
2021-07-28 13:40:03 +09:00
Hiroshi SHIBATA
be4b0eee19
[ruby/digest] Use pend instead of skip
82fb618157
2021-07-28 11:48:36 +09:00
Nobuyoshi Nakada
42ea359a0c
Suppress "possibly useless use of * in void context" warning 2021-07-28 11:43:54 +09:00
Yusuke Endoh
6505c77501 Revert "Fix potential hang when joining threads."
This reverts commit 13f8521c63.

20210727T230009Z.fail.html.gz
20210728T000009Z.fail.html.gz

This revert is to confirm whether the commit is the cause.
If the failures consistently occur after this revert, I'll
reintroduce the commit.
2021-07-28 11:05:36 +09:00
Jeremy Evans
35e467080c Make Float#floor with ndigits argument handle error
The previous implementation could result in a returned
float that is 1/(10**ndigits) too low.  First try adding
one before dividing, and if that results in a value that is
greater than the initial number, then try the original
calculation.

Spec added for ciel, but the issue doesn't appear to affect
ciel, at least not for the same number.  If the issue does
effect ciel, a similar fix could probably work for it.

Fixes [Bug #18018]
2021-07-27 11:00:45 -07:00
Jeremy Evans
a6dc48f86a Fix infinite loop in ensure after NoMemoryError
VM patch from wanabe.

Test based on example from buzztaiki (Taiki Sugawara).

Test fails when compiles with -DRUBY_DEBUG, as that can
can use rb_bug instead of NoMemoryError, which doesn't
allow testing this case. Test also fails on MingW, as
RangeError is used instead of NoMemoryError. Skip the
test in either case.

Fixes [Bug #15779]
2021-07-27 10:47:53 -07:00
Martin Dürst
26b1e6fca8 Deal with Unicode ranges in the file emoji-sequences.txt
Detect Unicode ranges and loop over them.
This fixes issue #18028.
2021-07-27 18:14:20 +09:00
Martin Dürst
3010b40477 Adjust test/ruby/enc/test_emoji_breaks.rb to handle Emoji Version 13.1
Deal with the issue that the emoji files in emoji/13.1 have Unicode
Emoji version 13.1, but at the same time the files in 13.0.0/ucd/emoji
are still at Emoji version 13.0. Specifically:
- Add a version attribute to TestEmojiBreaks::BreakFile
- Take the version for emoji-variant-sequences.txt from the Unicode
  version, removing the last two characters.
- Improve information in exceptions for file name and version mismatches.
2021-07-27 17:10:49 +09:00
Hiroshi SHIBATA
d3d68aa842
[ruby/uri] User assert_ractor for test case of Ractor
bbf8b44dba
2021-07-27 16:57:03 +09:00
Benoit Daloze
1cf111774f
[ruby/uri] Add proper Ractor support to URI
* Using a module to map scheme name to scheme class, which also works with Ractor.
* No constant redefinition, no ObjectSpace, still fast lookup for initial schemes.

883567fd81
2021-07-27 16:54:27 +09:00
Benoit Daloze
090d799c24
[ruby/uri] Revert "Fix to support Ruby 3.0 Ractor"
* This reverts commit 1faa4fdc161d7aeebdb5de0c407b923beaecf898.
* It has too many problems, see https://github.com/ruby/uri/pull/22 for discussion.

b959da2dc9
2021-07-27 16:54:26 +09:00
kvokka
a288c21a5d
[ruby/uri] Fix to support Ruby 3.0 Ractor
1faa4fdc16
2021-07-27 16:54:26 +09:00