summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2025-10-08[ruby/openssl] provider: load "default" provider in test_openssl_legacy_providerKazuki Yamaguchi
Update the test case to explicitly load both the "default" and the "legacy" providers. Currently, the "default" provider as a side effect by the OpenSSL::PKey::DH.new call in lib/openssl/ssl.rb. It will be cleaned up in a following patch. https://github.com/ruby/openssl/commit/013db02fb2
2025-10-08[ruby/prism] For these special cases, there exists no optional argument ↵Earlopain
type. Since a endless method is started with `=`, there was ambiguity here. We have to simply reject these in all cases. This adds a new error for the following reason: * `def foo arg = nil` is interpreted as a normal method call with optional `arg` without matching `end` * `def foo *arg = nil; end` is interpreted as a endless method call that has body `nil` with extraneous `end` `def foo *arg = nil` is somewhere inbetween and I don't know how to otherwise indicate the error. Now the second case above also shows the newly added error message. Fixes [Bug #21623] https://github.com/ruby/prism/commit/e1910d4492
2025-10-07[ruby/error_highlight] Improve English comments and messagesYusuke Endoh
https://github.com/ruby/error_highlight/commit/5f976265ef
2025-10-07Initialize the main namespace after loading builtin librariesSatoshi Tagomori
* For having the common set of loaded libraries between root and main namespaces * To have the consistent $LOADED_FEATURES in the main namespace
2025-10-07Verify that RubyGems is enabled by defaultNobuyoshi Nakada
2025-10-07[ruby/uri] Clear user info totally at setting any of authority infoNobuyoshi Nakada
Fix CVE-2025-27221. https://hackerone.com/reports/3221142 https://github.com/ruby/uri/commit/5cec76b9e8
2025-10-06Sync Prism (#14751)Takashi Kokubun
to https://github.com/ruby/prism/commit/c89ca2af12ba20b4fd2c5ff43ebe25da1d81d8db
2025-10-06Remove unused variable warningÉtienne Barrié
$ make test/ruby/test_thread.rb RUBYOPT=-w >/dev/null test/ruby/test_thread.rb:1595: warning: assigned but unused variable - bug21127
2025-10-06ZJIT: strengthen test_reset_stats (#14738)Hoa Nguyen
2025-10-06[ruby/date] `Date._parse` does not accept `nil`Nobuyoshi Nakada
https://github.com/ruby/date/commit/545066ca28
2025-10-06[ruby/date] Do not repeat conversions to stringNobuyoshi Nakada
https://github.com/ruby/date/commit/159e1ebb7f https://github.com/ruby/date/commit/4f7b6c9b42
2025-10-06[ruby/json] Fix sliced string escapingtompng
https://github.com/ruby/json/commit/d7baf015d9
2025-10-05Also add LSAN_OPTIONS=handle_segv=0 in assert_segvPeter Zhu
Just like ASAN, when running with LSAN, we also want to set handle_segv=0 in assert_segv to make sure that the tests pass.
2025-10-05[ruby/pp] Suppress warnings in test on Ruby 2.7Nobuyoshi Nakada
TODO: Revert when dropping Ruby 2.7 support. https://github.com/ruby/pp/commit/feb417e152
2025-10-05[ruby/pp] Exclude out-of-scope test instead of omittingNobuyoshi Nakada
https://github.com/ruby/pp/commit/40b713d70f
2025-10-05[ruby/pp] Update pp for Set to use new inspect formatJeremy Evans
(https://github.com/ruby/pp/pull/43) Ruby 3.5 will use `Set[1, 2, 3]`. This updates pp to use the same format. https://github.com/ruby/pp/commit/507eebf711
2025-10-05[ruby/pp] Fix ::Data warning on Ruby 2.7Benoit Daloze
* It was showing on require 'pp': lib/pp.rb:525: warning: constant ::Data is deprecated * Fixes https://github.com/ruby/pp/issues/51 https://github.com/ruby/pp/commit/4fd8f4e0bb
2025-10-05[ruby/pp] Support new instance_variables_to_inspect method from Ruby coreJason Frey
This supports the new `instance_variables_to_inspect` method from Ruby core that was added in ruby/ruby#13555. If `instance_variables_to_inspect` is defined, then `pretty_print_instance_variables` will use it. Additionally, this commit introduces tests for both `pretty_print_instance_variables` and `instance_variables_to_inspect`. https://github.com/ruby/pp/commit/9cea466c95
2025-10-02ZJIT: Add `NoSingletonClass` patch point (#14680)Stan Lo
* ZJIT: Add NoSingletonClass patch point This patch point makes sure that when the object has a singleton class, the JIT code is invalidated. As of now, this is only needed for C call optimization. In YJIT, the singleton class guard only applies to Array, Hash, and String. But in ZJIT, we may optimize C calls from gems (e.g. `sqlite3`). So the patch point needs to be applied to a broader range of classes. * ZJIT: Only generate NoSingletonClass guard when the type can have singleton class * ZJIT: Update or forget NoSingletonClass patch point when needed
2025-10-02load.c: Fix dest and src of MEMMOVEYusuke Endoh
When multiple files with the same name are required, the features_index hash stores the indexes in `$LOADED_FEATURES` array into a darray. The dest and src arguments for `MEMMOVE` were wrongly reversed when inserting a new index in the darray. [Bug #21568]
2025-10-01[ruby/ipaddr] Remove warning by asserting its presenceÉtienne Barrié
$ rake test >/dev/null /tmp/test/test_ipaddr.rb:202: warning: IPAddr#ipv4_compat is obsolete https://github.com/ruby/ipaddr/commit/31d62407c2
2025-09-30ZJIT: Re-apply attr_writer inlining (#14678)Max Bernstein
This re-applies https://github.com/ruby/ruby/pull/14629 / 40bb47665d3ff57e0f2eb5a9fd9e0109617015c9 by reverting https://github.com/ruby/ruby/pull/14673 / d4393772b89dab4f33c118a284d92dc80cd63c39. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2025-09-30[ruby/openssl] pkey/dh: refactor testsKazuki Yamaguchi
- Generate smaller parameters in test_new_generate. Generating 2048-bit parameters is slow and sometimes takes a few minutes on GitHub-hosted CI runners. Also test the DH.generate alias, not just DH.new. - Simplify test_new_break to just check exceptions raised in the block because it is redundant. - Remove unnecessary OpenSSL::PKey::DH#public_key calls. - Update bare "assert" with more appropriate methods. https://github.com/ruby/openssl/commit/8bc7442310
2025-09-30[ruby/openssl] pkey: disallow {DH,DSA,EC,RSA}.new without arguments with ↵Kazuki Yamaguchi
OpenSSL 3.0 Raise ArgumentError if this is attempted when the extension is compiled with OpenSSL 3.0 or later. The form will be fully removed when we drop support for OpenSSL 1.1.1. When OpenSSL::PKey::{DH,DSA,EC,RSA}.new is called without any arguments, it sets up an empty corresponding low-level struct and wraps it in an EVP_PKEY. This is useful when the user later fills the missing fields using low-level setter methods such as OpenSSL::PKey::RSA#set_key. Such setter methods are not compatible with OpenSSL 3.0 or later, where EVP_PKEY is immutable once created. This means that the ability to create an empty instance is useless. https://github.com/ruby/openssl/commit/affd569f78
2025-09-30ZJIT: Revert SetIvar specialization (#14673)Max Bernstein
CI passed on SetIvar but broke some larger Ruby tests. Needs further investigation and testing. * Revert "ZJIT: Fix rebase issue with tests" This reverts commit 37248c51233d827ca56471661175c56e31c3b14f. * Revert "ZJIT: Inline attr_accessor/attr_writer to SetIvar (#14629)" This reverts commit 40bb47665d3ff57e0f2eb5a9fd9e0109617015c9.
2025-09-29ZJIT: Inline attr_accessor/attr_writer to SetIvar (#14629)Max Bernstein
2025-09-26[ruby/ipaddr] Fix `#ipv4_compat` returning invalid prefixTaketo Takashima
https://github.com/ruby/ipaddr/commit/7c85bb8dfd Co-authored-by: Tietew <tietew@gmail.com>
2025-09-25ZJIT: Compile ISEQ with optional arguments (#14653)Takashi Kokubun
2025-09-25Properly unlock locked mutexes on thread cleanup.Luke Gruber
Mutexes were being improperly unlocked on thread cleanup. This bug was introduced in 050a8954395. We must keep a reference from the mutex to the thread, because if the fiber is collected before the mutex is, then we cannot unlink it from the thread in `mutex_free`. If it's not unlinked from the the thread when it's freed, it causes bugs in `rb_thread_unlock_all_locking_mutexes`. We now mark the fiber when a mutex is locked, and the thread is marked as well. However, a fiber can still be freed in the same GC cycle as the mutex, so the reference to the thread is still needed. The reason we need to mark the fiber is that `mutex_owned_p()` has an ABA issue where if the fiber is collected while it's locked, a new fiber could be allocated at the same memory address and we could get false positives. Fixes [Bug #21342] Co-authored-by: John Hawthorn <john@hawthorn.email>
2025-09-24ZJIT: Incorporate bb0-prologue and PC check into HIR (#14643)Takashi Kokubun
* ZJIT: Incorporate bb0-prologue and PC check into HIR * Fix an outdated comment * Use shallow clone for LoadPC and EntryPoint * Reproduce the actual HIR graph to pass validation * Fill out param types for jit_entry_block * Add Type::from_cptr * Add a TODO comment about Const::CPtr printing
2025-09-24Ractor.shareable_procKoichi Sasada
call-seq: Ractor.sharable_proc(self: nil){} -> sharable proc It returns shareable Proc object. The Proc object is shareable and the self in a block will be replaced with the value passed via `self:` keyword. In a shareable Proc, the outer variables should * (1) refer shareable objects * (2) be not be overwritten ```ruby a = 42 Ractor.shareable_proc{ p a } #=> OK b = 43 Ractor.shareable_proc{ p b; b = 44 } #=> Ractor::IsolationError because 'b' is reassigned in the block. c = 44 Ractor.shareable_proc{ p c } #=> Ractor::IsolationError because 'c' will be reassigned outside of the block. c = 45 d = 45 d = 46 if cond Ractor.shareable_proc{ p d } #=> Ractor::IsolationError because 'd' was reassigned outside of the block. ``` The last `d`'s case can be relaxed in a future version. The above check will be done in a static analysis at compile time, so the reflection feature such as `Binding#local_varaible_set` can not be detected. ```ruby e = 42 shpr = Ractor.shareable_proc{ p e } #=> OK binding.local_variable_set(:e, 43) shpr.call #=> 42 (returns captured timing value) ``` Ractor.sharaeble_lambda is also introduced. [Feature #21550] [Feature #21557]
2025-09-23gc_validate_pc(): Exclude imemos, add a test and explain the assertsAlan Wu
The validation is relevant only for traceable userland ruby objects ruby code could interact with. ZJIT's use of rb_vm_method_cfunc_is() allocates a CC imemo and was failing this validation when it was actually fine. Relax the check.
2025-09-22ZJIT: Guard receiver class for CCallVariadic (#14630)Takashi Kokubun
2025-09-22ZJIT: Refactor NewRangeFixnum (#14607)André Luiz Tiago Soares
## Context #14409 https://github.com/ruby/ruby/pull/14409#discussion_r2350238583 >You may have noticed that this doesn't produce a New range instruction. For that you probably need to use a local variable (makes it harder for the bytecode compiler to reason about, but the JIT sees through it). If you have time, please rewrite these tests. https://github.com/ruby/ruby/pull/14409#discussion_r2350240389 >There's some code above to do this for you: see arguments_likely_fixnums and coerce something or other ## Changes ### Refactor tests Modify tests force the usage of `NewRangeFixnum` instruction and make tests names more consistent. ### Refactor optimize ranges Didn't found `arguments_likely_fixnums` to be applicable unless we enable profiling for `NewRange` and change the criteria of when the optimization fires. But there were other ways to clean up the code. Simplify the logic and move it to `type_specialize`. Deleted the standalone `optimize_ranges` function.
2025-09-21Exclude failing GC finalizer tests with ASANBenoit Daloze
* See https://bugs.ruby-lang.org/issues/21613
2025-09-19ZJIT: Fix opt_{hash,ary,str}_{freeze,uminus}Max Bernstein
The stack layout is incompatible with the way we reify the stack for generating fallback SendWithoutBlock: the receiver is an embedded VALUE in the bytecode, not on the stack. Since we don't expect these to be overridden often, instead of fussing about with the stack layout, just hope for the best and PatchPoint/SideExit. Fix https://github.com/Shopify/ruby/issues/760
2025-09-19[ruby/prism] Fix up locals test skip nameKevin Newton
https://github.com/ruby/prism/commit/d1b22f59a0
2025-09-19[ruby/prism] Turn off failing test for parse.yKevin Newton
https://github.com/ruby/prism/commit/cb27f5a70a
2025-09-19[ruby/prism] Reject argument command call taking a block with more trailing ↵Earlopain
arguments https://bugs.ruby-lang.org/issues/21168#note-5 The added code samples align with `parse.y`, except for `foo(bar baz do end)` which `parse.y` currently rejects but shouldn't. https://github.com/ruby/prism/commit/3a4e102d80
2025-09-19`JSON::Coder` callback now recieve a second argument to mark object keysJean Boussier
e.g. ```ruby { 1 => 2 } ``` The callback will be invoked for `1` as while it has a native JSON equivalent, it's not legal as an object name.
2025-09-19[ruby/json] Avoid scientific notation before exponent 15Jean Boussier
Fix: https://github.com/ruby/json/issues/861 It's not incorrect to use scientific notation, but it tend to throw people off a bit, so it's best to keep it for very large numbers. https://github.com/ruby/json/commit/1566cd01a6
2025-09-19[ruby/json] fix issue reading off the end of the ByteBuffer if ptr > 0Scott Myron
Fix: https://github.com/ruby/json/issues/859 https://github.com/ruby/json/commit/67ebabec75 Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
2025-09-19[ruby/json] Only enable test coverage when running the test suite standaloneJean Boussier
https://github.com/ruby/json/commit/08b9eb0ee6
2025-09-19[ruby/json] Add branch test coverage when available. Force track all files ↵Robin Miller
to prevent implicit file discovery missing files. https://github.com/ruby/json/commit/6bded942c4
2025-09-19[ruby/json] parser: Reject invalid surogate pairs more consistently.Jean Boussier
https://github.com/ruby/json/commit/5855f4f603
2025-09-18ZJIT: Compile sendforward with dynamic dispatch (#14501)Takashi Kokubun
* ZJIT: Compile sendforward with dynamic dispatch * Reload locals only if it has blockiseq * Add a test case of ... with other args
2025-09-18Prevent GC from running during `newobj_of` for internal_event_newobj.Luke Gruber
If another ractor is calling for GC, we need to prevent the current one from joining the barrier. Otherwise, our half-built object will be marked. The repro script was: test.rb: ```ruby require "objspace" 1000.times do ObjectSpace.trace_object_allocations do r = Ractor.new do _obj = 'a' * 1024 end r.join end end ``` $ untilfail lldb -b ./exe/ruby -o "target create ./exe/ruby" -o "run test.rb" -o continue It would fail at `ractor_port_mark`, rp->r was a garbage value. Credit to John for finding the solution. Co-authored-by: John Hawthorn <john.hawthorn@shopify.com>
2025-09-18ZJIT: Support variadic C calls (#14575)Stan Lo
* ZJIT: Support variadic C calls This reduces the `dynamic_send_count` in `liquid-render` by ~21% * ZJIT: Reuse gen_push_frame * ZJIT: Avoid optimizing variadic C call when tracing is enabled
2025-09-18Remove test causing warningÉtienne Barrié
The test is no longer useful since 5c7dfe85a1dc49334e2828791f0ade42eee662db because Module#initialize_copy is empty/not defined anymore.
2025-09-17ZJIT: Prevent custom allocator in ObjectAllocClassMax Bernstein