summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-02-07merge revision(s) 3a7367ccc319499127ead147e5a08f769e44208e: [Backport #19403]NARUSE, Yui
mkconfig: Map `includedir` only for system ruby Only when installing to the system path on macOS, prepend '$(SDKROOT)' and remap `includedir`. Fix https://github.com/rbenv/ruby-build/discussions/2123 --- test/mkmf/test_config.rb | 4 ++-- test/test_rbconfig.rb | 9 --------- tool/mkconfig.rb | 4 +++- 3 files changed, 5 insertions(+), 12 deletions(-)
2023-02-07merge revision(s) fad48fefe19cc282a5b209944244a3713359b47f: [Backport #19399]NARUSE, Yui
[Bug #19399] Parsing invalid heredoc inside block parameter Although this is of course invalid as Ruby code, allow to just parse and tokenize. --- ext/ripper/lib/ripper/lexer.rb | 2 +- test/ripper/test_lexer.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
2023-02-06merge revision(s) c6f84e918943a0bf8db6fee556fc53180d257510: [Backport #19398]NARUSE, Yui
[Bug #19398] Memory leak in WeakMap There's a memory leak in ObjectSpace::WeakMap due to not freeing the `struct weakmap`. It can be seen in the following script: ``` 100.times do 10000.times do ObjectSpace::WeakMap.new end # Output the Resident Set Size (memory usage, in KB) of the current Ruby process puts `ps -o rss= -p #{$$}` end ``` --- gc.c | 1 + test/ruby/test_weakmap.rb | 9 +++++++++ 2 files changed, 10 insertions(+)
2023-02-01Merge RubyGems 3.4.6 and Bundler 2.4.6 (#7214)Hiroshi SHIBATA
Merge RubyGems-3.4.6 and Bundler-2.4.6
2023-01-31merge revision(s) eccfc978fd6f65332eb70c9a46fbb4d5110bbe0a: [Backport #19379]NARUSE, Yui
Fix parsing of regexps that toggle extended mode on/off inside regexp This was broken in ec3542229b29ec93062e9d90e877ea29d3c19472. That commit didn't handle cases where extended mode was turned on/off inside the regexp. There are two ways to turn extended mode on/off: ``` /(?-x:#y)#z /x =~ '#y' /(?-x)#y(?x)#z /x =~ '#y' ``` These can be nested inside the same regexp: ``` /(?-x:(?x)#x (?-x)#y)#z /x =~ '#y' ``` As you can probably imagine, this makes handling these regexps somewhat complex. Due to the nesting inside portions of regexps, the unassign_nonascii function needs to be recursive. In recursive mode, it needs to track both opening and closing parentheses, similar to how it already tracked opening and closing brackets for character classes. When scanning the regexp and coming to `(?` not followed by `#`, scan for options, and use `x` and `i` to determine whether to turn on or off extended mode. For `:`, indicting only the current regexp section should have the extended mode switched, recurse with the extended mode set or unset. For `)`, indicating the remainder of the regexp (or current regexp portion if already recursing) should turn extended mode on or off, just change the extended mode flag and keep scanning. While testing this, I noticed that `a`, `d`, and `u` are accepted as options, in addition to `i`, `m`, and `x`, but I can't see where those options are documented. I'm not sure whether or not handling `a`, `d`, and `u` as options is a bug. Fixes [Bug #19379] --- re.c | 153 +++++++++++++++++++++++++++++++++++++---------- test/ruby/test_regexp.rb | 56 +++++++++++++++++ 2 files changed, 176 insertions(+), 33 deletions(-)
2023-01-31merge revision(s) 3f54d09a5b8b6e4fd734abc8911e170d5967b5b0: [Backport #19390]NARUSE, Yui
bignum.c: rb_int_parse_cstr handle `0` strings [Bug #19390] We shouldn't check the string length when skipping zeros, as the string might only contains zero characters, resulting in an empty string. --- bignum.c | 1 - test/ruby/test_time.rb | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
2023-01-31merge revision(s) 21dced8b01823a991829b66ffdc8ffc635965c76: [Backport #19389]NARUSE, Yui
[ruby/stringio] [Bug #19389] Fix chomping with longer separator https://github.com/ruby/stringio/commit/eb322a9716 --- ext/stringio/stringio.c | 5 +++-- test/stringio/test_stringio.rb | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
2023-01-25Merge the latest stable versions of RubyGems and Bundler to Ruby 3.2.x (#7061)Hiroshi SHIBATA
[Bug #19350] * Merge RubyGems-3.4.2 and Bundler-2.4.2 * Merge RubyGems-3.4.3 and Bundler-2.4.3 * Generate parser-text.rb of racc when sync it * Ignore LICENSE files of libraries vendored in rubygems [ci skip] * Adjust spec of bundler like as `sync_default_gems` [ci skip] * Fixed a typo * Removed vendored LICENSE file. * Update LEGAL sections for pub_grub * Merge RubyGems-3.4.4 and Bundler-2.4.4 * Merge RubyGems-3.4.5 and Bundler-2.4.5 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-01-25merge revision(s) ↵NARUSE, Yui
2c93c554019ebdc394d3c51c6d925620d3005f84,f5ea43a2e61789357e9c4b374b4bc6756abeae17: [Backport #19360] Ensure main file has default coverage if required. (#7169) * Extract common code for coverage setup. --- iseq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) More coverage tests & specs. (#7171) * Add spec for eval and line coverage. * Add test for main file coverage. --- spec/ruby/library/coverage/start_spec.rb | 8 +++++++- test/coverage/autostart.rb | 2 ++ test/coverage/main.rb | 1 + test/coverage/test_coverage.rb | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/coverage/autostart.rb create mode 100644 test/coverage/main.rb
2023-01-20merge revision(s) ed6fbb79e19bf401db0e85447fee955fd10a25c7: [Backport #19339]NARUSE, Yui
Fix crash when defining ivars on special constants [Bug #19339] --- test/ruby/test_variable.rb | 6 ++++++ vm_insnhelper.c | 5 +++++ 2 files changed, 11 insertions(+)
2023-01-20merge revision(s) f7b72462aa27716370c6bea1f2c240983aca9a55: [Backport #19356]NARUSE, Yui
String#bytesplice should return self In Feature #19314, we concluded that the return value of String#bytesplice should be changed from the source string to the receiver, because the source string is useless and confusing when extra arguments are added. This change should be included in Ruby 3.2.1. --- string.c | 4 ++-- test/ruby/test_string.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
2023-01-19merge revision(s) 3be2acfafd3b3c6168e2266c7c6561d143d7ae5c: [Backport #19327]NARUSE, Yui
Fix re-embedding of strings during compaction The reference updating code for strings is not re-embedding strings because the code is incorrectly wrapped inside of a `if (STR_SHARED_P(obj))` clause. Shared strings can't be re-embedded so this ends up being a no-op. This means that strings can be moved to a large size pool during compaction, but won't be re-embedded, which would waste the space. --- gc.c | 16 +++++++++------- string.c | 12 ++++++++---- test/ruby/test_gc_compact.rb | 8 ++++---- 3 files changed, 21 insertions(+), 15 deletions(-)
2023-01-19Fix test when Ruby is verbosePeter Zhu
The test added in 90a80eb0 fails if Ruby is verbose, it outputs the following line to stderr: RUBY_GC_HEAP_INIT_SLOTS=100 (default value: 10000)
2023-01-19merge revision(s) 979dd02e2f0a70f3f30d47c6115780d8fac6147e: [Backport #19262]NARUSE, Yui
Check if the argument is Thread::Backtrace::Location object [Bug #19262] --- ast.c | 5 +++++ test/ruby/test_ast.rb | 6 ++++++ 2 files changed, 11 insertions(+)
2023-01-18merge revision(s) 837ef8911c638c3e2bdb6af710de7c1fac7b5f90: [Backport #19305]NARUSE, Yui
Fix crash in TracePoint c_call for removed method trace_arg->id is the ID of the original method of an aliased method. If the original method is removed, then the lookup will fail. We should use trace_arg->called_id instead, which is the ID of the aliased method. Fixes [Bug #19305] --- test/ruby/test_settracefunc.rb | 23 +++++++++++++++++++++++ vm_trace.c | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-)
2023-01-18merge revision(s) aeddc19340c7116d48fac3080553fbb823857d16: [Backport #19316]NARUSE, Yui
YJIT: Save PC and SP before calling leaf builtins (#7090) Previously, we did not update `cfp->sp` before calling the C function of ISEQs marked with `Primitive.attr! "inline"` (leaf builtins). This caused the GC to miss temporary values on the stack in case the function allocates and triggers a GC run. Right now, there is only a few leaf builtins in numeric.rb on Integer methods such as `Integer#~`. Since these methods only allocate when operating on big numbers, we missed this issue. Fix by saving PC and SP before calling the functions -- our usual protocol for calling C functions that may allocate on the GC heap. [Bug #19316] --- test/ruby/test_yjit.rb | 16 ++++++++++++++++ yjit/src/codegen.rs | 4 ++++ 2 files changed, 20 insertions(+)
2023-01-18merge revision(s) 43ff0c2c488c80aaf83b486d45bcd4a92ebe3848: [Backport #19299]NARUSE, Yui
YJIT: Fix `yield` into block with >=30 locals on ARM It's a register spill issue. Fix by moving the Qnil fill snippet to after registers are released. [Bug #19299] --- test/ruby/test_yjit.rb | 14 ++++++++++++++ yjit/src/codegen.rs | 29 ++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-)
2023-01-18merge revision(s) ↵NARUSE, Yui
291a4098cf649c027cb50c16b872455f26ad1dfb,5be0d42d2c4dc765230c76738289560f9ee37f09: [Backport #19296] Add missing assertion --- test/ruby/test_time.rb | 3 +++ 1 file changed, 3 insertions(+) [Bug #19296] Precheck bits of time components --- test/ruby/test_time.rb | 15 +++++++++++++++ time.c | 14 ++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-)
2023-01-17merge revision(s) 542e984d82fa25098eb15398d716d907acc52b93: [Backport #19292]NARUSE, Yui
[Bug #19292] Re-initialize tm when wday or yday is not set --- test/ruby/test_time.rb | 3 ++- time.c | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-)
2023-01-17merge revision(s) 90a80eb076429978e720e11fb17a3cbb96de3454: [Backport #19284]NARUSE, Yui
Fix integer underflow when using HEAP_INIT_SLOTS There is an integer underflow when the environment variable RUBY_GC_HEAP_INIT_SLOTS is less than the number of slots currently in the Ruby heap. [Bug #19284] --- gc.c | 25 +++++++++++++------------ test/ruby/test_gc.rb | 5 +++++ 2 files changed, 18 insertions(+), 12 deletions(-)
2022-12-29merge revision(s) b726d60c986bf951d13e7a2ab5f5e58f58657b03: [Backport #19273]NARUSE, Yui
Fix [Bug 19273], set correct value to `outer_repeat` on `OP_REPEAT` (#7035) --- regexec.c | 2 +- test/ruby/test_regexp.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
2022-12-27merge revision(s) fc03ba50f1ff6c30f7c654f564b4dffbed0844ef: [Backport #19263]NARUSE, Yui
MJIT: Fix JIT code for multiple values in a single case [Bug #19263] --- lib/ruby_vm/mjit/compiler.rb | 2 +- test/ruby/test_mjit.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
2022-12-24Test of environment variables order for HOME on WindowsNobuyoshi Nakada
2022-12-24Add Dir.home test with encodingNobuyoshi Nakada
2022-12-24MJIT: Cancel all on disastrous situations (#7019)Takashi Kokubun
I noticed this while running test_yjit with --mjit-call-threshold=1, which redefines `Integer#<`. When Ruby is monkey-patched, MJIT itself could be broken. Similarly, Ruby scripts could break MJIT in many different ways. I prepared the same set of hooks as YJIT so that we could possibly override it and disable it on those moments. Every constant under RubyVM::MJIT is private and thus it's an unsupported behavior though. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-12-24Merge RubyGems-3.4.0 and Bundler-2.4.0Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/6987
2022-12-24Extract setup of environment variablesNobuyoshi Nakada
2022-12-24Fix missing handling of offset argument in `IO::Buffer` `pread` and ↵Samuel Williams
`pwrite`. (#7012) Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-24test/test_trick.rb: Add tests for TRICK 2022 entriesYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/7014
2022-12-23Add tests for compacting shared arraysPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/7013
2022-12-23Don't allow re-embedding frozen arraysPeter Zhu
Frozen arrays should not move from heap allocated to embedded because frozen arrays could be shared roots for other (shared) arrays. If the frozen array moves from heap allocated to embedded it would cause issues since the shared array would no longer know where to set the pointer in the shared root. Notes: Merged: https://github.com/ruby/ruby/pull/7013
2022-12-23[ruby/rdoc] Fix fragile testsNobuyoshi Nakada
When the temporary path is long enough, the formatter may fold the path and may hit a hyphen at the end of line, and miscounted. https://github.com/ruby/rdoc/commit/5f46479543
2022-12-23Debug for zlinux CI [ci skip]Nobuyoshi Nakada
2022-12-23[ruby/rdoc] Clean up home directories for each testNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/f067c174da
2022-12-23[ruby/openssl] test/openssl/test_pkey.rb: allow failures in ↵Kazuki Yamaguchi
test_s_generate_parameters The root cause has been fixed by OpenSSL 3.0.6, but Ubuntu 22.04's OpenSSL package has not backported the patch yet. Reference: https://github.com/ruby/openssl/issues/492 https://github.com/ruby/openssl/commit/f2e2a5e5ed
2022-12-23[ruby/openssl] pkey/ec: check private key validity with OpenSSL 3Joe Truba
The behavior of EVP_PKEY_public_check changed between OpenSSL 1.1.1 and 3.0 so that it no longer validates the private key. Instead, private keys can be validated through EVP_PKEY_private_check and EVP_PKEY_pairwise_check. [ky: simplified condition to use either EVP_PKEY_check() or EVP_PKEY_public_check().] https://github.com/ruby/openssl/commit/e38a63ab3d
2022-12-23[ruby/openssl] test/openssl/test_ssl.rb: do not run SSL tests if not availableKazuki Yamaguchi
https://github.com/ruby/openssl/commit/a3d230d4e0
2022-12-23[ruby/openssl] ssl: disable NPN support on LibreSSLKazuki Yamaguchi
As noted in commit https://github.com/ruby/openssl/commit/a2ed156cc9f1 ("test/test_ssl: do not run NPN tests for LibreSSL >= 2.6.1", 2017-08-13), NPN is known not to work properly on LibreSSL. Disable NPN support on LibreSSL, whether OPENSSL_NO_NEXTPROTONEG is defined or not. NPN is less relevant today anyway. Let's also silence test suite when it's not available. https://github.com/ruby/openssl/commit/289f6e0e1f
2022-12-23[ruby/openssl] test/openssl/test_asn1.rb: remove pend for unsupported ↵Kazuki Yamaguchi
LibreSSL versions Commit https://github.com/ruby/openssl/commit/af895bc5596b ("asn1: avoid truncating OID in OpenSSL::ASN1::ObjectId#oid", 2016-12-15) added this test case. The OBJ_obj2txt() issue was fixed by LibreSSL 2.5.1 (released in 2017) and is no longer relevant today. https://github.com/ruby/openssl/commit/6a188f1a29
2022-12-23[ruby/openssl] test/openssl/test_asn1.rb: skip failing tests on LibreSSL 3.6.0Kazuki Yamaguchi
LibreSSL 3.6.0 expects the seconds part in UTCTime and GeneralizedTime to be always present. LibreSSL 3.6.0 release note [1] says: > - The ASN.1 time parser has been refactored and rewritten using CBS. > It has been made stricter in that it now enforces the rules from > RFC 5280. [1] https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.6.0-relnotes.txt https://github.com/ruby/openssl/commit/bbc540fe83
2022-12-22Clean intermediate source file in `TestMJIT#test_jit_failure` (#6994)Nobuyoshi Nakada
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-12-22Always issue deprecation warning when calling Regexp.new with 3rd positional ↵Jeremy Evans
argument Previously, only certain values of the 3rd argument triggered a deprecation warning. First step for fix for bug #18797. Support for the 3rd argument will be removed after the release of Ruby 3.2. Fix minor fallout discovered by the tests. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6976
2022-12-22Share argument parsing in `Regexp#initialize` and `Regexp.linear_time?`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6988
2022-12-21Make sure TracePoint#binding returns nil for c_call/c_return eventsJeremy Evans
This makes sure the method returns nil for these events, as described in NEWS, even if the TracePoint could create a binding. Notes: Merged: https://github.com/ruby/ruby/pull/6984 Merged-By: jeremyevans <code@jeremyevans.net>
2022-12-21Add copy with changes functionality for Data objects (#6766)Ufuk Kayserilioglu
Implements [Feature #19000] This commit adds copy with changes functionality for `Data` objects using a new method `Data#with`. Since Data objects are immutable, the only way to change them is by creating a copy. This PR adds a `with` method for `Data` class instances that optionally takes keyword arguments. If the `with` method is called with no arguments, the behaviour is the same as the `Kernel#dup` method, i.e. a new shallow copy is created with no field values changed. However, if keyword arguments are supplied to the `with` method, then the copy is created with the specified field values changed. For example: ```ruby Point = Data.define(:x, :y) point = Point.new(x: 1, y: 2) point.with(x: 3) # => #<data Point x: 3, y: 2> ``` Passing positional arguments to `with` or passing keyword arguments to it that do not correspond to any of the members of the Data class will raise an `ArgumentError`. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-12-21Make Enumerartor.product return nil when called with a blockAkinori MUSHA
2022-12-21Make product consistently yield an array of N elements instead of N argumentsAkinori MUSHA
Inconsistency pointed out by @mame: ``` >> Enumerator.product([1], [2], [3]).to_a => [[1, 2, 3]] >> Enumerator.product([1], [2]).to_a => [[1, 2]] >> Enumerator.product([1]).to_a => [1] >> Enumerator.product().to_a => [nil] ``` Got fixed as follows: ``` >> Enumerator.product([1], [2], [3]).to_a => [[1, 2, 3]] >> Enumerator.product([1], [2]).to_a => [[1, 2]] >> Enumerator.product([1]).to_a => [[1]] >> Enumerator.product().to_a => [[]] ``` This was due to the nature of the N-argument funcall in Ruby.
2022-12-21test/socket/test_addrinfo.rb: Suppress Errno::EACCES on WindowsNobuyoshi Nakada
2022-12-21[ruby/optparse] The encoding argument of `Regexp.new` has been ignored since 1.9Nobuyoshi Nakada
https://github.com/ruby/optparse/commit/766f567405
2022-12-21test_readline#test_without_tty: Use EnvUtil.rubybinSorah Fukumori
`ruby` is not always available in certain build environments and configure options. Choose appropriate command line using EnvUtil. Notes: Merged: https://github.com/ruby/ruby/pull/5417