aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
Commit message (Collapse)AuthorAgeFilesLines
* string.c: fix memory leak in rb_str_change_terminator_length()work2Kazuki Yamaguchi2017-11-121-0/+11
| | | | | str_make_independent_expand() cannot be used for a String that has its own buffer.
* TracePoint.new: raise ArgumentError when no block given [#14074]marcandre2017-11-091-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix backtrace on argment error.ko12017-11-091-0/+27
| | | | | | | | | | | * vm_backtrace.c (rb_backtrace_use_iseq_first_lineno_for_last_location): added. It modifies last location's line as corresponding iseq's first line number. * vm_args.c (raise_argument_error): use added function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix peephole optimization.ko12017-11-091-0/+7
| | | | | | | | | | | | * compile.c (iseq_peephole_optimize): do not need to put `pop` instruction. * test/ruby/test_optimization.rb (test_peephole_optimization_without_trace): This code "def foo; 1.times{|(a), &b| nil && a}; end" fails to compile by stack underflow because of above bug (fixed by this patch). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* disable GC.ko12017-11-071-4/+9
| | | | | | | | * test/ruby/test_io.rb (test_write_no_garbage): malloc can cause GC and it will reduce string object counts. So disable GC during this test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: check argument firstnobu2017-11-052-1/+5
| | | | | | | * enum.c (enum_cycle_size): check an argument before the size of the receiver, if it is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_lazy_enumerator.rb: test for [Bug #14082]nobu2017-11-051-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix size on Enumerable#cycle when the size is 0 [Bug #14082].marcandre2017-11-051-0/+7
| | | | | | Patch by Kenichi Kamiya git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_io.rb (test_write_no_garbage): Add detailed messagemame2017-11-041-1/+1
| | | | | | | | I saw this test failed once. There is no problem if `before > after` but we cannot check it. To allow diagnosis in future, the detailed message is added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_eval.rb: use orphan procsnobu2017-11-031-3/+10
| | | | | | | This failure has been hidden by the bug of assert_raise which is fixed at r60614. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip/fix wrong testsnobu2017-11-022-1/+9
| | | | | | | * test/ruby/test_{class,eval}.rb: skip or fix wrong tests hidden by a bug of assert_raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: kw splat after splatnobu2017-11-021-0/+6
| | | | | | | * compile.c (setup_args): set keyword splat flag after splat arguments. [ruby-core:83638] [Bug #10856] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_syntax.rb: all assertionsnobu2017-11-011-6/+7
| | | | | | | * test/ruby/test_syntax.rb (test_return_toplevel): try all assertions even if any assertions failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: infect from argumentsnobu2017-11-011-0/+20
| | | | | | | | * file.c (rb_check_realpath_internal): infetct the result with arguments, no taint if none are tainted and cwd is not used. [ruby-core:83583] [Bug #14060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r60596 because it cause faulure on TestFile#test_realpath_taintednessko12017-11-011-17/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: infect from argumentsnobu2017-11-011-0/+17
| | | | | | | | * file.c (rb_check_realpath_internal): infetct the result with arguments, no taint if none are tainted and cwd is not used. [ruby-core:83583] [Bug #14060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: ensure after return in library toplevelnobu2017-10-311-5/+16
| | | | | | | | | | * compile.c (compile_return): execute ensure clause after toplevel return even in library toplevel other than the main script. [ruby-core:83589] [Bug #14061] test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: honor buffered modenobu2017-10-291-0/+9
| | | | | | | | * io.c (io_writev): honor buffered mode to get rid of broken pipe error when stdout is redirected to a pipeline. [ruby-core:83578] [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: convert to string at writevnobu2017-10-291-0/+4
| | | | | | | | * io.c (io_fwritev): needs conversion to string before accessing the content, as well as single argument case, not to segfault. [Feature #9323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip tests temporarilyko12017-10-271-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix IO.copy_stream on O_APPEND destination on Linuxnormal2017-10-271-0/+10
| | | | | | | | | | | | | Linux copy_file_range(2) fails with EBADF if the destination FD has O_APPEND set. Preserve existing (Ruby <= 2.4) behavior by falling back to alternative copy mechanisms if this is the case (instead of raising Errno::EBADF). * io.c (nogvl_copy_file_range): do not raise on O_APPEND dst * test/ruby/test_io.rb (test_copy_stream_append): new test [Feature #13867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Revert "Manage AST NODEs out of GC""mame2017-10-271-0/+3
| | | | | | | This re-introduces r60485. This reverts commit 5a176b75b1187cbd3861c387bde65ff66396a07c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Manage AST NODEs out of GC"mame2017-10-271-3/+0
| | | | | | This reverts commit 620ba74778bfdbdc34ffbb142d49ce84a0ef58e9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Manage AST NODEs out of GCmame2017-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NODEs in AST are no longer objects managed by GC. This change will remove the restriction imposed by the GC. For example, a NODE can use more than five words (this is my primary purpose; we want to store the position data for each NODE, for coverage library), or even a NODE can have variable length (some kinds of NODEs have unused fields). To do this, however, we need more work, since Ripper still uses T_NODE objects managed by the GC. The life time of NODEs is more obvious than other kinds of objects; they are created at parsing, and they become disused immediately after compilation. This change releases all NODEs by a few `xfree`s after compilation, so performance will be improved a bit. In extreme example, `eval("x=1;" * 10000000)` runs much faster (40 sec. -> 7.8 sec. on my machine). The most important part of this change is `ast_t` struct, which has three contents: (1) NODE buffer (malloc'ed memory), (2) a reference to the root NODE, and (3) an array that contains objects that must be marked during parsing (such as literal objects). Some functions that had received `NODE*` arguments, must now receive `ast_t*`. * node.c, node.h: defines `ast_t` struct and related operations. * gc.c, internal.h: defines `imemo_ast`. * parse.y: makes `parser_params` struct have a reference to `ast_t`. Instead of `rb_node_newnode`, use `rb_ast_newnode` to create a NODE. * iseq.c, load.c, ruby.c, template/prelude.c.tmpl: modifies some functions to handle `ast_t*` instead of `NODE*`. * test/ruby/test_gc.rb: ad-hoc fix for a failed test. The test assumes GC eden is increased at startup by NODE object creation. However, this change now create no NODE object, so GC eden is not necessarily increased. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]"naruse2017-10-272-8/+4
| | | | | | | | This reverts commit r60341,r60342,r60344,r60345. Breaking compabitility of the order of result breaks many tests. To avoid such effort to fix tests, the order should be kept. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* make root fiber at switching.ko12017-10-261-1/+0
| | | | | | | | | | * cont.c (fiber_switch): make sure the root fiber object is available before the first switching. * test/ruby/test_fiber.rb: remove "skip". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip test_fiber_transfer_segv because it cause error with previous commitko12017-10-261-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_env.rb: fix one-off bugnobu2017-10-261-1/+1
| | | | | | | * test/ruby/test_env.rb (TestEnv#test_win32_blocksize): count the terminator byte too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* TracePoint#enable, #disable: Don't yield any argument. [Bug #14057]marcandre2017-10-261-2/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_io.rb: skip writev testnobu2017-10-251-0/+1
| | | | | | | * test/ruby/test_io.rb (TestIO#test_puts_parallel): skip a test needs writev which is not portable. [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: warn old writenobu2017-10-251-0/+16
| | | | | | | * io.c (rb_io_puts): warn if write method accepts just one argument. [ruby-core:83529] [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: write a newline togethernobu2017-10-251-0/+13
| | | | | | | | * io.c (rb_io_puts): write a newline together at once for each argument. based on the patch by rohitpaulk (Rohit Kuruvilla) at [ruby-core:83508]. [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c: use rb_check_funcallnobu2017-10-251-0/+3
| | | | | | | | | * range.c (rb_range_values): use rb_check_funcall instead of calling rb_respond_to then rb_funcall, and allow `begin` and `end` to be private as well as other internal conversions. [ruby-core:83541] [Bug #14048] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c: check if exclude_end? is definednobu2017-10-252-1/+14
| | | | | | | | | * range.c (rb_range_values): should raise TypeError if necessary method is not defined, not NoMethodError, when trying to tell if the object is a Range and extract info. [ruby-core:83541] [Bug #14048] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Test for r60396nobu2017-10-241-0/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Lazy Proc allocation for block parametersko12017-10-241-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Feature #14045] * insns.def (getblockparam, setblockparam): add special access instructions for block parameters. getblockparam checks VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM and if it is not set this instruction creates a Proc object from a given blcok and set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM. setblockparam is similar to setlocal, but set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM. * compile.c: use get/setblockparm instead get/setlocal instructions. Note that they are used for method local block parameters (def m(&b)), not for block local method parameters (iter{|&b|). * proc.c (get_local_variable_ptr): creates Proc object for Binding#local_variable_get/set. * safe.c (safe_setter): we need to create Proc objects for postponed block parameters when $SAFE is changed. * vm_args.c (args_setup_block_parameter): used only for block local blcok parameters. * vm_args.c (vm_caller_setup_arg_block): if called with VM_CALL_ARGS_BLOCKARG_BLOCKPARAM flag then passed block values should be a block handler. * test/ruby/test_optimization.rb: add tests. * benchmark/bm_vm1_blockparam*: added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix infinite retrynobu2017-10-231-0/+10
| | | | | | | * io.c (io_binwritev): fix infinite retry when flushing buffered data. [Feature #9323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix buffered outputnobu2017-10-231-0/+14
| | | | | | | * io.c (io_binwritev): append to buffered data, not overwriting. [Feature #9323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: no restrictionnobu2017-10-231-13/+7
| | | | | | | * io.c (io_write_m): remove argc restriction upto IOV_MAX-1. [Feature #9323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed misspelling words.hsbt2017-10-225-7/+7
| | | | | | These are detected by https://github.com/client9/misspell git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix a target method of a testyui-knk2017-10-221-1/+1
| | | | | | | | | * test/ruby/test_string.rb (test_delete): I guess this line should be a test case which asserts coderange is handled correctly when a result of String#delete has non-ASCII characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sort test resultnaruse2017-10-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Make IO#write accept multiple argumentsglass2017-10-221-0/+26
| | | | | | | io.c: make IO#write accept multiple arguments. it uses writev(2) if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sort the test resultnaruse2017-10-221-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]naruse2017-10-222-1/+5
| | | | | | The order of resulted array is changed in some cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: workaround for warningsnobu2017-10-221-0/+1
| | | | | | | * parse.y (mark_lvar_used): enable workaround to suppress unused local variables. [ruby-core:82656] [Bug #13872] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add arity check into Hash#flattenglass2017-10-221-1/+6
| | | | | | * hash.c (rb_hash_flatten): add arity check git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typo in commentsonots2017-10-211-3/+3
| | | | | | | * test/ruby/test_transcode.rb: fix typo in comment patched by larskanis (Lars Kanis) [GH-1681] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Improve performance of string interpolationnobu2017-10-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch will add pre-allocation in string interpolation. By this, unecessary capacity resizing is avoided. For small strings, optimized `rb_str_resurrect` operation is faster, so pre-allocation is done only when concatenated strings are large. `MIN_PRE_ALLOC_SIZE` was decided by experimenting with local machine (x86_64-apple-darwin 16.5.0, Apple LLVM version 8.1.0 (clang - 802.0.42)). String interpolation will be faster around 72% when large string is created. * Before ``` Calculating ------------------------------------- Large string interpolation 1.276M (± 5.9%) i/s - 6.358M in 5.002022s Small string interpolation 5.156M (± 5.5%) i/s - 25.728M in 5.005731s ``` * After ``` Calculating ------------------------------------- Large string interpolation 2.201M (± 5.8%) i/s - 11.063M in 5.043724s Small string interpolation 5.192M (± 5.7%) i/s - 25.971M in 5.020516s ``` * Test code ```ruby require 'benchmark/ips' Benchmark.ips do |x| x.report "Large string interpolation" do |t| a = "Hellooooooooooooooooooooooooooooooooooooooooooooooooooo" b = "Wooooooooooooooooooooooooooooooooooooooooooooooooooorld" t.times do "#{a}, #{b}!" end end x.report "Small string interpolation" do |t| a = "Hello" b = "World" t.times do "#{a}, #{b}!" end end end ``` [Fix GH-1626] From: Nao Minami <south37777@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "ignore server side error"naruse2017-10-211-1/+1
| | | | | | This reverts commit r60314. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e