summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2020-04-18Skip a too-unstable test on s390x-linuxTakashi Kokubun
In the last 26-ish hours, it has failed 5 times: https://travis-ci.org/github/ruby/ruby/jobs/676497718 https://travis-ci.org/github/ruby/ruby/jobs/676480295 https://travis-ci.org/github/ruby/ruby/jobs/676103216 https://travis-ci.org/github/ruby/ruby/jobs/676057967 https://travis-ci.org/github/ruby/ruby/jobs/676055113 and I don't think anybody has been working on it right now. To make CI result report of s390x-linux useful, let's skip it until the test is improved to be more stable.
2020-04-18test/ruby/test_jit_debug.rb: Skip unsupported platformsYusuke Endoh
2020-04-17test/ruby/test_process.rb: Skip GID.from_name on AndroidYusuke Endoh
The user management on Android seems very different https://rubyci.org/logs/rubyci.s3.amazonaws.com/android28-x86_64/ruby-master/log/20200416T234122Z.fail.html.gz
2020-04-16Preserve encoding in error messages for invalid user/group nameNobuyoshi Nakada
2020-04-16Added tests for Process::UID.from_name and Process::GID.from_nameNobuyoshi Nakada
2020-04-16Preserve encoding in error message for invalid env exec optionNobuyoshi Nakada
2020-04-16Added test for invalid env exec optionNobuyoshi Nakada
2020-04-15Added test for `debug_level:` option of `RubyVM::InstructionSequence.compile`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3033
2020-04-14This test is not testing attr_writerTakashi Kokubun
2020-04-14Invalidate fastpath when calling attr_reader by superTakashi Kokubun
The same bug as 8355a99883 existed in attr_reader too.
2020-04-14Invalidate fastpath when calling attr_writer by superTakashi Kokubun
We started to use fastpath on invokesuper when a method is not refinements since 5c27681813, but we shouldn't have used fastpath for attr_writer either. `cc->aux_.attr_index` is for an actual receiver class, while we store its superclass in `cc->klass` and therefore there's no way to properly invalidate attr_writer's inline cache when it's called by super. [Bug #16785] I suspect the same bug also exists in attr_reader. I'll address that in another commit.
2020-04-15Disallow line-continuation before R-assignNobuyoshi Nakada
2020-04-13Allow simple R-assign in endless defNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3025
2020-04-12Relaxed of R-assign value to argNobuyoshi Nakada
2020-04-11Assertions for basic use of `encoding:` optionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-04-11Assertions for enumerators of DirNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-04-11Removed unnecessary `to_a` callNobuyoshi Nakada
`Dir.entries` returns an array. Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-04-11Silence broken pipe error messages on STDOUT [Feature #14413]Nobuyoshi Nakada
Raise `SignalException` for SIGPIPE to abort when EPIPE occurs. Notes: Merged: https://github.com/ruby/ruby/pull/3013 Merged-By: nobu <nobu@ruby-lang.org>
2020-04-10Endless method definition [Feature #16746]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2996
2020-04-10Rightward-assign by ASSOCNobuyoshi Nakada
[Feature #15921] Notes: Merged: https://github.com/ruby/ruby/pull/3012
2020-04-08Fixed formatted substring expansion [Bug #16767]Nobuyoshi Nakada
2020-04-07Fix source location of autoloaded constant [Bug #16764]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3009
2020-03-30Optimize exivar access on JIT-ed getivarTakashi Kokubun
JIT support of dd723771c11. $ benchmark-driver -v --rbenv 'before;before --jit;after --jit' benchmark/mjit_exivar.yml --repeat-count=4 before: ruby 2.8.0dev (2020-03-30T12:32:26Z master e5db3da9d3) [x86_64-linux] before --jit: ruby 2.8.0dev (2020-03-30T12:32:26Z master e5db3da9d3) +JIT [x86_64-linux] after --jit: ruby 2.8.0dev (2020-03-31T05:57:24Z mjit-exivar 128625baec) +JIT [x86_64-linux] Calculating ------------------------------------- before before --jit after --jit mjit_exivar 57.944M 53.579M 54.471M i/s - 200.000M times in 3.451588s 3.732772s 3.671687s Comparison: mjit_exivar before: 57944345.1 i/s after --jit: 54470876.7 i/s - 1.06x slower before --jit: 53579483.4 i/s - 1.08x slower
2020-03-28Clean up /tmp leftovers in ci.rvm.jpTakashi Kokubun
2020-03-27Set external encoding correctly for File.open('f', FILE::BINARY) on WindowsJeremy Evans
Previously, the external encoding was only set correctly for File::BINARY if keyword arguments were provided. This copies the logic for the keyword arguments case to the no keyword arguments case. Possibly it should be refactored into a separate function. Fixes [Bug #16737] Notes: Merged: https://github.com/ruby/ruby/pull/2985
2020-03-25Fixed crash when argument array is modifiedNobuyoshi Nakada
2020-03-24test/json/test_helper.rb: Do not add a relative path to $LOAD_PATHYusuke Endoh
... because it conflicts with test/ruby/test_m17n.rb. An exception `incompatible character encodings: UTF-8 and UTF-16BE` occurs when: * a non-existence relative path is added to $LOAD_PATH, * ASCII-incompatible encoding is set to default_external, and * some file is loaded. ``` $LOAD_PATH << "no_existing_dir" Encoding.default_external = Encoding::UTF_16BE load "dummy.rb" #=> incompatible character encodings: UTF-8 and UTF-16BE ``` This issue can be actually observed by a combination of out-of-place build and the following command: make test-all TESTS="json ruby/m17n -n test_object_inspect_external" http://ci.rvm.jp/logfiles/brlog.trunk-test-random.20200322-221411 ASCII-incompatible default external encoding assumes that the cwd is the encoding, and it is attempted to beconcatenated with a non-existence relative LOAD_PATH UTF-8 string, which causes the exception. This changeset avoids a relative path.
2020-03-23test/ruby/test_m17n.rb: Update the debugging code to get C stacktraceYusuke Endoh
2020-03-23test/ruby/test_m17n.rb: Make the debugging code print to stderrYusuke Endoh
The test is executed with -j8, so printing someting to stdout may break.
2020-03-22Merge pull request #2721 from jeremyevans/method-inspect-chain-alias-11188Jeremy Evans
Correctly show defined class for aliases of aliases Notes: Merged-By: jeremyevans <code@jeremyevans.net>
2020-03-22Support obj.clone(freeze: true) for freezing cloneJeremy Evans
This freezes the clone even if the receiver is not frozen. It is only for consistency with freeze: false not freezing the clone even if the receiver is frozen. Because Object#clone is now partially implemented in Ruby and not fully implemented in C, freeze: nil must be supported to provide the default behavior of only freezing the clone if the receiver is frozen. This requires modifying delegate and set, to set freeze: nil instead of freeze: true as the keyword parameter for initialize_clone. Those are the two libraries in stdlib that override initialize_clone. Implements [Feature #16175] Notes: Merged: https://github.com/ruby/ruby/pull/2969
2020-03-22test/ruby/test_m17n.rb: Add a temporal code for debuggingYusuke Endoh
http://ci.rvm.jp/logfiles/brlog.trunk-test-random.20200322-221411 ``` I, [2020-03-22T22:15:50.761950 #23076] INFO -- : 1) Error: I, [2020-03-22T22:15:50.761963 #23076] INFO -- : TestM17N#test_object_inspect_external: I, [2020-03-22T22:15:50.761974 #23076] INFO -- : Encoding::CompatibilityError: incompatible character encodings: UTF-8 and UTF-16BE ```
2020-03-22test/ruby/test_fiber.rb (test_many_fibers_with_threads): relax timeoutYusuke Endoh
This test takes 40..50 seconds under Solaris 11, so the timeout (60 seconds) was too strict. This change increases it to 180 seconds. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20200322T100007Z.fail.html.gz ``` 1) Error: TestFiber#test_many_fibers_with_threads: Timeout::Error: execution of assert_normal_exit expired timeout (60 sec) ```
2020-03-18Ignore TestJITDebug in mswin RubyCI for nowTakashi Kokubun
It's still pending to be implemented. To be enabled later when it's implemented.
2020-03-17Reduce allocations for keyword argument hashesJeremy Evans
Previously, passing a keyword splat to a method always allocated a hash on the caller side, and accepting arbitrary keywords in a method allocated a separate hash on the callee side. Passing explicit keywords to a method that accepted a keyword splat did not allocate a hash on the caller side, but resulted in two hashes allocated on the callee side. This commit makes passing a single keyword splat to a method not allocate a hash on the caller side. Passing multiple keyword splats or a mix of explicit keywords and a keyword splat still generates a hash on the caller side. On the callee side, if arbitrary keywords are not accepted, it does not allocate a hash. If arbitrary keywords are accepted, it will allocate a hash, but this commit uses a callinfo flag to indicate whether the caller already allocated a hash, and if so, the callee can use the passed hash without duplicating it. So this commit should make it so that a maximum of a single hash is allocated during method calls. To set the callinfo flag appropriately, method call argument compilation checks if only a single keyword splat is given. If only one keyword splat is given, the VM_CALL_KW_SPLAT_MUT callinfo flag is not set, since in that case the keyword splat is passed directly and not mutable. If more than one splat is used, a new hash needs to be generated on the caller side, and in that case the callinfo flag is set, indicating the keyword splat is mutable by the callee. In compile_hash, used for both hash and keyword argument compilation, if compiling keyword arguments and only a single keyword splat is used, pass the argument directly. On the caller side, in vm_args.c, the callinfo flag needs to be recognized and handled. Because the keyword splat argument may not be a hash, it needs to be converted to a hash first if not. Then, unless the callinfo flag is set, the hash needs to be duplicated. The temporary copy of the callinfo flag, kw_flag, is updated if a hash was duplicated, to prevent the need to duplicate it again. If we are converting to a hash or duplicating a hash, we need to update the argument array, which can including duplicating the positional splat array if one was passed. CALLER_SETUP_ARG and a couple other places needs to be modified to handle similar issues for other types of calls. This includes fairly comprehensive tests for different ways keywords are handled internally, checking that you get equal results but that keyword splats on the caller side result in distinct objects for keyword rest parameters. Included are benchmarks for keyword argument calls. Brief results when compiled without optimization: def kw(a: 1) a end def kws(**kw) kw end h = {a: 1} kw(a: 1) # about same kw(**h) # 2.37x faster kws(a: 1) # 1.30x faster kws(**h) # 2.19x faster kw(a: 1, **h) # 1.03x slower kw(**h, **h) # about same kws(a: 1, **h) # 1.16x faster kws(**h, **h) # 1.14x faster Notes: Merged: https://github.com/ruby/ruby/pull/2945
2020-03-17Make {**{}} return unfrozen empty hashJeremy Evans
Previously, method call keyword splats and hash keyword splats were compiled exactly the same. This is because parse-wise, they operate on indentical nodes when it comes to compiling the **{}. Fix this by using an ugly hack of temporarily modifying the nd_brace flag in the method call keyword splat case. Inside compile_hash, only optimize the **{} case for hashes where the nd_brace flag has been modified to reflect we are in the method call keyword splat case and it is safe to do so. Since compile_keyword_args is only called in one place, move the keyword_node_p call out of that method to the single caller to avoid duplicating the code. Notes: Merged: https://github.com/ruby/ruby/pull/2945
2020-03-16`Proc` made by `Hash#to_proc` should be a lambda [Bug #12671]Yusuke Endoh
Like `Symbol#to_proc` (f0b815dc670b61eba1daaa67a8613ac431d32b16)
2020-03-16hash.c: Do not use the fast path (rb_yield_values) for lambda blocksYusuke Endoh
As a semantics, Hash#each yields a 2-element array (pairs of keys and values). So, `{ a: 1 }.each(&->(k, v) { })` should raise an exception due to lambda's arity check. However, the optimization that avoids Array allocation by using rb_yield_values for blocks whose arity is more than 1 (introduced at b9d29603375d17c3d1d609d9662f50beaec61fa1 and some commits), seemed to overlook the lambda case, and wrongly allowed the code above to work. This change experimentally attempts to make it strict; now the code above raises an ArgumentError. This is an incompatible change; if the compatibility issue is bigger than our expectation, it may be reverted (until Ruby 3.0 release). [Bug #12706]
2020-03-14Resurrect test_jit_debug.rbTakashi Kokubun
Revert "Temporarily drop test_jit_debug.rb" This reverts commit 5437d7c879585fbdb0c294298eb76cc563e01c69. Skipped some CIs which were failing previously.
2020-03-11fix bug on method cache invalidation.Koichi Sasada
To invalidate cached method entry, existing method entry (ment) is marked as invalidated and replace with copied ment. However, complemented method entry (method entries in Module) should not be set to Module's m_tbl. [Bug #16669]
2020-03-09Don't display singleton class in Method#inspect unless method defined thereJeremy Evans
Previously, if an object has a singleton class, and you call Object#method on the object, the resulting string would include the object's singleton class, even though the method was not defined in the singleton class. Change this so the we only show the singleton class if the method is defined in the singleton class. Fixes [Bug #15608] Notes: Merged: https://github.com/ruby/ruby/pull/2949 Merged-By: jeremyevans <code@jeremyevans.net>
2020-03-08Do not autosplat when calling procs that accept rest and keywordsJeremy Evans
When providing a single array to a block that takes a splat, pass the array as one argument of the splat instead of as the splat itself, even if the block also accepts keyword arguments. Previously, this behavior was only used for blocks that did not accept keywords. Implements [Feature#16166] Notes: Merged: https://github.com/ruby/ruby/pull/2502
2020-03-07Removed unnecessary `chomp`Nobuyoshi Nakada
As `String#split` with the default argument drops trailing newline as a separator, preceding `String#chomp` is futile.
2020-03-06Propagate JIT skip to all testsTakashi Kokubun
2020-03-07check ar_table after `#hash` callKoichi Sasada
ar_table can be converted to st_table just after `ar_do_hash()` function which calls `#hash` method. We need to check the representation to detect this mutation. [Bug #16676]
2020-03-06Skip jit_test on some new RubyCI envs for nowTakashi Kokubun
2020-03-04fix 6e271e4cbbe6a8bc4d4f75dc553ce054eae7af00Koichi Sasada
2020-03-04Run major GC to make sure the minor GC reasonKoichi Sasada
GC.latest_gc_info[:major_by] can return `oldmalloc` because of last GC status.
2020-03-04Run major GC to make sure the minor GC next time.Koichi Sasada
`GC.start(full_mark: false)` can run full GC because of last GC status. Just after major GC, the possibility to run major GC next time is too small (not a zero, but too small possibility).
2020-03-03Don't tweak RubyVM compile options if it's not definedCharles Oliver Nutter