summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Test: `defined?(super)` in `BasicObject` returns `nil`Gary Tou2023-04-261-0/+14
| | | | Ensure it returns `nil` instead of segmentation faulting
* [ruby/irb] Fix Locale's encoding lookup for Japanese encodingsStan Lo2023-04-261-2/+2
| | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/568) In https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d, `encoding_aliases.rb` was introduced to return the correct encoding object for `ujis` and `euc` encodings. However, the return value of `@@legacy_encoding_alias_map[@encoding_name]` is always overridden by a second look up with `Encoding.find(@encoding_name)`. So the logic didn't work as expected. This commit fixes the problem.
* Revert "Temporary skipped failing assertions"Hiroshi SHIBATA2023-04-261-2/+2
| | | | This reverts commit e7cdce83e8c8797c481ccb54c260c0db1e1afa7c.
* [ruby/pp] Remove patch added for Ruby 2.6/JRuby 9.3Stan Lo2023-04-251-9/+0
| | | | https://github.com/ruby/pp/commit/09dae96129
* [ruby/pp] Skip certain tests for JRubyStan Lo2023-04-251-1/+3
| | | | https://github.com/ruby/pp/commit/f7bde31ca9
* Speed up calling iseq bmethodsJeremy Evans2023-04-251-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, bmethod arguments are copied from the VM stack to the C stack in vm_call_bmethod, then copied from the C stack to the VM stack later in invoke_iseq_block_from_c. This is inefficient. This adds vm_call_iseq_bmethod and vm_call_noniseq_bmethod. vm_call_iseq_bmethod is an optimized method that skips stack copies (though there is one copy to remove the receiver from the stack), and avoids calling vm_call_bmethod_body, rb_vm_invoke_bmethod, invoke_block_from_c_proc, invoke_iseq_block_from_c, and vm_yield_setup_args. Th vm_call_iseq_bmethod argument handling is similar to the way normal iseq methods are called, and allows for similar performance optimizations when using splats or keywords. However, even in the no argument case it's still significantly faster. A benchmark is added for bmethod calling. In my environment, it improves bmethod calling performance by 38-59% for simple bmethod calls, and up to 180% for bmethod calls passing literal keywords on both sides. ``` ./miniruby-iseq-bmethod: 18159792.6 i/s ./miniruby-m: 13174419.1 i/s - 1.38x slower bmethod_simple_1 ./miniruby-iseq-bmethod: 15890745.4 i/s ./miniruby-m: 10008972.7 i/s - 1.59x slower bmethod_simple_0_splat ./miniruby-iseq-bmethod: 13142804.3 i/s ./miniruby-m: 11168595.2 i/s - 1.18x slower bmethod_simple_1_splat ./miniruby-iseq-bmethod: 12375791.0 i/s ./miniruby-m: 8491140.1 i/s - 1.46x slower bmethod_no_splat ./miniruby-iseq-bmethod: 10151258.8 i/s ./miniruby-m: 8716664.1 i/s - 1.16x slower bmethod_0_splat ./miniruby-iseq-bmethod: 8138802.5 i/s ./miniruby-m: 7515600.2 i/s - 1.08x slower bmethod_1_splat ./miniruby-iseq-bmethod: 8028372.7 i/s ./miniruby-m: 5947658.6 i/s - 1.35x slower bmethod_10_splat ./miniruby-iseq-bmethod: 6953514.1 i/s ./miniruby-m: 4840132.9 i/s - 1.44x slower bmethod_100_splat ./miniruby-iseq-bmethod: 5287288.4 i/s ./miniruby-m: 2243218.4 i/s - 2.36x slower bmethod_kw ./miniruby-iseq-bmethod: 8931358.2 i/s ./miniruby-m: 3185818.6 i/s - 2.80x slower bmethod_no_kw ./miniruby-iseq-bmethod: 12281287.4 i/s ./miniruby-m: 10041727.9 i/s - 1.22x slower bmethod_kw_splat ./miniruby-iseq-bmethod: 5618956.8 i/s ./miniruby-m: 3657549.5 i/s - 1.54x slower ```
* Generalize cfunc large array splat fix to fix many additional cases raising ↵Jeremy Evans2023-04-251-1/+882
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SystemStackError Originally, when 2e7bceb34ea858649e1f975a934ce1894d1f06a6 fixed cfuncs to no longer use the VM stack for large array splats, it was thought to have fully fixed Bug #4040, since the issue was fixed for methods defined in Ruby (iseqs) back in Ruby 2.2. After additional research, I determined that same issue affects almost all types of method calls, not just iseq and cfunc calls. There were two main types of remaining issues, important cases (where large array splat should work) and pedantic cases (where large array splat raised SystemStackError instead of ArgumentError). Important cases: ```ruby define_method(:a){|*a|} a(*1380888.times) def b(*a); end send(:b, *1380888.times) :b.to_proc.call(self, *1380888.times) def d; yield(*1380888.times) end d(&method(:b)) def self.method_missing(*a); end not_a_method(*1380888.times) ``` Pedantic cases: ```ruby def a; end a(*1380888.times) def b(_); end b(*1380888.times) def c(_=nil); end c(*1380888.times) c = Class.new do attr_accessor :a alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) c = Struct.new(:a) do alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) ``` This patch fixes all usage of CALLER_SETUP_ARG with splatting a large number of arguments, and required similar fixes to use a temporary hidden array in three other cases where the VM would use the VM stack for handling a large number of arguments. However, it is possible there may be additional cases where splatting a large number of arguments still causes a SystemStackError. This has a measurable performance impact, as it requires additional checks for a large number of arguments in many additional cases. This change is fairly invasive, as there were many different VM functions that needed to be modified to support this. To avoid too much API change, I modified struct rb_calling_info to add a heap_argv member for storing the array, so I would not have to thread it through many functions. This struct is always stack allocated, which helps ensure sure GC doesn't collect it early. Because of how invasive the changes are, and how rarely large arrays are actually splatted in Ruby code, the existing test/spec suites are not great at testing for correct behavior. To try to find and fix all issues, I tested this in CI with VM_ARGC_STACK_MAX to -1, ensuring that a temporary array is used for all array splat method calls. This was very helpful in finding breaking cases, especially ones involving flagged keyword hashes. Fixes [Bug #4040] Co-authored-by: Jimmy Miller <jimmy.miller@shopify.com>
* Temporary skipped failing assertionsHiroshi SHIBATA2023-04-251-2/+2
|
* [ruby/irb] Add tests for Locale classStan Lo2023-04-251-0/+83
| | | | | | (https://github.com/ruby/irb/pull/566) https://github.com/ruby/irb/commit/df32e024be
* [rubygems/rubygems] Bump rb-sysdependabot[bot]2023-04-242-5/+5
| | | | | | | | | | | | | | | Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.72 to 0.9.74. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.72...v0.9.74) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
* Allow anonymous memberless StructJeremy Evans2023-04-241-1/+0
| | | | | | | Previously, named memberless Structs were allowed, but anonymous memberless Structs were not. Fixes [Bug #19416]
* [ruby/irb] Simplify the help command's implementationStan Lo2023-04-241-3/+5
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/564) The current method-redefining approach brings little benefit, makes it harder to understand the code, and causes warnings like: > warning: method redefined; discarding old execute This patch simplifies it while displaying more helpful message when rdoc couldn't be loaded.
* [ruby/irb] Filter out top-level methods when using `lsStan Lo2023-04-241-1/+4
| | | | | | | | | <Class/Module>` (https://github.com/ruby/irb/pull/562) Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `<Class/Module>` is specified to be either of those.
* Use UTF-8 encoding for literal extended regexps with UTF-8 characters in ↵Jeremy Evans2023-04-231-0/+7
| | | | | | comments Fixes [Bug #19455]
* YJIT: invokesuper: Remove cme mid matching checkJohn Hawthorn2023-04-201-0/+19
| | | | | | | | | | This check was introduced to match an assertion in the C YJIT when this was originally introduced. I don't believe it's necessary for correctness of the generated code. Co-authored-by: Adam Hess <HParker@github.com> Co-authored-by: Daniel Colson <danieljamescolson@gmail.com> Co-authored-by: Luan Vieira <luanzeba@github.com>
* [rubygems/rubygems] Revert "Bundler::YAMLSerializer.load couldn't raise ↵Hiroshi SHIBATA2023-04-201-0/+15
| | | | | | | | error when invalid yaml was provided" This reverts commit https://github.com/rubygems/rubygems/commit/cfcfde04c783. https://github.com/rubygems/rubygems/commit/ac21ae7083
* Hide Gem::MockGemUi. It's only used by testsHiroshi SHIBATA2023-04-192-1/+87
|
* [rubygems/rubygems] Added tests for load_with_rubygems_config_hash and ↵Hiroshi SHIBATA2023-04-191-0/+28
| | | | | | dump_with_rubygems_yaml https://github.com/rubygems/rubygems/commit/0393f24119
* [rubygems/rubygems] Bundler::YAMLSerializer.load couldn't raise error when ↵Hiroshi SHIBATA2023-04-191-15/+0
| | | | | | invalid yaml was provided https://github.com/rubygems/rubygems/commit/cfcfde04c7
* [rubygems/rubygems] Replaced Gem::ConfigFile.dump_with_rubygems_yaml for ↵Hiroshi SHIBATA2023-04-192-10/+14
| | | | | | saveing configuration https://github.com/rubygems/rubygems/commit/46438e61cd
* [rubygems/rubygems] Introduce self.load_with_rubygems_config_hashHiroshi SHIBATA2023-04-191-3/+1
| | | | https://github.com/rubygems/rubygems/commit/9175b8cf2a
* [rubygems/rubygems] Wrap self.convert_rubygems_config_hash from ↵Hiroshi SHIBATA2023-04-191-1/+3
| | | | | | Bundler::YAMLSerializer.load https://github.com/rubygems/rubygems/commit/080880ac23
* [rubygems/rubygems] Move all changes only in RubyGemsHiroshi SHIBATA2023-04-191-1/+1
| | | | https://github.com/rubygems/rubygems/commit/d842e2092f
* [rubygems/rubygems] Added guard condition for replacing __ variable in YAML keysHiroshi SHIBATA2023-04-191-1/+1
| | | | https://github.com/rubygems/rubygems/commit/e7d31405ea
* [rubygems/rubygems] Replaced load_yaml_file with Bundler::YAMLSerializerHiroshi SHIBATA2023-04-191-5/+2
| | | | https://github.com/rubygems/rubygems/commit/1ed5fc018e
* [rubygems/rubygems] api_key is always contained stringHiroshi SHIBATA2023-04-191-5/+5
| | | | https://github.com/rubygems/rubygems/commit/925f7f6717
* fix `NameError` messageKoichi Sasada2023-04-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following code produces two NameErrors respectively and they are independent, but the second one can show `private constant` message because of first NameError. ```ruby class C class PrivateClass; end private_constant :PrivateClass end begin eval('class C::PrivateClass; end') rescue => e p e end begin Object.const_get 'Foo' rescue => e p e end #<NameError: private constant C::PrivateClass referenced> #<NameError: private constant C::Foo referenced> #=> should be #<NameError: uninitialized constant Foo> ``` It fails the test-all tests with `make test-all TESTS='ruby/class ruby/parse --seed=58891 -v`. The reason is clear miss from https://github.com/ruby/ruby/commit/7387c08373a
* * remove trailing spaces. [ci skip]git2023-04-191-1/+1
|
* Refactor `Regexp#match` cache implementation (#7724)TSUYUSATO Kitsune2023-04-191-3/+11
| | | | | | | | | | * Refactor Regexp#match cache implementation Improved variable and function names Fixed [Bug 19537] (Maybe fixed in https://github.com/ruby/ruby/pull/7694) * Add a comment of the glossary for "match cache" * Skip to reset match cache when no cache point on null check
* MatchData#named_captures: add optional symbolize_names keyword (#6952)Vladimir Dementyev2023-04-191-0/+3
|
* [rubygems/rubygems] Bump rb-sysdependabot[bot]2023-04-172-5/+5
| | | | | | | | | | | | | | | Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.71 to 0.9.72. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.71...v0.9.72) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
* skip if `DidYouMean.formatter=` is not definedKoichi Sasada2023-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ruby/test_default_gems.rb can define empty `DidYouMean` module because of the following line (second require) in the `lib/did_you_mean/did_you_mean.gemspec`: ```ruby begin require_relative "lib/did_you_mean/version" rescue LoadError # Fallback to load version file in ruby core repository require_relative "version" end ``` It defines only `::DidYouMean::VERSION`. However, in the `test/ruby/test_patten_matching.rb` assumes that if `defined?(DidYouMean)` is true, then there is a method `DidYouMean.formatter=` and this assumption fails all tests in `test/ruby/test_patten_matching.rb` if there is only a `::DidYouMean::VERSION`. To reproduce the failures, we need to repeat the following command: `make test-all TESTS='-v ruby/test_default_gems.rb ruby/pattern_matching'` (because the ruby/test_default_gems.rb should be run before the ruby/pattern_matching`) This patch introduces more strict gurds.
* Implement ObjectSpace::WeakMap#delete and ObjectSpace::WeakKeyMap#deleteJean Boussier2023-04-152-4/+33
| | | | | | [Feature #19561] It's useful to be able to remove references from weak maps.
* [ruby/reline] Change Reline.add_dialog_proc(name, nil) to properlytomoya ishida2023-04-151-0/+3
| | | | | | | remove dialog_proc (https://github.com/ruby/reline/pull/532) https://github.com/ruby/reline/commit/43283b2f37
* [Bug #19533] Fix infinite range inclusion with numeric valueNobuyoshi Nakada2023-04-141-0/+2
|
* Emit a performance warning when a class reached max variationsJean Boussier2023-04-132-5/+22
| | | | | | | [Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true`
* [rubygems/rubygems] Extract alias variables for long name classHiroshi SHIBATA2023-04-1312-181/+138
| | | | https://github.com/rubygems/rubygems/commit/33caea928e
* [rubygems/rubygems] Downcase camel like cases of instance variableHiroshi SHIBATA2023-04-1311-80/+80
| | | | https://github.com/rubygems/rubygems/commit/4eaac27107
* [Feature #19590] Show the invalid clock argumentNobuyoshi Nakada2023-04-131-2/+6
| | | | | Include the failed clock argument in the error message from `Process.clock_gettime` and `Process.clock_getres`.
* [Bug #19587] Fix `reset_match_cache` argumentsNobuyoshi Nakada2023-04-121-0/+8
|
* [rubygems/rubygems] Close the server for testNobuyoshi Nakada2023-04-121-0/+6
| | | | https://github.com/rubygems/rubygems/commit/bf5e82fd14
* Ensure api_key is sent if basic auth not provided on webauthn_verification_urlAshley Ellis Pierce2023-04-123-0/+5
| | | | Co-authored-by: Jenny Shen <jenny.shen@shopify.com>
* Add message for otp bypassEric Herscovich2023-04-124-8/+8
| | | | | | Update tests Fix wording of message
* Terminate interaction when rescuing WebauthnVerificationError during ↵Jenny Shen2023-04-124-16/+16
| | | | | | wait_for_otp Co-authored-by: Betty Li <makewithbetty@gmail.com>
* Use Webauthn Listener in wait_for_otpJenny Shen2023-04-121-9/+50
|
* Add wait for webauthn otp when fetching otpJenny Shen2023-04-121-4/+7
| | | | Co-authored-by: Jacques Chester <jacques.chester@shopify.com>
* [rubygems/rubygems] Refactor Webauthn listener response - Makes the response ↵Jenny Shen2023-04-121-82/+59
| | | | | | | | class a wrapper around Net::HTTPResponse - Builds a Net::HTTPResponse upon initialization - to_s returns a string representation of the response to send - Adds a Socket Responder class to send responses given a socket https://github.com/rubygems/rubygems/commit/7513c220b6 Co-authored-by: Jacques Chester <jacques.chester@shopify.com>
* [rubygems/rubygems] Add access control headers for all requests to allow ↵Jenny Shen2023-04-121-0/+9
| | | | | | RubyGems.org to render the response https://github.com/rubygems/rubygems/commit/22b329eb60
* [rubygems/rubygems] Add otp command testsJenny Shen2023-04-123-26/+156
| | | | https://github.com/rubygems/rubygems/commit/c494112063
* [rubygems/rubygems] Add WebauthnListener classJenny Shen2023-04-121-0/+120
| | | | | | | https://github.com/rubygems/rubygems/commit/d42ddbb73c Co-authored-by: Ashley Ellis Pierce <anellis12@gmail.com> Co-authored-by: Jacques Chester <jacques.chester@shopify.com>