summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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
2025-09-17ZJIT: Const-fold IsMethodCfuncMax Bernstein
2025-09-17Unset RUBY_CRASH_REPORT in tests that crash on purposeAlan Wu
2025-09-17[ruby/prism] Reject `1 if foo = bar baz`Earlopain
and also `1 and foo = bar baz` This is a partial fix for https://github.com/ruby/prism/issues/3106 It still accepts `a = b c and 1` https://github.com/ruby/prism/commit/7a13d3535b
2025-09-17Skip TestObjSpaceRactor#test_tracing_does_not_crashPeter Zhu
It crashes frequently on CI but I am not able to reproduce locally: https://ci.rvm.jp/results/trunk-random1@ruby-sp2-noble-docker/5954509 https://ci.rvm.jp/results/trunk-random0@ruby-sp2-noble-docker/5954501
2025-09-17[ruby/openssl] Fix test_ssl.rb in FIPS.Jun Aruga
test_post_connect_check_with_anon_ciphers: test_tmp_dh_callback: test_tmp_dh: DH missing the q value on unknown named parameters (ciphers) is not FIPS-approved, according to the FIPS-186-4 APPENDIX B: Key Pair Generation - B.1.1 Key Pair Generation Using Extra Random Bits, the inputs p, q, and g are required. However, TLS doesn't send q. https://csrc.nist.gov/pubs/fips/186-4/final OpenSSL has a special workaround to recover the missing "q" value for known named parameters, which is the reason why other tests that use the default parameters in `lib/openssl/ssl.rb` are working. Note that the test_post_connect_check_with_anon_ciphers test got the following error on `OpenSSL.debug = true` in FIPS. ``` /home/jaruga/var/git/ruby/openssl/lib/openssl/ssl.rb:551: warning: error on stack: error:0A0C0103:SSL routines:tls_construct_server_key_exchange:internal error ``` test_get_ephemeral_key: kRSA (PKCS1-v1_5 padding) is not allowed in FIPS according to the NIST SP 800-131A Rev. 2 - 6 Key Agreement and Key Transport Using RSA - Table 5: Approval Status for the RSA-based Key Agreement and Key Transport Schemes - PKCS1-v1_5 padding - Disallowed after 2023 https://csrc.nist.gov/pubs/sp/800/131/a/r2/final Note that the test_get_ephemeral_key test got the following error on `OpenSSL.debug = true` in FIPS. ``` test/openssl/test_ssl.rb:2326: warning: error on stack: error:1C8000A8:Provider routines:rsa_encrypt:invalid padding mode ``` https://github.com/ruby/openssl/commit/ac3559e51e
2025-09-17[ruby/openssl] Add AuthTagError exception for AEAD authenticationSamuel Williams
failures (https://github.com/ruby/openssl/pull/939) * Add AuthTagError exception for AEAD authentication failures - Add OpenSSL::Cipher::AuthTagError as a subclass of CipherError - Raise AuthTagError specifically for AEAD cipher authentication tag verification failures - Enhanced error messages: 'AEAD authentication tag verification failed' for auth failures - Precise detection: Only EVP_CipherFinal_ex failures in AEAD ciphers raise AuthTagError - All other errors (key setup, IV setup, update failures, etc.) still raise CipherError - Comprehensive test coverage for GCM/CCM modes and error inheritance - Fully backwards compatible: AuthTagError < CipherError https://github.com/ruby/openssl/commit/9663b09040
2025-09-17[ruby/openssl] Revert "pkey: stop retrying after non-retryable error from ↵Kazuki Yamaguchi
OSSL_DECODER" This reverts commit https://github.com/ruby/openssl/commit/5347880c6eb0 and https://github.com/ruby/openssl/commit/985ba27d6339. These commits attempted to stop processing after the first relevant PEM block, whether it is successful or not, when the input contains multiple keys. It turned out that it cannot be reliably determined using the OSSL_DECODER API. There is an edge case where OSSL_DECODER_from_bio() reports "unsupported" even though the input actually contains an error: https://redirect.github.com/ruby/openssl/pull/931#discussion_r2347813807 Revert the changes for now and keep the existing behavior, as partial support does not seem worth the added complexity. https://github.com/ruby/openssl/commit/319cd4952a
2025-09-17Revert "Handle `uninitialized constant JSON::GenericObject` at ruby/ruby."Hiroshi SHIBATA
This reverts commit 0dc1cd407e7775610f2bcaef6c1282369867f91c. 1213adfe5526d65cce81a9fb127074130c8faea7 is fixed this issue.
2025-09-16[ruby/json] Better handle missing ostructÉtienne Barrié
In the Ruby test suite, this test class is causing trouble because ostruct is not available. Having an autoload for JSON::GenericObject but causing it not to define the constant causes a warning. See https://github.com/ruby/json/commit/0dc1cd407e77 and https://github.com/ruby/json/commit/caa5d8cdd748 in ruby. We can skip defining the test class entirely instead when ostruct is not available. https://github.com/ruby/json/commit/6f6a4cdfd7
2025-09-15ZJIT: Revert VM_CALL_ARGS_SPLAT and VM_CALL_KWARG support (#14565)Takashi Kokubun
2025-09-15ZJIT: Support compiling block args (#14537)Takashi Kokubun
2025-09-15[ruby/prism] Fix character literal forced encodingKevin Newton
If a character literal was followed by a string concatenation, then the forced encoding of the string concatenation could accidentally overwrite the explicit encoding of the character literal. We now handle this properly. https://github.com/ruby/prism/commit/125c375d74
2025-09-15Share `TestObject::ToStrCounter` classNobuyoshi Nakada
2025-09-13[ruby/prism] Revert "Merge pull request #3606 from tenderlove/clear-flags"Takashi Kokubun
This reverts commit https://github.com/ruby/prism/commit/4052d93cf852, reversing changes made to https://github.com/ruby/prism/commit/47143d17b3f7. https://github.com/ruby/prism/commit/f117ec6354
2025-09-13Fill in lead num for blocks with `it`Kevin Newton
Fixes [Bug #21256] Co-Authored-By: Earlopain <14981592+Earlopain@users.noreply.github.com>
2025-09-13Exclude `JSON::GenericObject` testNobuyoshi Nakada
It depends on ostruct gem that is no longer a part of the default gems, and the all tests are just skipped with a warning.
2025-09-13Remove excludesNobuyoshi Nakada
2025-09-13[Feature #20925] Support leading logical operatorsNobuyoshi Nakada
2025-09-13[Bug #17398] Allow `private def hello = puts "Hello"`yui-knk
2025-09-12Exclude leading logical tests for parseyStan Lo
Prism implemented https://bugs.ruby-lang.org/issues/20925 but parse.y doesn't seem to support it yet and is failing related Prism tests on CI. This adds excludes for the tests that are failing.
2025-09-12Update test syntax to handle command call endless methodsKevin Newton
2025-09-12[ruby/prism] [Bug #17398] Allow `private def hello = puts "Hello"`Earlopain
This was a limitation of parse.y that prism intentionally replicated. https://github.com/ruby/prism/commit/8fd12d594c
2025-09-12[ruby/prism] Support leading logical operatorsKevin Newton
https://github.com/ruby/prism/commit/3f58fa7705
2025-09-12Restore test example for argument forwardingÉtienne Barrié
Since cb419e3912f0514b8151469b0a4a4b83cbbcce78 we're no longer testing this case because foo is redefined on obj1.
2025-09-12[ruby/openssl] pkey: stop retrying after non-retryable error from OSSL_DECODERKazuki Yamaguchi
Continue processing only when OSSL_DECODER_from_bio() returns the error code ERR_R_UNSUPPORTED. Otherwise, raise an exception without retrying decoding the input in another format. This fixes another case where OpenSSL::PKey.read prompts for a passphrase multiple times when the input contains multiple passphrase-protected PEM blocks and the first one cannot be decoded. I am not entirely sure if the error code ERR_R_UNSUPPORTED is considered part of the public interface of OpenSSL, but this seems to be the only option available and is the approach used internally by the PEM_read_bio_*() functions. Fixes https://github.com/ruby/openssl/issues/927 https://github.com/ruby/openssl/commit/985ba27d63
2025-09-12[ruby/openssl] pkey: pass pem_password_cb to OSSL_DECODER only when it is neededKazuki Yamaguchi
Specify OSSL_DECODER_CTX_set_pem_password_cb() only when we expect a passphrase-protected private key. OSSL_DECODER appears to try to decrypt every PEM block in the input even when the PEM header does not match the requested selection. This can cause repeated prompts for a passphrase in a single OpenSSL::PKey.read call. https://github.com/ruby/openssl/commit/933503f49f
2025-09-12[ruby/openssl] pkey: add more tests for OpenSSL::PKey.readKazuki Yamaguchi
Add tests covering edge cases in the current behavior to prevent accidental regressions. The next patches will update the OpenSSL 3.x path. https://github.com/ruby/openssl/commit/468f8ceea2
2025-09-12Remove unused variable warningÉtienne Barrié
2025-09-12Suppress warnings when testing RubyVM::AbstractSyntaxTreeÉtienne Barrié
2025-09-12Remove block may be ignored warnings from ↵Étienne Barrié
TestRubyOptimization#test_block_given_aset_aref