summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2022-09-26This commit implements the Object Shapes technique in CRuby.Jemma Issroff
Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email> Notes: Merged: https://github.com/ruby/ruby/pull/6386
2022-09-26Add several new methods for getting and setting buffer contents. (#6434)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-09-25[Bug #19021] Fix safe call w/ conditional assignJohn Hawthorn
As of fbaac837cfba23a9d34dc7ee144d7940248222a2, when we were performing a safe call (`o&.x=`) with a conditional assign (`||= 1`) and discarding the result the stack would end up in a bad state due to a missing pop. This commit fixes that by adjusting the target label of the branchnil to be before a pop in that case (as was previously done in the non-conditional assignment case). Notes: Merged: https://github.com/ruby/ruby/pull/6437
2022-09-26[ruby/rdoc] Fix ruby script in "test_parse_method_bracket" ↵Yuichiro Kaneko
(https://github.com/ruby/rdoc/pull/927) Because it's syntax error. https://github.com/ruby/rdoc/commit/993f2532ff
2022-09-23Revert "Revert "error.c: Let Exception#inspect inspect its message""Yusuke Endoh
This reverts commit b9f030954a8a1572032f3548b39c5b8ac35792ce. [Bug #18170]
2022-09-22[ruby/reline] use assert_nothing_raisedOtávio Schwanck dos Santos
https://github.com/ruby/reline/commit/f08be5da09
2022-09-22[ruby/reline] PR changesOtávio Schwanck dos Santos
https://github.com/ruby/reline/commit/e8e8d81f47
2022-09-22Enable coverage for eval.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/6396
2022-09-22[ruby/irb] Update expected colorize result that were uncolored beforetompng
https://github.com/ruby/irb/commit/52446eb77f
2022-09-22[ruby/irb] Scan every single characters in IRB::Color.scantompng
https://github.com/ruby/irb/commit/d14e56a65d
2022-09-21[ruby/irb] Fix completion testsStan Lo
https://github.com/ruby/irb/commit/eb1691f636
2022-09-21[ruby/irb] Handle non-String $LOAD_PATH values more carefullyst0012
In addition to String values, $LOAD_PATH can also take objects that respond_to the `to_path` method, like Pathname objects. So `irb` should be able to handle those objects too. And if $LOAD_PATH contains objects that can't be converted into String, `irb` should simply ignore it. https://github.com/ruby/irb/commit/b2f562176b
2022-09-21backup IRBRC environmental variable. It's used by test methods when it's ↵Hiroshi SHIBATA
defined. Notes: Merged: https://github.com/ruby/ruby/pull/6411
2022-09-21Fix the missing locale errorHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/6411
2022-09-20Ignore EPERM which means already being process-leaderNobuyoshi Nakada
2022-09-19Add another test for `Process.daemon`Nobuyoshi Nakada
Check for that the daemon process is detached, that means it is not a child and not waitable. Notes: Merged: https://github.com/ruby/ruby/pull/6402
2022-09-17Skip test_wait on MinGW CITakashi Kokubun
This test has been unstable, and it seems like we're not interested in fixing that for MinGW. https://github.com/ruby/ruby/actions/runs/3073317191/jobs/4965373284
2022-09-17[ruby/irb] Support --noscript option to not use first non-option argument as ↵Jeremy Evans
script Also add --script option to turn the option back on. Previously there wasn't a way to get an interactive IRB session and access arguments provided on the command line. Additionally, handle `-` as script as stdin. In Unix-like tools, `-` means to take standard input instead of a file. This doesn't result in exactly the same output for: ``` echo 'p ARGV' > args.rb; irb args.rb a b c ``` and ``` echo 'p ARGV' | irb - a b c ``` Due to how irb handles whether stdin is a tty. However, this change allows use of `-` as a argument, instead of giving an unrecognized switch error. This required some small changes to context.rb (to handle `-` as standard input) and input-method.rb (to have FileInputMethod accept IO arguments in addition to strings). Implements [Feature #15371] https://github.com/ruby/irb/commit/4192683ba2
2022-09-16Omit a DRb test on MinGWTakashi Kokubun
This test seems to leak a thread and let TestIOWait fail: https://github.com/ruby/ruby/actions/runs/3065426880/jobs/4949517274 DRb almost never seemed to stably work on MinGW. I don't think we intend to fix it either. We should just omit DRb tests when they fail on MinGW.
2022-09-15[rubygems/rubygems] Mask the file mode when extracting filesKevin Newton
When extracting files from the tarball, a mode is retrieved from the header. Occasionally you'll encounter a gem that was packaged on a system whose permission bits result in a value that is larger than the value that File.chmod will allow (anything >= 2^16). In that case the extraction fails with a RangeError, which is pretty esoteric. If you extract the tarball with the tar and gunzip utilities, the file permissions end up being just the bottom 16 bits masked off from the original value. I've mirrored that behavior here. Per the tar spec: > Modes which are not supported by the operating system restoring > files from the archive will be ignored. I think that basically means what I've done here. --- This commit also changes the behavior very slightly with regard to when the chmod is called. Previously it was called while the file descriptor was still open, but after the write call. When write flushes, the file permissions are changed to the mode value from the File.open call, undoing the changes made by FileUtils.chmod. CRuby appears to flush the buffer after the chmod call, whereas TruffleRuby flushes before the chmod call. So the file permissions can change depending on implementation. Both implementations end up getting the correct file permissions for the bottom 9 bits (user, group, world), but differ with regard to the sticky bit in the next 3. To get consistent behavior, this commit changes it to close the file descriptor before attempting to chmod anything, which makes it consistent because the write flushes in both cases. https://github.com/rubygems/rubygems/commit/22ce076e99
2022-09-15[ruby/irb] Refine assertion for failuresNobuyoshi Nakada
https://github.com/ruby/irb/commit/fd047512b3
2022-09-15[ruby/irb] `Dir.mktmpdir` creates a directory including the process IDNobuyoshi Nakada
https://github.com/ruby/irb/commit/a15f68ffdb
2022-09-14[ruby/irb] Fix history file saving with concurrent irb sessions when history ↵Jeremy Evans
file doesn't exist If history file didn't exist when irb was started, @loaded_history_mtime would be nil. However, if the history file didn't exist before, but it exists when saving history, that means the history file was modified, and we should handle it the same way as we handle the other case where the history file was modified. Fixes #388 https://github.com/ruby/irb/commit/8d277aafcb
2022-09-12Remove get_actual_encoding() and the dynamic endian detection for dummy ↵Benoit Daloze
UTF-16/UTF-32 * And simplify callers of get_actual_encoding(). * See [Feature #18949]. * See https://github.com/ruby/ruby/pull/6322#issuecomment-1242758474
2022-09-11[Win32] Negative length `IO#sysread`Jeremy Bopp
Raise `ArgumentError` in `IO#sysread` on Windows when given a negative length. Fixes [Bug #18880] Notes: Merged: https://github.com/ruby/ruby/pull/6354 Merged-By: nobu <nobu@ruby-lang.org>
2022-09-11[ruby/fiddle] Fix PACK_MAP for unsigned types ↵Takashi Kokubun
(https://github.com/ruby/fiddle/pull/110) https://github.com/ruby/fiddle/commit/4a71246645ccff001292c9d80b855b2ef5bf06c1
2022-09-10Deprecate Encoding#replicateBenoit Daloze
* See [Feature #18949].
2022-09-10Enable deprecation warnings for test-allBenoit Daloze
* So deprecated methods/constants/functions are dealt with early, instead of many tests breaking suddenly when removing a deprecated method/constant/function. * Follows https://bugs.ruby-lang.org/issues/17591 Notes: Merged: https://github.com/ruby/ruby/pull/6321
2022-09-09[rubygems/rubygems] Fix resolution on non-musl platformsDavid Rodríguez
Gems without specific platform were being preferred over matching platform specific gems. https://github.com/rubygems/rubygems/commit/37b95b9159
2022-09-09Fix unexpected "duplicated key name" error in paren-less one line pattern ↵Kazuki Tsujimoto
matching [Bug #18990]
2022-09-08Resync Bundler & RubyGemsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/6330
2022-09-07Now Psych uses the proleptic Gregorian calendarNobuyoshi Nakada
2022-09-07[ruby/psych] Dump Date/DateTime as proleptic Gregorian date as well as TimeNobuyoshi Nakada
Fix ruby/psych#572 https://github.com/ruby/psych/commit/92304269bc
2022-09-07fixup 8cd6f2a0872e74c6cc089d2a4f8140483080c67aHiroshi SHIBATA
we should handle ensure block when omit this test
2022-09-07[rubygems/rubygems] Fix: Gem info bug with version flagAntonio Paulino
https://github.com/rubygems/rubygems/commit/e4cee1f975
2022-09-06omit random failure tests with FreeBSDHiroshi SHIBATA
http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220906T043002Z.fail.html.gz http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220905T103002Z.fail.html.gz
2022-09-06Skip test_redefinition_mismatch on trunk-mjit for nowTakashi Kokubun
Investigating: http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20220906-025646 which is not immediately reproducible on my laptop.
2022-09-05Stop testing MJIT on s390xTakashi Kokubun
It didn't work either. http://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20220905T080003Z.fail.html.gz
2022-09-05Merge ↵Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/16c3535413afebcdbab7582c6017c27b5da8a8dc Notes: Merged: https://github.com/ruby/ruby/pull/6326
2022-09-02Consider Complex from Complex casesNobuyoshi Nakada
The assertions that "an argument of a Complex constructor must not be a Complex" may not hold for some Numeric objects. Notes: Merged: https://github.com/ruby/ruby/pull/6317
2022-09-02[Bug #18937] Coerce non-real non-Numeric into Complex at comparisonsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6317
2022-09-01New constant caching insn: opt_getconstant_pathJohn Hawthorn
Previously YARV bytecode implemented constant caching by having a pair of instructions, opt_getinlinecache and opt_setinlinecache, wrapping a series of getconstant calls (with putobject providing supporting arguments). This commit replaces that pattern with a new instruction, opt_getconstant_path, handling both getting/setting the inline cache and fetching the constant on a cache miss. This is implemented by storing the full constant path as a null-terminated array of IDs inside of the IC structure. idNULL is used to signal an absolute constant reference. $ ./miniruby --dump=insns -e '::Foo::Bar::Baz' == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE) 0000 opt_getconstant_path <ic:0 ::Foo::Bar::Baz> ( 1)[Li] 0002 leave The motivation for this is that we had increasingly found the need to disassemble the instructions between the opt_getinlinecache and opt_setinlinecache in order to determine the constant we are fetching, or otherwise store metadata. This disassembly was done: * In opt_setinlinecache, to register the IC against the constant names it is using for granular invalidation. * In rb_iseq_free, to unregister the IC from the invalidation table. * In YJIT to find the position of a opt_getinlinecache instruction to invalidate it when the cache is populated * In YJIT to register the constant names being used for invalidation. With this change we no longe need disassemly for these (in fact rb_iseq_each is now unused), as the list of constant names being referenced is held in the IC. This should also make it possible to make more optimizations in the future. This may also reduce the size of iseqs, as previously each segment required 32 bytes (on 64-bit platforms) for each constant segment. This implementation only stores one ID per-segment. There should be no significant performance change between this and the previous implementation. Previously opt_getinlinecache was a "leaf" instruction, but it included a jump (almost always to a separate cache line). Now opt_getconstant_path is a non-leaf (it may raise/autoload/call const_missing) but it does not jump. These seem to even out. Notes: Merged: https://github.com/ruby/ruby/pull/6187
2022-09-01[ruby/did_you_mean] Fixed correction duplicates in VariableNameCheckerImir Kiyamov
https://github.com/ruby/did_you_mean/commit/c3fc412f6f
2022-09-01[ruby/reline] Support dumb terminalNobuyoshi Nakada
The "dumb" terminal is considered only on MSys tty now. However, the `TERM` feature has been used on many Unix-like systems for decades, not MSys specific. https://github.com/ruby/reline/commit/53fd51ab62
2022-09-01[rubygems/rubygems] Support non gnu libc arm-linux-eabi platformsなつき
https://github.com/rubygems/rubygems/commit/394d7a6fc9
2022-08-31[Bug #18973] Promote US-ASCII to ASCII-8BIT when adding 8-bit charNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6306
2022-08-30[rubygems/rubygems] Let `Dir.tmpdir` use the standard pathDavid Rodríguez
We're not fully in control of this folder, even when running our own tests, because MJIT creates some temp folders there when invoking GC. This bite tests running in ruby-core when making the behavior of `FileUtils.rm_rf` more strict, because these extra files could not be removed. Since this was originally added due to some failures on systems with non standard permissions on tmp folders, but I can no longer reproduce those, I'll remove it. https://github.com/rubygems/rubygems/commit/d2f21596ee
2022-08-29Respect RUBY_TESTOPTS on test-all (https://github.com/Shopify/ruby/pull/435)Takashi Kokubun
* Respect RUBY_TESTOPTS on test-all * Increase the Cirrus timeout * Increase the CSV test timeout Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29A64 Linux reports aarach64 in RUBY_PLATFORMAlan Wu
This should fix a version string test Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Fix test_rubyoptions.rb for arm64 (https://github.com/Shopify/ruby/pull/396)Takashi Kokubun