Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard for Ruby 3.1 #679

Merged
merged 1 commit into from
May 26, 2021
Merged

Guard for Ruby 3.1 #679

merged 1 commit into from
May 26, 2021

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented May 26, 2021

prime library will be removed ruby repo at Ruby 3.1.

class PrimeTest < StdlibTest
target Prime
library "prime"
class PrimeTest < StdlibTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Goodcheck] StdlibTest is deprecated (view)

We recommend writing tests based on TypeAssertions and #assert_send_type.

Rule
deprecate_stdlib_test

You can close this issue if no need to fix it. Learn more.

I closed this issue. Reason:

  • When you are updating existing tests.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@soutaro soutaro merged commit 64b3409 into master May 26, 2021
@soutaro soutaro deleted the guard-prime-test branch May 26, 2021 16:05
hsbt added a commit to ruby/ruby that referenced this pull request May 27, 2021
maximecb added a commit to Shopify/yjit that referenced this pull request Jun 3, 2021
* Remove extra word in heredoc documentation

From Thibault Jouan

Fixes [Misc #17872]

* * 2021-05-21 [ci skip]

* [DOC] Moved `File.fnmatch?` to dir.rb

So that no longer disturbed by C comment delimiters.

* Remove short options with argument [Bug #17870]

Remove GNU make `-O` and `-W` options which are short but followed
by an argument, so that `$mflags.set?(?n)` does not return `true`
wrongly.

* [ruby/rdoc] Use File.open to fix the OS Command Injection vulnerability in CVE-2021-31799

ruby/rdoc@a7f5d6ab88

* [ruby/rdoc] Version 6.3.1

ruby/rdoc@9307f932b7

* [ruby/rdoc] Update rdoc.gemspec by adding lib/rdoc/markup/table.rb

Fixes ruby/rdoc#808

ruby/rdoc@80766fd389

* [ruby/rdoc] Dir.children is 2.5+

RDoc seems still supporting outdated 2.4.

https://github.com/ruby/rdoc/runs/2565344070?check_suite_focus=true#step:5:64
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): NoMethodError: undefined method `children' for Dir:Class
/home/runner/work/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:467:in `block in test_remove_unparseable_CVE_2021_31799'
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
  => 467:       assert_equal file_list, Dir.children('.')
     468:     end
     469:   end
     470:
```

ruby/rdoc@5a4a64dc0f

* [ruby/rdoc] Vertical-bar is disallowed in path names on Windows

No risk of remote code execution, when the file cannot be created.

https://github.com/ruby/rdoc/runs/2565343916?check_suite_focus=true#step:5:58
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): Errno::EINVAL: Invalid argument @ utime_failed - | touch evil.txt && echo tags
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `utime'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `block in touch'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `each'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `touch'
D:/a/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:463:in `block (2 levels) in test_remove_unparseable_CVE_2021_31799'
     460:     temp_dir do
     461:       file_list = ['| touch evil.txt && echo tags']
     462:       file_list.each do |f|
  => 463:         FileUtils.touch f
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
```

ruby/rdoc@a7df7dc8fa

* [ruby/rdoc] Follow-up rubygems

Use test-unit assertions instead of minitest.

ruby/rdoc@d6a6209d7f

* [ruby/rdoc] Drop support for Ruby 2.4

ruby/rdoc@f480b970cc

* simple rescue+while+break should not use `throw`

609de71 fixes the issue by using
`throw` insn if `ensure` is used. However, that patch introduce
additional `throw` even if it is not needed. This patch solves
the issue.

This issue is pointed by @mame.

* Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]

* ripper: assertions for rescue/ensure in method body

* ripper: wrap endless method in bodystmt [Bug #17869]

* Avoid setting the visibility of refinement method entries

Since refinement search is always performed, these entries should always
be public. The method entry that the refinement search returns decides
the visibility.

Fixes [Bug #17822]

* * 2021-05-22 [ci skip]

* Build CDHASH properly when loading iseq from binary

Before this change, CDHASH operands were built as plain hashes when
loaded from binary. Without setting up the hash with the correct
st_table type, the hash can sometimes be an ar_table. When the hash is
an ar_table, lookups can call the `eql?` method on keys of the hash,
which makes the `opt_case_dispatch` instruction not "leaf" as it
implicitly declares.

The following script trips the stack canary for checking the leaf
attribute for `opt_case_dispatch` on VM_CHECK_MODE > 0 (enabled by
default with RUBY_DEBUG).

    rb_vm_iseq = RubyVM::InstructionSequence

    iseq = rb_vm_iseq.compile(<<-EOF)
      case Class.new(String).new("foo")
      when "foo"
        42
      end
    EOF

    puts rb_vm_iseq.load_from_binary(iseq.to_binary).eval

This commit changes the binary loading logic to build CDHASH with the
right st_table type. The dumping logic and the dump format stays the
same

* Do not allow array modifications after freeze inside sort!

If freezing an array inside sort!, previously the array could be
modified after the freeze.  This checks whether the receiver is
frozen after every yield and potential call to #> or #<,
preventing modifications if the receiver is frozen inside the
block or by the #> or #< call.

Fixes [Bug #17739]

* Refined portability of test for [Bug #17739]

The order of arguments to callback of qsort is not defined.
That means `a` may not be 3 at all.

* Update a comment about what 'inline' attr means

* Show a backtrace when tool/extlibs.rb fails

I'd like to retry this kind of error, but showing no backtrace is hard
to deal with.
https://github.com/ruby/ruby/runs/2644908002

* Use YAML.safe_load to use the permitted_classes option

* Refactor num_zero_p function (#4522)

* * 2021-05-24 [ci skip]

* [ruby/irb] respect NO_COLOR environment variable

When `NO_COLOR` is set to any non-nil value, output is not colorized.

See https://no-color.org/

ruby/irb@401d0916fe

* [ruby/irb] update test/irb/test_init.rb to avoid useless eval

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

ruby/irb@2dfdc031ec

* Set USE_COLORIZE to the default value in a test

* xibbar is retired from cgi.rb maintainer

* add rb_id2str to lldb debugging scripts

* * 2021-05-25 [ci skip]

* Removed tracer from ruby repo

* Removed dbm from ruby repo

* Revert "Remove .travis.yml" to revive Travis.

This reverts commit 6b978d5.

* .travis.yml: Ubuntu 20.04 Focal Fossa

This is a LTS.  Must be better than Xenial.

* .travis.yml: Update to use arm64/ppc64le/s390x.

* Use only the free pipelines arm64/ppc64le/s390x without credits on Travis.
  See <https://docs.travis-ci.com/user/billing-overview/#partner-queue-solution>.
* Add ppc64le case.
* Update the gcc to gcc-11.
* Remove unused logic.
* Add the `tool/travis_wait.sh` to avoid a command timeout.
* Run the tests skipping some failing tests.
  * Set `TEST_ALL_SKIPPED_TESTS` env to skip the tests.
  * Run the tests separately returning ok status.
    The tests are executed if `TEST_ALL_SKIPPED_TESTS` env is set or
    `TEST_ALL_SEPARATED_TESTS` env is set.
  * Add `tool/ci_functions.sh` to manage the functions used in CI.
* Add arm64 to allow_failures due to the following issue.
  An arm64 job sometimes does not start right now.
  https://travis-ci.community/t/11629

* bootstraptest/test_ractor.rb: Skip an assertion on Travis arm64.

Skip the assertion to test the `Ractor.select` from multiple ractors that rarely
fails on Travis arm64.
See <https://bugs.ruby-lang.org/issues/17878>.

* Removed gdbm from ruby repo

* Update the latest list of default gems for misc/expand_tabs.rb

* Add Travis badge image to `README.md`. [ci skip] (#4527)

Align the order of the badges with ones on the wiki page.
https://bugs.ruby-lang.org/projects/ruby/wiki/CIServers

* Disable compaction on platforms that can't support it

Manual compaction also requires a read barrier, so we need to disable
even manual compaction on platforms that don't support mprotect.

[Bug #17871]

* * 2021-05-26 [ci skip]

* Ignore lib/irb/ext/tracer.rb with TestRequireLib because tracer library was removed from ruby repo

* RSS library is the bundled gems now

* Add Thread#native_thread_id [Feature #17853]

* Add NEWS about 4665515

* Add Thread#native_thread_id [Feature #17853]

* Suppress debug message

* Rescue NotImplementedError for a test of Thread#native_thread_id

http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20210526T070003Z.fail.html.gz
```
  1) Error:
TestThread#test_thread_native_thread_id:
NotImplementedError: native_thread_id() function is unimplemented on this machine
    /export/home/users/chkbuild/cb-gcc/tmp/build/20210526T070003Z/ruby/test/ruby/test_thread.rb:1338:in `native_thread_id'
    /export/home/users/chkbuild/cb-gcc/tmp/build/20210526T070003Z/ruby/test/ruby/test_thread.rb:1338:in `test_thread_native_thread_id'
```

* .travis.yml: Remove skipped tests on ppc64le.

It was fixed at fc832ff .

* Fill out switch statement in push_mark_stack

When objects are popped from the mark stack, we check that the object is
the right type (otherwise an rb_bug happens).  The problem is that when
we pop a bad object from the stack, we have no idea what pushed the bad
object on the stack.

This change makes an error happen when a bad object is pushed on the
mark stack, that way we can track down the source of the bug.

* * 2021-05-27 [ci skip]

* Promote prime to the bundled gems

* Promote matrix to the bundled gems

* Promote net-ftp to the bundled gems

* Promote net-imap to the bundled gems

* Promote net-pop to the bundled gems

* Promote net-smtp to the bundled gems

* Use ruby/rbs#679 for rbs tests on test-bundled-gems

* Defer to require prime for OpenSSL::TestBN

* Guard for the ftp protocol feature of OpenURI

* Guard ruby/spec with spec/mspec/tool/wrap_with_guard.rb

* Update rbs-1.2.1

* Removed dbm from sync_default_gems

* Fixed target directory when copying from upstream

* Fix lazy enumerator with index size

Fixes [Bug #17889]

* * 2021-05-28 [ci skip]

* Use require_relative to use Minitest library for testing.

  There is no reason to care for minitest gem.

* [rubygems/rubygems] Try fix ruby-core CI

* Port
ruby/ruby@8e91b96
from ruby-core, and make it compatible with psych 3 & 4.

* [rubygems/rubygems] Copy files specific to testing rubygems to `test`

rubygems/rubygems@aa390a3500

* [rubygems/rubygems] Require the new files in `test/` relatively

rubygems/rubygems@c77868a555

* [rubygems/rubygems] Remove no longer relevant commentsº

rubygems/rubygems@8dfe1e30b5

* [rubygems/rubygems] Remove no longer needed `RUBYGEMS_TEST_PATH` env variable

rubygems/rubygems@0efb894c3b

* [rubygems/rubygems] Test installing a non deprecated file

rubygems/rubygems@a678959eda

* [rubygems/rubygems] Fix "instance variable not initialized" warning

This variable had a typo (it's `@gemhome`), but the test is still
passing, so I assume it's not needed.

rubygems/rubygems@3b88642bdb

* [rubygems/rubygems] Use pend instead of skip

* Ignore test-bundled-gems on GitHub Actions because matrix tests has unknown issues

* Resolve to missing `Gem::TestCase` issue with random order tests

* Make range literal peephole optimization target "newrange"

It looks for "checkmatch", when it could be applied to anything that has
"newrange".

Making the optimization target more ranges might only be fair play when
all ranges are frozen. So I'm putting a reference to the ticket that
froze all ranges.

[Feature #15504]

* compile.c: Emit send for === calls in when statements

The checkmatch instruction with VM_CHECKMATCH_TYPE_CASE calls
=== without a call cache. Emit a send instruction to make the call
instead. It includes a call cache.

The call cache improves throughput of using when statements to check the
class of a given object. This is useful for say, JSON serialization.

Use of a regular send instead of checkmatch also avoids taking the VM
lock every time, which is good for multi-ractor workloads.

    Calculating -------------------------------------
                             master        post
         vm_case_classes    11.013M     16.172M i/s -      6.000M times in 0.544795s 0.371009s
             vm_case_lit      2.296       2.263 i/s -       1.000 times in 0.435606s 0.441826s
                 vm_case    74.098M     64.338M i/s -      6.000M times in 0.080974s 0.093257s

    Comparison:
                      vm_case_classes
                    post:  16172114.4 i/s
                  master:  11013316.9 i/s - 1.47x  slower

                          vm_case_lit
                  master:         2.3 i/s
                    post:         2.3 i/s - 1.01x  slower

                              vm_case
                  master:  74097858.6 i/s
                    post:  64338333.9 i/s - 1.15x  slower

The vm_case benchmark is a bit slower post patch, possibily due to the
larger instruction sequence. The benchmark dispatches using
opt_case_dispatch so was not running checkmatch and does not make the
=== call post patch.

* * 2021-05-29 [ci skip]

* Fix Enumerator::ArithmeticSequence handling of float ranges

Depending on the float range, there could be an off-by-one error,
where the last result that should be in the range was missed. Fix
this by checking if the computed value for the expected value
outside the range is still inside the range, and if so, increment
the step size.

Fixes [Bug #16612]

* * 2021-05-30 [ci skip]

* Attempt to fix floating point test failure

The previous behavior depending on exact float values, it seemed
to work OK on amd64 and i386, but other CI platforms are
experiencing non-deterministic test failures with it. Relax test
slightly to hopefully pass on such platforms.

* Update bundled_gems

* * 2021-05-31 [ci skip]

* Mark inlined ISeqs during MJIT compilation (#4539)

[Bug #17584]

* [ruby/net-protocol] Bump version to 0.1.1

ruby/net-protocol@97c4b68528

* Tweak skipped files in bundler gemspec

We won't be using the `extra_rdoc_files` field, because it's very slow
for markdown files.

* tool/ci_functions.sh: Fix typos and improve the comment. [ci skip]

* The test for command injection on Unix platforms should be omitted on Windows

* Drop JIT_ISEQ_SIZE_THRESHOLD

Compiling everything seems to contributed to improving the final
performance in general. MJIT's compilation is slow anyway, especially
when you need to wait for JIT compaction.

This might make sense for short-time benchmarks like Optcarrot with
default parameters, but it didn't give benefits in my local environment.

* * 2021-06-01 [ci skip]

* Try enabling VM_ASSERT in --jit CIs

* Decompose the captured_cc code for investigation

I'm investigating SEGVs like https://github.com/ruby/ruby/runs/2715166621?check_suite_focus=true.
Because a lot of things are going on on this line, it's hard to identify
the cause, especially because we can't get the core file of the failures.

Therefore I intentionally increased the number of lines for
investigation.

* Change the default --jit-max-cache to 10000

This is useful for large applications like Rails.
https://k0kubun.medium.com/ruby-3-jit-can-make-rails-faster-756310f235a

* Revert "Try enabling VM_ASSERT in --jit CIs"

This reverts commit e9e3b65.

We were not ready for it
https://github.com/ruby/ruby/runs/2715306375?check_suite_focus=true

* Make --without-mjit-tabs work again

vm_sync.{c,h} don't have tabs

* Enable VM_ASSERT in --jit CIs (#4543)

* Refactor rb_define_class_variable function (#4492)

* Refactor rb_class_path_cached function (#4485)

* Remove unneeded rb_str_initialize defination in internal/string.h (#4465)

* Remove unneeded rb_ary_ptr_use_start defination in internal/array.h (#4427)

* Refactor rb_define_class_variable function (#4400)

* Add static modifier to C function in re.c (#3153)

* add static modifier for rb_reg_eqq func

* add static modifier for rb_check_regexp_type func

* Add static modifier to C function in hash.c (#3138)

* add static modifier for rb_hash_reject_bang func

* add static modifier for rb_hash_reject func

* add static modifier for rb_hash_values_at func

* add static modifier for rb_hash_assoc func

* add static modifier for rb_hash_rassoc func

* Expose assert_all? for ruby/csv repo

* Make `Thread#native_thread_id` not-implemented if unsupported

Raise `NotImplementedError` on unsupported platforms regardless
the argument consistently.

* Use the current object as the compaction index

Instead of keeping track of the current bit plane, keep track of the
actual slot when compacting.  This means we don't need to re-scan
objects inside the same bit plane when we continue with movement

* * 2021-06-02 [ci skip]

* [ruby/rdoc] Add an alias for test-unit with older versions of RubyGems

ruby/rdoc@b8d68fdd87

* [ruby/rdoc] Add a dependency on psych gem 4.0.0 or newer

ruby/rdoc@ebe185c877

* Suppress false warning by MSVC

https://github.com/ruby/ruby/runs/2707566811#step:10:147
```
D:\a\ruby\ruby\src\mjit_worker.c(1212): warning C4090: 'function': different 'const' qualifiers
```

* Clarify these are just for MJIT

and not for third-party libraries.

See: e6484a1

* Refactor rb_vm_insn_addr2insn calls

It's been a way too much amount of ifdefs.

* Skip a `File.atime` test randomly failing on Travis ppc64le.

See <https://bugs.ruby-lang.org/issues/17926>.

* Update to ruby/mspec@0091e8a

* Update to ruby/spec@a0b7d0d

* Update to ruby/spec@c6e9285

* Fix `_MSC_VER` warnings

* * 2021-06-03 [ci skip]

* Allocate exact space for objspace_each_objects

We are only iterating over the eden heap so `heap_eden->total_pages`
contains the exact number of pages we need to allocate for.
`heap_allocated_pages` may contain pages in the tomb.

* use a bool instead of int

* Implemented some NilClass method in Ruby code is faster [Feature #17054] (#3366)

* [rubygems/rubygems] Rename test/rubygems/test_{case,utilities}.rb to avoid "test_" prefix

This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".

The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:

```
t.test_files = FileList['test/**/test_*.rb']
```

Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.

Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.

rubygems/rubygems@6460e018df

* Do not expect ec on rb_vm_bugreport

because a SEGV might happen on an MJIT worker. As you can clearly see
from `if (vm && ec) {`, ec is not guaranteed to exist here.

* Fix a race condition around mjit_recompile

This fixes SEGVs like https://github.com/ruby/ruby/runs/2715166621?check_suite_focus=true.

When mjit_recompile is called when mjit_compile is compiling the exact
same iseq (and after it called mjit_capture_cc_entries), iseq->body->jit_unit
is re-created and its cc_entries becomes NULL. Then, when it tries to
lookup cc_entries through iseq->body->jit_unit, it fails.

* Note about 07c05b6

* Assertions for duplicate literal hash key warnings

* Warn more duplicate literal hash keys

Following non-special_const literals:
* T_BIGNUM
* T_FLOAT (non-flonum)
* T_RATIONAL
* T_COMPLEX

* Warn more duplicate literal hash keys

Following non-special_const literals:
* T_REGEXP

* Do not doubly hold an MJIT lock

This is a follow-up of 86c2625.
CRITICAL_SECTION_START/FINISH are not needed when it's called from an
MJIT worker.

Also, ZALLOC needs to be calloc because ZALLOC may trigger GC, which an
MJIT worker must not do.

* Expose `rb_fiber_transfer` and `rb_fiber_transfer_kw`.

* Suppress clobbered warnings on Travis-CI ppc64le-linux

Co-authored-by: Jeremy Evans <code@jeremyevans.net>
Co-authored-by: git <svn-admin@ruby-lang.org>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: aycabta <aycabta@gmail.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: S.H <gamelinks007@gmail.com>
Co-authored-by: Mark Delk <jethrodaniel@gmail.com>
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: Jun Aruga <jaruga@redhat.com>
Co-authored-by: 卜部昌平 <shyouhei@ruby-lang.org>
Co-authored-by: Jun Aruga <junaruga@users.noreply.github.com>
Co-authored-by: NARUSE, Yui <naruse@airemix.jp>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
Co-authored-by: Daisuke Fujimura (fd0) <booleanlabel@gmail.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants