summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2021-10-28Fix leap day with UTC offset [Bug #18274]Nobuyoshi Nakada
`struct vtm::year` is a Ruby integer instance, but not a C integer type. Notes: Merged: https://github.com/ruby/ruby/pull/5041
2021-10-27YJIT: move --yjit-stats at_exit call into RubyAlan Wu
This change fixes `-v --yjit-stats`. Previously in this situation, YJIT._print_stats wasn't defined as yjit.rb is not evaluated when there is only "-v" and no Ruby code to run. Notes: Merged: https://github.com/ruby/ruby/pull/5022
2021-10-27Expect multi-line -v output for -DRUBY_DEVEL in testsAlan Wu
On -DRUBY_DEVEL builds, `ruby -v` can print extra info about the last commit on a separate line, breaking some tests that expect a single line. Assert only the first line instead. Notes: Merged: https://github.com/ruby/ruby/pull/5022
2021-10-27Fix indentation in testAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/5022
2021-10-27YJIT: Support newhash with values (#5029)John Hawthorn
* YJIT: Implement newhash with values * YJIT: Add test of duphash * Fix compilation on macos/clang Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2021-10-26pack.c: add an offset argument to unpack and unpack1Jean Boussier
[Feature #18254] This is useful to avoid repeteadly copying strings when parsing binary formats
2021-10-26Add Class#descendantsJeremy Evans
Doesn't include receiver or singleton classes. Implements [Feature #14394] Co-authored-by: fatkodima <fatkodima123@gmail.com> Co-authored-by: Benoit Daloze <eregontp@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/4974 Merged-By: jeremyevans <code@jeremyevans.net>
2021-10-26[Bug #18264] Fix memory leak in TracePointPeter Zhu
TracePoint leaks memory because it allocates a `rb_tp_t` struct without ever freeing it (it is created with `RUBY_TYPED_NEVER_FREE`). Notes: Merged: https://github.com/ruby/ruby/pull/5008
2021-10-26Make the metaclass of Refinement explicitlyShugo Maeda
Otherwise, singleton methods of Module are not inherited unless Refinement.singleton_class is called.
2021-10-25Strip out YJIT at build time when unsupported or disabled (#5003)Alan Wu
In an effort to minimize build issues on non x64 platforms, we can decide at build time to not build the bulk of YJIT. This should fix obscure build errors like this one on riscv64: yjit_asm.c:137:(.text+0x3fa): relocation truncated to fit: R_RISCV_PCREL_HI20 against `alloc_exec_mem' We also don't need to bulid YJIT on `--disable-jit-support` builds. One wrinkle to this is that the YJIT Ruby module will not be defined when YJIT is stripped from the build. I think that's a fair change as it's only meant to be used for YJIT development. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2021-10-25test/ruby/test_jit.rb: Add a test for checkmatch insnYusuke Endoh
2021-10-25test/ruby/test_jit.rb: Print a hint at exit of the original processYusuke Endoh
Otherwise, the hint is printed whenever fork is called. http://rubyci.s3.amazonaws.com/debian9/ruby-master/log/20211025T093004Z.log.html.gz ``` [20244/21156] TestThread#test_fork_while_lockedyou may want to add tests for following insns, when you have a chance: checkmatch you may want to add tests for following insns, when you have a chance: checkmatch you may want to add tests for following insns, when you have a chance: checkmatch = 0.19 s ```
2021-10-25process.c: Add Process._fork (#5017)Yusuke Endoh
* process.c: Add Process._fork This API is supposed for application monitoring libraries to hook fork event. [Feature #17795] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: mame <mame@ruby-lang.org>
2021-10-25test/ruby/test_rubyvm.rb: prevent "assigned but unused variable" warningsYusuke Endoh
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz ``` [ 4896/21159] TestRubyVM#test_keep_script_lines(none):3: warning: assigned but unused variable - b (none):6: warning: assigned but unused variable - c (none):1: warning: assigned but unused variable - a <compiled>:3: warning: assigned but unused variable - b (none):3: warning: assigned but unused variable - b (none):6: warning: assigned but unused variable - c (none):1: warning: assigned but unused variable - a <compiled>:3: warning: assigned but unused variable - b ```
2021-10-25test/ruby/test_refinement.rb: Prevent deprecation warnings during testYusuke Endoh
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:777: warning: Refinement#include is deprecated and will be removed in Ruby 3.2 /home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:840: warning: Refinement#prepend is deprecated and will be removed in Ruby 3.2 /home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:2620: warning: Refinement#include is deprecated and will be removed in Ruby 3.2 ```
2021-10-25test/ruby/test_marshal.rb: Prevent "assigned but unused variable" warningYusuke Endoh
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_marshal.rb:925: warning: assigned but unused variable - objects ```
2021-10-25Fix `Enumerable#each_cons` and `Enumerable#each_slice` to return a receiverTSUYUSATO Kitsune
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/1509 Merged-By: nobu <nobu@ruby-lang.org>
2021-10-22Disable did_you_mean in TestPatternMatchingYuki Nishijima
2021-10-21Deprecate include/prepend in refinements and add Refinement#import_methods ↵Shugo Maeda
instead Refinement#import_methods imports methods from modules. Unlike Module#include, it copies methods and adds them into the refinement, so the refinement is activated in the imported methods. [Bug #17429] [ruby-core:101639]
2021-10-21freeze (make shareable) script_linesKoichi Sasada
Notes: Merged: https://github.com/ruby/ruby/pull/4913
2021-10-21`RubyVM.keep_script_lines`Koichi Sasada
`RubyVM.keep_script_lines` enables to keep script lines for each ISeq and AST. This feature is for debugger/REPL support. ```ruby RubyVM.keep_script_lines = true RubyVM::keep_script_lines = true eval("def foo = nil\ndef bar = nil") pp RubyVM::InstructionSequence.of(method(:foo)).script_lines ``` Notes: Merged: https://github.com/ruby/ruby/pull/4913
2021-10-20Fix test_version again for RUBY_YJIT_ENABLE=1Takashi Kokubun
2021-10-20Fix tests with cppflags=-DYJIT_FORCE_ENABLETakashi Kokubun
https://github.com/ko1/build-ruby/commit/0dbd95c6250594b6ddadc3c4424b071704083187
2021-10-20Improve YJIT command line option parsingAlan Wu
Previously, options such as "--yjit123" would enable YJIT. Additionally, the error message for argument parsing mentioned "--jit-..." instead of "--yjit-...".
2021-10-20Show +YJIT in version string and RUBY_DESCRIPTIONAlan Wu
There might be code out there that expect `ruby -v` to print only one line. Since MJIT shows +JIT in `ruby -v` and RUBY_DESCRIPTION, let's show +YJIT. The crash report doesn't show anything about MJIT, so adjust the test. The "test_ruby_version" test was unaware of RUBY_YJIT_ENABLE and so was failing when the variable is set and inherited into the children processes it spawns. Explicitly unset the variable in the test.
2021-10-20Implement getclassvariable in yjiteileencodes
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Add a slowpath for opt_getinlinecacheAlan Wu
Before this change, when we encounter a constant cache that is specific to a lexical scope, we unconditionally exit. This change falls back to the interpreter's cache in this situation. This should help constant expressions in `class << self`, which is popular at Shopify due to the style guide. This change relies on the cache being warm while compiling to detect the need for checking the lexical scope for simplicity.
2021-10-20Fix excessive invalidation for opt_getinlinecacheAlan Wu
YJIT expects the VM to invalidate opt_getinlinecache when updating the constant cache, and the invalidation used to happen even when YJIT can't use the cached value. Once the first invalidation happens, the block for opt_getinlinecache becomes a stub. When the stub is hit, YJIT fails to compile the instruction as the cache is not usable. The stub becomes a block that exits for opt_getinlinecache which can be invalidated again. Some workloads that bust the interpreter's constant cache can create an invalidation loop with this behavior. Check if the cache is usable become doing invalidation to fix this problem. In the test harness, evaluate the test script in a lambda instead of a proc so `return` doesn't return out of the harness.
2021-10-20Implement invokebuiltinJohn Hawthorn
2021-10-20Add test for setlocalJohn Hawthorn
2021-10-20Specialize based on types of opt_asetJohn Hawthorn
2021-10-20Add tests against side exits for non-fixnumJohn Hawthorn
2021-10-20Revert "disable yjit when testing mjit"Aaron Patterson
This reverts commit e8622ce5c0a09c7213e4d536ddd0ef3ea68377ef.
2021-10-20Implement getspecialJohn Hawthorn
2021-10-20Add tests against opt_eq side exitsJohn Hawthorn
2021-10-20disable yjit when testing mjitAaron Patterson
2021-10-20Exit when the object is frozenAaron Patterson
Exit when the object is frozen, also add tests
2021-10-20Allow calling variadic cfuncs with many argsJohn Hawthorn
We have a check to ensure we don't have to push args on the stack to call a cfunc with many args. However we never need to use the stack for variadic cfuncs, so we shouldn't care about the number of arguments.
2021-10-20Allow special case of expandarray with nilJohn Hawthorn
2021-10-20Implement newrangeJohn Hawthorn
2021-10-20Implement invokesuper using cfp->ep[ME] checkJohn Hawthorn
This fixes and re-enables invokesuper, replacing the existing guards with a guard on the method entry for the EP.
2021-10-20Avoid immediate side exits in checktypeJohn Hawthorn
Previously checktype only supported heap objects, however it's not uncommon to receive an immediate, for example when string interpolating a Symbol or Integer.
2021-10-20Add toregexp to yjiteileencodes
The FIXME is there so we remember to investigate why insns clears the temporary array. Is this necessary? If it's not we can remove it from both. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Implement putspecialobjectJohn Hawthorn
2021-10-20Add opt_regexpmatch2John Hawthorn
2021-10-20Implement tostring instruction for yjiteileencodes
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Add regression test of invalid mapping mergeJohn Hawthorn
This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES.
2021-10-20Add setglobal to yjiteileencodes
Adds yjit support for setting global variables. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-10-20Fix and uncomment getlocal testJohn Hawthorn
Previously, under the scraper, this would side-exit because it was returning to a C method. Now that we use the jit_func entrypoint, this test no longer side-exits.
2021-10-20Add flag so we can easily tell if all stats avail. Comment out broken test.Maxime Chevalier-Boisvert