summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2024-08-22Suppress warning for fd leakHiroshi SHIBATA
``` Leaked file descriptor: TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback: 15 : #<TCPSocket:fd 15, AF_INET, 127.0.0.1, 61633> ``` Notes: Merged: https://github.com/ruby/ruby/pull/11428
2024-08-21[PRISM] Implement unused block warningeileencodes
Related: ruby/prism#2935 Notes: Merged: https://github.com/ruby/ruby/pull/11415
2024-08-21[PRISM] Fix up test exception assertion for PrismKevin Newton
2024-08-21[rubygems/rubygems] Fix `gem uninstall <name>:<version>` failing on shadowed ↵David Rodríguez
default gems https://github.com/rubygems/rubygems/commit/29357a5dd6
2024-08-20[ruby/tempfile] Fix subprocess tests requiresPeter Zhu
Using `-rtempfile` requires the tempfile built into Ruby, not the currently developed one, so the tests aren't testing this tempfile. https://github.com/ruby/tempfile/commit/ea2dec6f46
2024-08-20[ruby/tempfile] Add FinalizerManager to manage finalizersPeter Zhu
As @jeremyevans pointed out for commit eb2d8b1: > Each Tempfile instance has a separate File instance and file descriptor: > > t = Tempfile.new > t.to_i # => 6 > t.dup.to_i => 7 FinalizerManager will keep track of the open File objects for the particular file and will only unlink the file when all of the File objects have been closed. https://github.com/ruby/tempfile/commit/753ab16642
2024-08-20Rewrite #test_redefinition_mismatch to use a dedicated test classKJ Tsanaktsidis
This test is checking what happens if you try and define a class in a C extension where that constant is already not a class. It was doing this by overriding ::Date and then trying to require 'date. The issue with this is that if we ever add 'date' as a dependency for the test runner, this test will break because the test runner files get implicitly required in an `assert_separately` block. Better use an explicit class for this purpose which can't be accidentally required elsewhere. Notes: Merged: https://github.com/ruby/ruby/pull/11400
2024-08-20Decrease the timeout in assert_darwin_vm_dump_works (#11412)Naoto Ono
Notes: Merged-By: ono-max <[email protected]>
2024-08-19Avoid hash allocation for certain proc callsJeremy Evans
Previously, proc calls such as: ```ruby proc{|| }.(**empty_hash) proc{|b: 1| }.(**r2k_array_with_empty_hash) ``` both allocated hashes unnecessarily, due to two separate code paths. The first call goes through CALLER_SETUP_ARG/vm_caller_setup_keyword_hash, and is simple to fix by not duping an empty keyword hash that will be dropped. The second case is more involved, in setup_parameters_complex, but is fixed the exact same way as when the ruby2_keywords hash is not empty, by flattening the rest array to the VM stack, ignoring the last element (the empty keyword splat). Add a flatten_rest_array static function to handle this case. Update test_allocation.rb to automatically convert the method call allocation tests to proc allocation tests, at least for the calls that can be converted. With the code changes, all proc call allocation tests pass, showing that proc calls and method calls now allocate the same number of objects. I've audited the allocation tests, and I believe that all of the low hanging fruit has been collected. All remaining allocations are either caller side: * Positional splat + post argument * Multiple positional splats * Literal keywords + keyword splat * Multiple keyword splats Or callee side: * Positional splat parameter * Keyword splat parameter * Keyword to positional argument conversion for methods that don't accept keywords * ruby2_keywords method called with keywords Reapplies abc04e898b627ab37fa9dd5e330f239768778d8b, which was reverted at d56470a27c5a8a2e7aee7a76cea445c2d29c0c59, with the addition of a bug fix and test. Fixes [Bug #20679] Notes: Merged: https://github.com/ruby/ruby/pull/11409 Merged-By: jeremyevans <[email protected]>
2024-08-19[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.100 to 0.9.101. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.100...v0.9.101) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> https://github.com/rubygems/rubygems/commit/3addc2c3e7
2024-08-19[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.100 to 0.9.101. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.100...v0.9.101) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> https://github.com/rubygems/rubygems/commit/d26f5824a7
2024-08-19Make assertions allow incremental GC when disabledPeter Zhu
When assertions are enabled, the following code triggers an assertion error: GC.disable GC.start(immediate_mark: false, immediate_sweep: false) 10_000_000.times { Object.new } This is because the GC.start ignores that the GC is disabled and will start incremental marking and lazy sweeping. But the assertions in gc_marks_continue and gc_sweep_continue assert that GC is not disabled. This commit changes it for the assertion to pass if the GC was triggered from a method. Notes: Merged: https://github.com/ruby/ruby/pull/11391
2024-08-18Make Range#step to consistently use + for iteration (#7444)Victor Shepelev
Make Range#step to consistently use + for iteration [Feature #18368] Previously, non-numerics expected step to be integer, and iterated with begin#succ, skipping over step value steps. Since this commit, numeric and non-numeric iteration behaves the same way, by using + operator. Notes: Merged-By: zverok <[email protected]>
2024-08-16Revert "Avoid hash allocation for certain proc calls"Jeremy Evans
This reverts commit abc04e898b627ab37fa9dd5e330f239768778d8b. This caused problems in a Rails test. Notes: Merged: https://github.com/ruby/ruby/pull/11394
2024-08-16Fix assertion error when TracePoint has incompatible eventsPeter Zhu
TracePoints with incompatible events (i.e. events not in ISEQ_TRACE_EVENTS) with a method target will fail an assertion error because it does not filter for the supported events. For example, the following lines will cause an assertion error: def foo; end # No arguments passed into TracePoint.new enables all ISEQ_TRACE_EVENTS TracePoint.new {}.enable(target: method(:foo)) # Raise is not supported with a target TracePoint.new(:raise, :return) {}.enable(target: method(:foo)) foo Crashes with: Assertion Failed: vm_insnhelper.c:7026:vm_trace:(iseq_local_events & ~(0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010| 0x0020| 0x0040 | 0x0100 | 0x0200 | 0x4000 | 0x010000| 0x020000)) == 0 Notes: Merged: https://github.com/ruby/ruby/pull/11390
2024-08-16[ruby/openssl] Remove test_ed25519_not_approved_on_fips.Jun Aruga
This commit fixes the following failure on OpenSSL master FIPS case. ``` 1) Failure: test_ed25519_not_approved_on_fips(OpenSSL::TestPKey): OpenSSL::PKey::PKeyError expected but nothing was raised. /home/runner/work/openssl/openssl/vendor/bundle/ruby/3.0.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:462:in `assert_raise' /home/runner/work/openssl/openssl/test/openssl/test_pkey.rb:174:in `test_ed25519_not_approved_on_fips' 171: MC4CAQAwBQYDK2VwBCIEIEzNCJso/5banbbDRuwRTg9bijGfNaumJNqM9u1PuKb7 172: -----END PRIVATE KEY----- 173: EOF => 174: assert_raise(OpenSSL::PKey::PKeyError) do 175: OpenSSL::PKey.read(priv_pem) 176: end 177: end ``` Because FIPS compliance is a continually moving target. According to the [1], FIPS 140-3 *currently* allows ED25519. The ED25519 is allowed again with the latest OpenSSL FIPS by the commit [2], while it is not allowed in OpenSSL stable version 3.x FIPS. Remove this test because we want to keep our tests stable. [1] https://github.com/openssl/openssl/discussions/22054 [2] https://github.com/openssl/openssl/commit/5f04124aab4a477d4e58149d8f04871ff7e5ea4b https://github.com/ruby/openssl/commit/d43904b834
2024-08-16[ruby/openssl] test_s_generate_parameters: Consider a DSA error in FIPS.Jun Aruga
DSA kengen is not FIPS-approved. The `EVP_PKEY_paramgen` in the `OpenSSL::PKey.generate_parameters("DSA")` raises a DSA error in FIPS by the following commit. Split the test for DSA. https://github.com/openssl/openssl/commit/49a35f0#diff-605396c063194975af8ce31399d42690ab18186b422fb5012101cc9132660fe1R611-R614 https://github.com/ruby/openssl/commit/5ca6eb4eca
2024-08-16Fix flaky TestSetTraceFunc#test_remove_in_trace by filtering trace eventsNaoto Ono
Notes: Merged: https://github.com/ruby/ruby/pull/11368
2024-08-15Avoid hash allocation for certain proc callsJeremy Evans
Previous, proc calls such as: ```ruby proc{|| }.(**empty_hash) proc{|b: 1| }.(**r2k_array_with_empty_hash) ``` both allocated hashes unnecessarily, due to two separate code paths. The first call goes through CALLER_SETUP_ARG/vm_caller_setup_keyword_hash, and is simple to fix by not duping an empty keyword hash that will be dropped. The second case is more involved, in setup_parameters_complex, but is fixed the exact same way as when the ruby2_keywords hash is not empty, by flattening the rest array to the VM stack, ignoring the last element (the empty keyword splat). Add a flatten_rest_array static function to handle this case. Update test_allocation.rb to automatically convert the method call allocation tests to proc allocation tests, at least for the calls that can be converted. With the code changes, all proc call allocation tests pass, showing that proc calls and method calls now allocate the same number of objects. I've audited the allocation tests, and I believe that all of the low hanging fruit has been collected. All remaining allocations are either caller side: * Positional splat + post argument * Multiple positional splats * Literal keywords + keyword splat * Multiple keyword splats Or callee side: * Positional splat parameter * Keyword splat parameter * Keyword to positional argument conversion for methods that don't accept keywords * ruby2_keywords method called with keywords Notes: Merged: https://github.com/ruby/ruby/pull/11258
2024-08-15[PRISM] test_invalid_jump assertion updates for prismKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11386
2024-08-15[PRISM] test_syntax_check assertion updates for prismKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11386
2024-08-15[ruby/prism] Fix up lex result constantsKevin Newton
https://github.com/ruby/prism/commit/084baca463
2024-08-15[ruby/prism] Special error for too short unicode errorsKevin Newton
https://github.com/ruby/prism/commit/9f1f7d08bd
2024-08-15[ruby/rdoc] Fix sidebar scroll again and add missing footer backStan Lo
(https://github.com/ruby/rdoc/pull/1154) * Add missing footers In #1152 the footer partial was only added to the index.rhtml file. This commit adds the footer partial to the other template files. * Remove unnecessary middle divs in nav * Simplify sidebar's overflow settings Because sidebar needs to be scrollable, its overflow should default to auto. Currently it's set to hidden and force individual elements to set overflow auto, which overcomplicates things. https://github.com/ruby/rdoc/commit/b8c2bcd8db
2024-08-14Increase timeout of test_finalizerPeter Zhu
The test is timing out on lpi4a so a longer timeout should fix it.
2024-08-14Fix crash when GC runs during finalizers at shutdownPeter Zhu
We need to remove from the finalizer_table after running all the finalizers because GC could trigger during the finalizer which could reclaim the finalizer table array. The following code crashes: 1_000_000.times do o = Object.new ObjectSpace.define_finalizer(o, proc { }) end Notes: Merged: https://github.com/ruby/ruby/pull/11375
2024-08-14Increase the default timeout in assert_darwin_vm_dump_worksNaoto Ono
Notes: Merged: https://github.com/ruby/ruby/pull/11373
2024-08-13[ruby/resolv] test_dns: Fix failure on WindowsSorah Fukumori
(https://github.com/ruby/resolv/pull/58) test_dns: Fix failure on Windows 1. Switch to #with_udp_and_tcp helper method for EACCES retries on Windows; the given UDP socket is unnecessary though. 2. Using 127.0.0.1 should be fine, as it must give different host:port pair. 3. On Windows, 5 retries of bind(2) appears still flaky, doubling it for sure. follow-up: https://github.com/ruby/resolv/pull/50 follow-up: https://github.com/ruby/resolv/commit/6252914e95dfdf8995d8074df6cafe6f0a76c1ca https://github.com/ruby/resolv/commit/0a0d57e369
2024-08-13[ruby/resolv] Fix TCP fallback with multiple nameserversIgor Pstyga
Under the following conditions the exception `Resolv::DNS::Requester::RequestError: host/port don't match` is raised: - Multiple nameservers are configured for Resolv::DNS - A nameserver falls back from UDP to TCP - TCP request hits Resolv::DNS timeout - Resolv::DNS retries the next nameserver More details here https://bugs.ruby-lang.org/issues/8285 https://github.com/ruby/resolv/commit/7d524df80e Co-authored-by: Julian Mehnle <[email protected]>
2024-08-13Make sure to wait for the thread to exit in TestProcess#test_wait_and_sigchildNaoto Ono
Notes: Merged: https://github.com/ruby/ruby/pull/11366
2024-08-13do not show unused block on `send`Koichi Sasada
Some case it is difficult to know the calling method uses a block or not with `send` on a general framework. So this patch stops showing unused block warning on `send`. example with test/unit: ```ruby require 'test/unit' class T < Test::Unit::TestCase def setup end def test_foo = nil end ``` => /home/ko1/ruby/install/master/lib/ruby/gems/3.4.0+0/gems/test-unit-3.6.2/lib/test/unit/fixture.rb:284: warning: the block passed to 'priority_setup' defined at /home/ko1/ruby/install/master/lib/ruby/gems/3.4.0+0/gems/test-unit-3.6.2/lib/test/unit/priority.rb:183 may be ignored because test/unit can call any setup method (`priority_setup` in this case) with a block. Maybe we can show the warning again when we provide a way to recognize the calling method uses a block or not. Notes: Merged: https://github.com/ruby/ruby/pull/11349
2024-08-12Fix next inside block argument stack underflowtompng
[Bug #20344] Fix compile_next adding removable adjust label Notes: Merged: https://github.com/ruby/ruby/pull/11316
2024-08-11Fix flag test macroNobuyoshi Nakada
`RBOOL` is a macro to convert C boolean to Ruby boolean. Notes: Merged: https://github.com/ruby/ruby/pull/11351
2024-08-10Cherry-pick test for [Bug #20668]Jean Boussier
The bug didn't impact master because this was largely refactored, but it's still valuable to add the test for it to prevent future regressions. Notes: Merged: https://github.com/ruby/ruby/pull/11359
2024-08-09[ruby/psych] Convert tabs to spaces in test/psych/test_yaml.rbPeter Zhu
https://github.com/ruby/psych/commit/64bfc308f8
2024-08-09Increase timeout in `test_darwin_invalid_call` methodNaoto Ono
Notes: Merged: https://github.com/ruby/ruby/pull/11348
2024-08-08[ruby/uri] Use URI::RFC2396_PARSER explicitly in URIHiroshi SHIBATA
https://github.com/ruby/uri/commit/898b889811
2024-08-07Fix leak of token_info when Ripper#warn jumpsPeter Zhu
For example, the following code leaks: class MyRipper < Ripper def initialize(src, &blk) super(src) @blk = blk end def warn(msg, *args) = @blk.call(msg) end $VERBOSE = true def call_parse = MyRipper.new("if true\n end\n") { |msg| return msg }.parse 10.times do 500_000.times do call_parse end puts `ps -o rss= -p #{$$}` end Before: 37536 53744 70064 86448 102576 119120 135248 151216 167744 183824 After: 19280 19696 19728 20336 20448 21408 21616 21616 21824 21840 Notes: Merged: https://github.com/ruby/ruby/pull/11289
2024-08-06Fix leak in warning of duplicate keys when Ripper#warn jumpsPeter Zhu
For example, the following code leaks: class MyRipper < Ripper def initialize(src, &blk) super(src) @blk = blk end def warn(msg, *args) = @blk.call(msg) end $VERBOSE = true def call_parse = MyRipper.new("if true\n end\n") { |msg| return msg }.parse 10.times do 500_000.times do call_parse end puts `ps -o rss= -p #{$$}` end Before: 34832 51952 69760 88048 105344 123040 141152 159152 176656 194272 After: 18400 20256 20272 20272 20272 20304 20368 20368 20368 20400 Notes: Merged: https://github.com/ruby/ruby/pull/11288
2024-08-06[ruby/uri] Fallback missing constants with RFC3986_PARSERHiroshi SHIBATA
(https://github.com/ruby/uri/pull/113) * Fallback missing constants with RFC3986_PARSER * raise missing constant * Update test/uri/test_common.rb Co-authored-by: Nobuyoshi Nakada <[email protected]> * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada <[email protected]> * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada <[email protected]> --------- https://github.com/ruby/uri/commit/c2fdec079a Co-authored-by: Nobuyoshi Nakada <[email protected]>
2024-08-06[ruby/openssl] test/openssl/test_pkey_dsa.rb: skip all tests in FIPS modeKazuki Yamaguchi
OpenSSL running in the FIPS mode will stop supporting DSA key generation and signature generation due to a FIPS 140-3 requirement. Although it appears that FIPS 186-5 still allows signature verification in some cases, there would be little point in writing such a specific test case. DSA will still be tested if OpenSSL is not running in the FIPS mode. test_generate_on_non_fips is merged to test_generate again. https://github.com/ruby/openssl/commit/3651884fd2
2024-08-05[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.99 to 0.9.100. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.99...v0.9.100) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> https://github.com/rubygems/rubygems/commit/dd5df7d614
2024-08-05[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.98 to 0.9.100. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.98...v0.9.100) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> https://github.com/rubygems/rubygems/commit/6f05927746
2024-08-05[ruby/reline] Accept colon-style hash in test assertiontomoya ishida
(https://github.com/ruby/reline/pull/732) Hash#inspect is proposed to change to {key: value, non_symbol_key => value} in https://bugs.ruby-lang.org/issues/20433#note-10 https://github.com/ruby/reline/commit/1fd73b358a
2024-08-05[ruby/optparse] Fix parsing array arguments with `:into` optionfatkodima
https://github.com/ruby/optparse/commit/19700e96d8
2024-08-05Sync rdocStan Lo
Notes: Merged: https://github.com/ruby/ruby/pull/11308
2024-08-04[ruby/irb] Remove Ruby version checksRicardo Trindade
(https://github.com/ruby/irb/pull/985) https://github.com/ruby/irb/commit/9ce6972e71
2024-08-03Extend timeout in test/ruby/test_file_exhaustive.rbYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/11307
2024-08-03Reduce noise in object generation count testsYusuke Endoh
The parallel testing framework may create strings in a separate thread. ``` 1) Failure: TestStringMemory#test_byteslice_prefix [D:/a/ruby/ruby/src/test/ruby/test_string_memory.rb:40]: One object allocation is expected, but allocated: [["D:/a/ruby/ruby/src/tool/lib/test/unit/parallel.rb", 42, String, "2240\x00\x00\x00\x00... ``` https://github.com/ruby/ruby/actions/runs/10222885396/job/28288271190?pr=11271#step:23:1026 Notes: Merged: https://github.com/ruby/ruby/pull/11306
2024-08-03Show where objects were allocated on allocation count testsYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/11297