summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
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-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-15Share `TestObject::ToStrCounter` classNobuyoshi Nakada
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-13[Feature #20925] Support leading logical operatorsNobuyoshi Nakada
2025-09-12Update test syntax to handle command call endless methodsKevin Newton
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-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
2025-09-12Remove redefined method warnings from TestRubyOptimization#test_opt_newÉtienne Barrié
2025-09-11ZJIT: Check for VM stack overflowAlan Wu
Previously, the included test crashed or turned into an infinite loop due to the missing check.
2025-09-10Fix tempfile leaking in TestRequirePeter Zhu
The test introduced in 928fea3 is leaking files because the Tempfile is not cleaned when the process exits. We see this in the output: Children under /var/folders/51/_yzlsvf96v9729jtj8_mcp7w0000gn/T/rubytest.7lbdlp: * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-g4op87.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-pu621v.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-4xv688.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-1rvp4b.rb
2025-09-10ZJIT: Support `invokeblock` insn (#14496)Stan Lo
ZJIT: Support invokeblock insn Basically like other send-ish insns, except that it doesn't pop the receiver.
2025-09-10ZJIT: Compile ISEQs with forwardable parameters (#14491)Takashi Kokubun
2025-09-10Fix crash when $LOADED_FEATURES is modified during requirePeter Zhu
[Bug #21567] When we require an object that is not a string, it will attempt to convert it to a string by calling to_str on it. If we modify the $LOADED_FEATURES array while it calls to_str, Ruby can crash because it can end up inserting the string in the wrong index in the array. For example, the following script crashes: require "tempfile" class MyString def initialize(path) @path = path end def to_str $LOADED_FEATURES.clear @path end def to_path = @path end def create_ruby_file = Tempfile.create(["test", ".rb"]).path require MyString.new(create_ruby_file) $LOADED_FEATURES.unshift(create_ruby_file) $LOADED_FEATURES << MyString.new(create_ruby_file) require create_ruby_file Crash log: test.rb:21: [BUG] Segmentation fault at 0x0000000000000004 ruby 3.5.0dev (2025-09-09T09:29:35Z master ce94add7fb) +PRISM [arm64-darwin24] -- Crash Report log information -------------------------------------------- See Crash Report log file in one of the following locations: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0003 p:---- s:0011 e:000010 CFUNC :require c:0002 p:0076 s:0006 e:000005 EVAL test.rb:21 [FINISH] c:0001 p:0000 s:0003 E:0001b0 DUMMY [FINISH] -- Ruby level backtrace information ---------------------------------------- test.rb:21:in '<main>' test.rb:21:in 'require' -- Threading information --------------------------------------------------- Total ractor count: 1 Ruby thread count for this ractor: 1 -- Machine register context ------------------------------------------------ x0: 0x0000000000000004 x1: 0x000000000000c800 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000205 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000001 x18: 0x0000000000000000 x19: 0x0000000209dfc0b0 x20: 0x0000000209dfc018 x21: 0x000000016ee8ab58 x22: 0x0fffffff0009d71d x23: 0x0000000209dfc018 x24: 0x0000000209dfc150 x25: 0x000000016ee8acc0 x26: 0x0000000000000000 x27: 0x0000000000000000 x28: 0x0000000000000000 lr: 0x0000000101244140 fp: 0x000000016ee887f0 sp: 0x000000016ee887d0 -- C level backtrace information ------------------------------------------- miniruby(rb_print_backtrace+0x24) [0x101317b08] vm_dump.c:843 miniruby(rb_print_backtrace) (null):0 miniruby(rb_vm_bugreport+0x26c) [0x101317d94] vm_dump.c:1175 miniruby(rb_bug_for_fatal_signal+0xa4) [0x10105ddac] error.c:1130 miniruby(sig_do_nothing+0x0) [0x1012278c0] signal.c:948 miniruby(sigsegv) (null):0 /usr/lib/system/libsystem_platform.dylib(_sigtramp+0x38) [0x19c1216a4] miniruby(rb_str_new_frozen+0x1c) [0x101244140] string.c:1495 miniruby(rb_check_realpath_internal+0x68) [0x101077804] file.c:4679 miniruby(rb_check_realpath+0x2c) [0x101077aa4] file.c:4765 miniruby(get_loaded_features_index+0x37c) [0x1010f9c94] load.c:467 miniruby(rb_feature_p+0xd0) [0x1010f8174] load.c:582 miniruby(search_required+0xac) [0x1010f6ad4] load.c:1193 miniruby(require_internal+0x274) [0x1010f7518] load.c:1424 miniruby(rb_require_string_internal+0x94) [0x1010f6830] load.c:1571 miniruby(rb_require_string+0x58) [0x1010f66e8] load.c:1557 miniruby(rb_f_require+0x1c) [0x1010f6684] load.c:1150 miniruby(ractor_safe_call_cfunc_1+0x38) [0x101306c28] vm_insnhelper.c:3696 miniruby(vm_call_cfunc_with_frame_+0x250) [0x1012f857c] vm_insnhelper.c:3873 miniruby(vm_call_cfunc_with_frame+0x6c) [0x1012f8834] vm_insnhelper.c:3919 miniruby(vm_sendish+0x1a8) [0x1012c990c] vm_insnhelper.c:6087 miniruby(vm_exec_core+0x4050) [0x1012cfb48] insns.def:900 miniruby(vm_exec_loop+0x80) [0x1012e5448] vm.c:2666 miniruby(rb_vm_exec+0x134) [0x1012c9b40] vm.c:2645 miniruby(rb_iseq_eval_main+0x34) [0x1012e5628] vm.c:2919 miniruby(rb_ec_exec_node+0xe4) [0x10106d094] eval.c:282 miniruby(ruby_run_node+0x94) [0x10106cf64] eval.c:320 miniruby(rb_main+0x40) [0x100f7499c] main.c:42 miniruby(main+0x60) [0x100f74928] main.c:62
2025-09-09ZJIT: Remove unneeded omission for optional param test (#14488)Stan Lo
2025-09-09ZJIT: Implement getblockparamproxy (#14483)Takashi Kokubun
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2025-09-09ZJIT: Optimize `ObjToString` with type guards (#14469)André Luiz Tiago Soares
* failing test for ObjToString optimization with GuardType * profile ObjToString receiver and rewrite with guard * adjust integration tests for objtostring type guard optimization * Implement new GuardTypeNot HIR; objtostring sends to_s directly on profiled nonstrings * codegen for GuardTypeNot * typo fixes * better name for tests; fix side exit reason for GuardTypeNot * revert accidental change * make bindgen * Fix is_string to identify subclasses of String; fix codegen for identifying if val is String
2025-09-08ZJIT: Add RubyVM::ZJIT.reset_stats! method (GH-14479)Randy Stauner
This allows for more precise tracking of stats programmatically which is particularly useful for our nightly benchmarking suite. - Define rust function - Expose to C - Wrap with Ruby API - Add a test
2025-09-08ZJIT: Fix backtraces on opt_new (#14461)Takashi Kokubun
2025-09-08ZJIT: Add --zjit-stats=quiet option to collect stats without printing (#14467)Randy Stauner
Similar to YJIT's --yjit-stats=quiet, this option allows ZJIT to collect statistics and make them available via the Ruby API without printing them at exit. This is useful for programmatic access to stats without the output noise. - Added print_stats field to Options struct - Modified option parsing to support --zjit-stats=quiet - Added rb_zjit_print_stats_p primitive to check if stats should be printed - Updated zjit.rb to only register at_exit handler when print_stats is true - Update the help text shown by `ruby --help` to indicate that --zjit-stats now accepts an optional =quiet parameter. - Added test for --zjit-stats=quiet option
2025-09-08Allow IO#each_codepoint to work with unetc even when encoding conversion activeYO4
Using IO#each_codepoint together with IO#ungetc causes an unwanted exception when encoding conversion is active. C:\>ruby -e "open('NUL', 'rt') { |f| f.ungetc('aa'); f.each_codepoint { |c| p c }}" 97 -e:1:in 'IO#each_codepoint': byte oriented read for character buffered IO (IOError) from -e:1:in 'block in <main>' from -e:1:in 'Kernel#open' from -e:1:in '<main>' Fixes [Bug #21131]
2025-09-07Make invalid & operator type error message consistent with */**Jeremy Evans
If #to_proc is defined, this uses the following error message format, matching the error message format used for * when to_a returns non-Array and for ** when to_hash returns non-Hash: ``` can't convert ClassName to Proc (ClassName#to_proc gives OtherClassName) ``` If #to_proc is not defined, this uses the following error message format, matching the error message format used when ** is called on a non-Hash not implementing to_hash. ``` no implicit conversion of ClassName into Proc ``` There isn't a similar error for * when called on a non-Array not implementing to_a, as Ruby does not raise for that case. Fixes [Bug #21563]
2025-09-06Increase the rehearsal countNobuyoshi Nakada
2025-09-05ZJIT: Fix tests for ZJIT (#14460)Takashi Kokubun
2025-09-05ZJIT: Stop optimizing toplevel locals (#14458)Takashi Kokubun
2025-09-05ZJIT: Invalidate local variables on EP escape (#14448)Takashi Kokubun
2025-09-04ZJIT: Compile invokesuper with dynamic dispatch (#14444)Takashi Kokubun
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
2025-09-04ZJIT: Add patchpoint for TracePoint (#14420)Stan Lo
ZJIT: Add patchpoint for TracePoint activation Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2025-09-04ZJIT: Support compiling ISEQs for opt_pc = 0 (#14441)Takashi Kokubun
* ZJIT: Support compiling ISEQs for opt_pc = 0 * Test send with optional arguments
2025-09-03Revert "test_gc.rb: Attempt to stabilize test_interrupt_in_finalizer"Takashi Kokubun
This reverts commit c1c0b32445c66e343c136faa28d7a0f0f46d96a2. This test is clearly not reliable: https://github.com/ruby/ruby/actions/runs/17446920961/job/49543543423 I want to skip this unstable test on GitHub Actions to make sure this test doesn't prevent PRs from getting merged. We can continue to monitor the state of this test on RubyCI and ci.rvm.jp.
2025-09-03ZJIT: Handle `opt_case_dispatch` insn (#14433)Stan Lo
ZJIT: Handle opt_case_dispatch insn
2025-09-02test_gc.rb: Attempt to stabilize test_interrupt_in_finalizerTakashi Kokubun
This fails way too often across many environments. I don't think this test is healthy. https://github.com/ruby/ruby/actions/runs/17343611722/job/49240735401 Before we give up on it, let me see if this helps.
2025-09-02test_settracefunc.rb: Increase a timeoutTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17413734881/job/49436975287
2025-09-02ZJIT: Clear jit entry from iseqs after TracePoint activation (#14407)Stan Lo
ZJIT: Remove JITed code after TracePoint is enabled
2025-09-02ZJIT: NewRangeFixnum instruction (#14409)André Luiz Tiago Soares
* Failing optimization tests for NewRangeFixnum * NewRangeFixnum general idea * Use gen_prepare_call_with_gc on gen_new_range_fixnum; add additional hir tests * Remove unused NewRange rewrite trigger when neither range is Fixnum literal * Remove misleading 'profiled' name in range optimization tests * Adjustments as per review comments * Include new_range_fixnum tests * remove non-ASCII character from comments as per PR review * remove non-ASCII character from comments as per PR review
2025-09-02test_thread_cv.rb: Increase a timeout for a thread testTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17410747983/job/49427074277
2025-09-02test_transcode.rb: Increase a timeout for Ractor testsTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17408924679/job/49420774667
2025-08-30Initialize class dup/clone before calling initialize_dup/initialize_cloneJeremy Evans
Previously, you could override the class initialize_dup/initialize_clone method and the class hierarchy would not be set correctly inside the method before calling super. This removes Module#initialize_copy, and instead makes Object#dup/clone call the underlying C function (rb_mod_init_copy) before calling the appropriate initialize_dup/initialize_clone method. This results in the following fixes: * The appropriate initialize_dup method is called (dup on a class will respect superclass initialize_dup). * Inside class initialize_dup/initialize_clone/initialize_copy, class ancestor hierarchy is correct. * Calling singleton_class inside initialize_dup no longer raises a TypeError later in dup. * Calling singleton_class.ancestors inside initialize_dup no longer results in missing ancestors. Fixes [Bug #21538]
2025-08-30Add NODE SCLASS locationsS-H-GAMELINKS
Add locations to struct `RNode_SCLASS`. memo: ``` @ ProgramNode (location: (1,0)-(1,18)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,18)) +-- body: (length: 1) +-- @ SingletonClassNode (location: (1,0)-(1,18)) +-- locals: [] +-- class_keyword_loc: (1,0)-(1,5) = "class" +-- operator_loc: (1,6)-(1,8) = "<<" +-- expression: | @ SelfNode (location: (1,9)-(1,13)) +-- body: nil +-- end_keyword_loc: (1,15)-(1,18) = "end" ```
2025-08-29ZJIT: Specialize monomorphic GetIvar (#14388)Max Bernstein
Specialize monomorphic `GetIvar` into: * `GuardType(HeapObject)` * `GuardShape` * `LoadIvarEmbedded` or `LoadIvarExtended` This requires profiling self for `getinstancevariable` (it's not on the operand stack). This also optimizes `GetIvar`s that happen as a result of inlining `attr_reader` and `attr_accessor`. Also move some (newly) shared JIT helpers into jit.c.
2025-08-29ZJIT: Remove special case for defined?(method call) (#14401)Max Bernstein
This was fixed in https://github.com/ruby/ruby/pull/14308 Thanks, Stan, for noticing. Fixes https://github.com/Shopify/ruby/issues/703
2025-08-29`Module#attr` family accepts strings as well as symbolsNobuyoshi Nakada
2025-08-29Relax thresholds for array, object, and string compaction verificationHiroshi SHIBATA
These tests failed with RHEL10 https://rubyci.s3.amazonaws.com/rhel10/ruby-master/log/20250828T093003Z.fail.html.gz
2025-08-28ZJIT: Add missing rb_zjit_cme_invalidateTakashi Kokubun
2025-08-28ZJIT: Compile Insn::SendTakashi Kokubun