summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-06-01Revert "Fix cvar caching when class is cloned"Aaron Patterson
This reverts commit 77d1b082470790c17c24a2f406b4fec5d522636b.
2023-06-01[ruby/irb] Improve debug command testsStan Lo
(https://github.com/ruby/irb/pull/594) * Use require_relative for envutil.rb Requiring test helper files with `require_relative` allows running the tests with `ruby -Itest test/irb/test_debug_cmd.rb` without having to set up the load path. * Replace reline hack with TERM=dumb
2023-06-01Fix cvar caching when class is clonedeileencodes
The class variable cache that was added in https://github.com/ruby/ruby/pull/4544 changed the behavior of class variables on cloned classes. As reported when a class is cloned AND a class variable was set, and the class variable was read from the original class, reading a class variable from the cloned class would return the value from the original class. This was happening because the IC (inline cache) is stored on the ISEQ which is shared between the original and cloned class, therefore they share the cache too. To fix this we are now storing the `cref` in the cache so that we can check if it's equal to the current `cref`. If it's different we don't want to read from the cache. If it's the same we do. Cloned classes don't share the same cref with their original class. This will need to be backported to 3.1 in addition to 3.2 since the bug exists in both versions. We also added a marking function which was missing. Fixes [Bug #19379] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7265
2023-05-31More debug code to GC compaction testPeter Zhu
2023-05-31Fix flaky test in test_objspace.rbPeter Zhu
Ensure that the frozen string is promoted to the old generation by running the GC 4 times.
2023-05-31Add debug code to GC compaction testPeter Zhu
This test is flaky on some CI systems.
2023-05-30Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/7873
2023-05-29[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.77 to 0.9.78. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.77...v0.9.78) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29[ruby/cgi] Add TruffleRuby support and add it in CIBenoit Daloze
https://github.com/ruby/cgi/commit/1240fec9c9
2023-05-29mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)Jun Aruga
This commit is to add an extra option to enable verbose mode (V=1) in the generated `Makefile` at runtime of the Ruby to print compiler command lines by the commands below when building native extensions. It's possible to enable the verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1] implemented in GNU make. However, I wanted to make a consistent user-interface not depending on the specific make's implementation. ``` $ ruby /path/to/extconf.rb -- --with-verbose ``` You can also add the extra option via rake-compiler gem. ``` $ rake compiler -- --with-verbose ``` If the extra option is not given, the value of the `RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is used. ``` $ ./configure --enable-mkmf-verbose ``` For the unit tests, updated the following files. * The `test/mkmf/test_configuration.rb` was created to test the cases with the `configuration` method and this implementation. * Updated the `TestMkmf#assert_separately` to set the extra arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`. * Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`. [1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html Fixes [Bug #19695] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: junaruga
2023-05-27[ruby/reline] Fix scrolldown condition in dialog renderingtomoya ishida
(https://github.com/ruby/reline/pull/541) https://github.com/ruby/reline/commit/ad6faada3f
2023-05-27[ruby/reline] Use appropriate dialog height and reduce screen pushuptomoya ishida
problem (https://github.com/ruby/reline/pull/542) * Provide preferred_dialog_height for dialog positioning * Fix rendering test
2023-05-27Improve `read`/`write`/`pread`/`pwrite` consistency. (#7860)Samuel Williams
* Documentation consistency. * Improve consistency of `pread`/`pwrite` implementation when given length. * Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-26Remvoe very high timeout on test_race_gets_and_closeKJ Tsanaktsidis
This test should be fixed and fast now because the closing thread sleeps appropriately waiting for the file descriptor to be unused. Notes: Merged: https://github.com/ruby/ruby/pull/7865
2023-05-26Remove excessive timeout on test_wait_exception for FreeBSDKJ Tsanaktsidis
This should now be fixed by the previous commit. Notes: Merged: https://github.com/ruby/ruby/pull/7864
2023-05-25[rubygems/rubygems] Load plugin immediatelySutou Kouhei
We can install RubyGems plugin by "gem install XXX". The installed plugin is used from the NEXT "gem ...". For example, "gem install gem-src kaminari" doesn't use gem-src plugin for kaminari. "gem install gem-src && gem install kaminari" uses gem-src plugin for kaminari. How about loading a plugin immediately when the plugin is installed? If this proposal is implemented, "gem install gem-src kaminari" works like "gem install gem-src && gem install kaminari". https://github.com/rubygems/rubygems/commit/4917d96f4c
2023-05-25Don't immediately promote children of old objectsPeter Zhu
[Feature #19678] References from an old object to a write barrier protected young object will not immediately promote the young object. Instead, the young object will age just like any other object, meaning that it has to survive three collections before being promoted to the old generation. References from an old object to a write barrier unprotected object will place the parent object in the remember set for marking during minor collections. This allows the child object to be reclaimed in minor collections at the cost of increased time for minor collections. On one of [Shopify's highest traffic Ruby apps, Storefront Renderer](https://shopify.engineering/how-shopify-reduced-storefront-response-times-rewrite), we saw significant improvements after deploying this feature in production. We compare the GC time and response time of web workers that have the original behaviour (non-experimental group) and this new behaviour (experimental group). We see that with this feature we spend significantly less time in the GC, 0.81x on average, 0.88x on p99, and 0.45x on p99.9. This translates to improvements in average response time (0.96x) and p99 response time (0.92x). Notes: Merged: https://github.com/ruby/ruby/pull/7821
2023-05-25[ruby/csv] Support RJIT (https://github.com/ruby/csv/pull/281)Nobuyoshi Nakada
In Ruby 3.3, MJIT is replaced with RJIT. https://github.com/ruby/csv/commit/cc6b47a4a7 Notes: Merged: https://github.com/ruby/ruby/pull/7851
2023-05-25[ruby/csv] test: rename Helper to CSVHelperLuke Gruber
(https://github.com/ruby/csv/pull/278) Rename it so that in ruby/ruby, the generic name Helper is not used. Notes: Merged: https://github.com/ruby/ruby/pull/7851
2023-05-24Add REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIOPeter Zhu
[Feature #19571] This commit adds the environment variable `RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO` which is used to calculate the `remembered_wb_unprotected_objects_limit` using a ratio of `old_objects`. This should improve performance by reducing major GC because, in a major GC, we mark all of the old objects, so we should have more uncollectible WB unprotected objects before starting a major GC. The default has been set to 0.01 (1% of old objects). On one of [Shopify's highest traffic Ruby apps, Storefront Renderer](https://shopify.engineering/how-shopify-reduced-storefront-response-times-rewrite), we saw significant improvements after deploying this patch in production. In the graphs below, we have the `tuned` group which uses `RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO=0.01` (the default value), and an `untuned` group, which turns this feature off with `RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO=0`. We see that the tuned group spends significantly less time in GC, on average 0.67x of the time compared to the untuned group and 0.49x for p99. We see this improvement in GC time translate to improvements in response times. The average response time is now 0.96x of the time compared to the untuned group and 0.86x for p99. https://user-images.githubusercontent.com/15860699/229559078-e23e8ce4-5f1f-4a2f-b5ef-5769f92b8c70.png Notes: Merged: https://github.com/ruby/ruby/pull/7577
2023-05-24[ruby/racc] Add a newline at EOF [ci skip]Nobuyoshi Nakada
https://github.com/ruby/racc/commit/8f1dab6759
2023-05-24Improvements to `IO::Buffer` `read`/`write`/`pread`/`pwrite`. (#7826)Samuel Williams
- Fix IO::Buffer `read`/`write` to use a minimum length. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-24[flori/json] Call `super` in `included` hookUfuk Kayserilioglu
The C extension defines an `included` hook for the `JSON::Ext::Generator::GeneratorMethods::String` module but neglects to call `super` in the hook. This can break the functionality of various other code that rely on the fact that `included` on `Module` will always be called. https://github.com/flori/json/commit/cd8bbe56a3
2023-05-23Fix crash when replacing ST hash with AR hashPeter Zhu
With VWA, AR hashes are much larger than ST hashes. Hash#replace attempts to directly copy the contents of AR hashes into ST hashes so there will be memory corruption caused by writing past the end of memory. This commit changes it so that if a ST hash is being replaced with an AR hash it will insert each element into the ST hash. Notes: Merged: https://github.com/ruby/ruby/pull/7846
2023-05-23[rubygems/rubygems] Remove forward slash in key regardless if it contains __Jenny Shen
https://github.com/rubygems/rubygems/commit/33a02eec00
2023-05-23[ruby/irb] Allow `show_source` for private methodsTSUYUSATO Kitsune
(https://github.com/ruby/irb/pull/589) * Allow `show_source` for private methods Fix https://github.com/ruby/irb/pull/577 * Pend tests on TruffleRuby It seems `eval(..., __LINE__ + 1)` does not work. Other similar tests are also pended on TruffleRuby, so I think it is acceptable. * Use `private_method_defined?` instead of `defined?`
2023-05-22Ensure producer threads do not start running earlyCharles Oliver Nutter
This test caused issues occasionally on JRuby because it's possible for a producer thread to run to completion before the status checks begin. This results in Thread#status returning false and the =~ call triggering a warning (3.1) or error (3.2) and either emitting thousands of deprecation warnings or failing outright. The patch here introduces a mutex that remains locked until all producer threads are seen to have started. The lock is then released and the test proceeds. This prevents any producers from running to completion, which in turn prevents consumers running to completion, avoiding the warnings or error calling =~ on false. This patch also modifies the status checks to to_s the thread status, preventing any prematurely terminated threads from triggering similar deprecation warnings or missing method errors when =~ is called on nil. Notes: Merged: https://github.com/ruby/ruby/pull/7830
2023-05-22Revert "Apply timeout-scale to test_thr_kill." (#7838)Jun Aruga
This reverts commit bbbec4b87c1e66909f5bee9acd3e460b8c1ad663. Because the commit is a bug. The `apply_timeout_scale` to scale the timeout is called 2 times in the process. The `test/ruby/test_thread_queue.rb#test_thr_kill` is calling `EnvUtil.apply_timeout_scale`, and calling `tool/lib/core_assertions.rb#assert_normal_exit`. calling `tool/lib/envutil.rb#invoke_ruby` (`EnvUtil.invoke_ruby`) calling the `apply_timeout_scale`. ``` $ make test-all V=1 TESTS="-v test/ruby/test_thread_queue.rb -n TestThreadQueue#test_thr_kill --timeout-scale=2" ``` Notes: Merged-By: junaruga
2023-05-22Fix mutation on shared strings. (#7837)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-22Allow the match cache optimization for atomic groups (#7804)TSUYUSATO Kitsune
Notes: Merged-By: makenowjust <make.just.on@gmail.com>
2023-05-22Don't leak pipes. (#7820)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-21Skip too-complex-shape test which is always flaky regardless JITNobuyoshi Nakada
2023-05-21[ruby/irb] Fix typo (https://github.com/ruby/irb/pull/587)ima1zumi
* Fix typo * s/braking/breaking/g Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/irb/commit/5f8e69f5f2 Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-21Skip first if flaky [ci skip]Nobuyoshi Nakada
2023-05-20Set rlimit_nproc to 64 instead of 128 on OpenBSD for spawn_too_long_path testsJeremy Evans
This significantly reduces testing time, and may allow the test to pass before timeout in CI.
2023-05-20[ruby/irb] Add assertion for dynamic_prompt's assertion executionStan Lo
(https://github.com/ruby/irb/pull/586) Because the assertions for `dynamic_prompt` lives inside a block given to `RubyLex`, they could be skipped unnoticed if the setup is not correct. This commit adds a simple assertion to check if the block was actually executed.
2023-05-20[ruby/irb] Fix dynamic_prompt test not executed, remove unnecessarytomoya ishida
set_input (https://github.com/ruby/irb/pull/585) https://github.com/ruby/irb/commit/b5f3efdcf0
2023-05-19[ruby/irb] Simplify each_top_level_statementtomoya ishida
(https://github.com/ruby/irb/pull/576) * Simplify each_top_level_statement, reduce instance vars * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Remove unused ltype from TestRubyLex#check_state response * Remove unnecessary const path of TerminateLineInput * Combine duplicated code state check into method --------- https://github.com/ruby/irb/commit/172453cec4 Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-19The too-complex test isn't stablefor RJIT eitherTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/5020231516
2023-05-19Skip test_dump_too_complex_shape for YJIT for nowTakashi Kokubun
It fails too often with YJIT: * https://github.com/ruby/ruby/actions/runs/5015976941/jobs/8992254690 * https://github.com/ruby/ruby/actions/runs/5017310353/jobs/8995281395 * https://github.com/ruby/ruby/actions/runs/5019625711/jobs/9000322487 * https://github.com/ruby/ruby/actions/runs/5019883965/jobs/9000836915 ref: https://github.com/ruby/ruby/pull/7646
2023-05-19[ruby/openssl] Revert "Skip OpenSSL::TestHMAC#test_dup when running with RHEL9"Hiroshi SHIBATA
This reverts commit https://github.com/ruby/openssl/commit/9493d4a3bb26. https://github.com/ruby/openssl/commit/b880a023dd
2023-05-19[ruby/openssl] Implement FIPS functions on OpenSSL 3.Jun Aruga
This commit is to implement the `OpenSSL::OPENSSL_FIPS`, `ossl_fips_mode_get` and `ossl_fips_mode_set` to pass the test `test/openssl/test_fips.rb`. It seems that the `OPENSSL_FIPS` macro is not used on the FIPS mode case any more, and some FIPS related APIs also were removed in OpenSSL 3. See the document <https://github.com/openssl/openssl/blob/master/doc/man7/migration_guide.pod#removed-fips_mode-and-fips_mode_set> the section OPENSSL 3.0 > Main Changes from OpenSSL 1.1.1 > Other notable deprecations and changes - Removed FIPS_mode() and FIPS_mode_set() . The `OpenSSL::OPENSSL_FIPS` returns always true in OpenSSL 3 because the used functions `EVP_default_properties_enable_fips` and `EVP_default_properties_is_fips_enabled` works with the OpenSSL installed without FIPS option. The `TEST_RUBY_OPENSSL_FIPS_ENABLED` is set on the FIPS mode case on the CI. Because I want to test that the `OpenSSL.fips_mode` returns the `true` or 'false' surely in the CI. You can test the FIPS mode case by setting `TEST_RUBY_OPENSSL_FIPS_ENABLED` on local too. Right now I don't find a better way to get the status of the FIPS mode enabled or disabled for this purpose. I am afraid of the possibility that the FIPS test case is unintentionally skipped. I also replaced the ambiguous "returns" with "should return" in the tests. https://github.com/ruby/openssl/commit/c5b2bc1268
2023-05-19[ruby/openssl] CI: Add OpenSSL FIPS mode case.Jun Aruga
test/openssl/fixtures/ssl/openssl_fips.cnf.tmpl: I referred to the following document for the openssl config file for FIPS mode. <https://www.openssl.org/docs/manmaster/man7/fips_module.html> - Making all applications use the FIPS module by default It seems that the `.include` syntax only requires the absolute path. So, the placeholder OPENSSL_DIR in the template file is replaced with the actual OpenSSL directory. .github/workflows/test.yml: The `TEST_RUBY_OPENSSL_FIPS_ENABLED` environment variable is set in the FIPS mode CI case. It can be used in the unit tests. https://github.com/ruby/openssl/commit/18b017218c
2023-05-18[ruby/irb] Refactor RubyLex's input/io methodsStan Lo
(https://github.com/ruby/irb/pull/583) 1. Make `RubyLex#set_input` simply assign the input block. This matches the behavior of `RubyLex#set_prompt`. 2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent` into `#configure_io`.
2023-05-18change to test/objectspace, don't rely on Object's shape not being "too complex"lukeg
2023-05-18[ruby/irb] Print deprecation warning for `help` commandStan Lo
(https://github.com/ruby/irb/pull/567) * Give show_doc its own command class * Print deprecation warning for `help` command
2023-05-17Move ar_hint to ar_table_structPeter Zhu
This allows Hashes with ST tables to fit int he 80 byte size pool. Notes: Merged: https://github.com/ruby/ruby/pull/7742
2023-05-17Implement Hash AR tables on VWAPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/7742
2023-05-17[ruby/irb] Fix Test timedout in test_debug_cmdtomoya ishida
(https://github.com/ruby/irb/pull/582) * Suppress Reline::IOGate.cursor_pos writing escape sequence in test_debug_cmd * Force use Reline::GeneralIO as Reline::IOGate and remove RUBY_DEBUG_NO_RELINE option for debug test
2023-05-15[rubygems/rubygems] Bump rb-sysdependabot[bot]
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.75 to 0.9.77. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.75...v0.9.77) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>