diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-16 12:14:41 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-16 12:14:41 +0000 |
commit | 81d5b699812dab4048543da77a40372bd4b4045c (patch) | |
tree | 843ceddbc381e0ec03547e79b224622c26c471a7 | |
parent | 4142e34eb17d45450d3f2792f2634e1f5ffb9c9c (diff) |
merge revision(s) 53424,55509: [Backport #12517]
* test/coverage/test_coverage.rb: ignored test when enabled to coverage.
It lead to crash with `make test-all`.
* compile.c (ADD_TRACE): ignore trace instruction on non-positive
line.
* parse.y (coverage): get rid of ArgumentError when the starting
line number is not positive. [ruby-core:76141] [Bug #12517]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | compile.c | 1 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/coverage/test_coverage.rb | 11 | ||||
-rw-r--r-- | version.h | 2 |
5 files changed, 26 insertions, 3 deletions
@@ -1,3 +1,16 @@ +Tue Aug 16 21:12:07 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * compile.c (ADD_TRACE): ignore trace instruction on non-positive + line. + + * parse.y (coverage): get rid of ArgumentError when the starting + line number is not positive. [ruby-core:76141] [Bug #12517] + +Tue Aug 16 21:12:07 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org> + + * test/coverage/test_coverage.rb: ignored test when enabled to coverage. + It lead to crash with `make test-all`. + Tue Aug 16 21:01:55 2016 NARUSE, Yui <naruse@ruby-lang.org> * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque @@ -245,6 +245,7 @@ r_value(VALUE value) #define ADD_TRACE(seq, line, event) \ do { \ if ((event) == RUBY_EVENT_LINE && iseq->coverage && \ + (line) > 0 && \ (line) != iseq->compile_data->last_coverable_line) { \ RARRAY_ASET(iseq->coverage, (line) - 1, INT2FIX(0)); \ iseq->compile_data->last_coverable_line = (line); \ @@ -5454,7 +5454,7 @@ coverage(VALUE fname, int n) { VALUE coverages = rb_get_coverages(); if (RTEST(coverages) && RBASIC(coverages)->klass == 0) { - VALUE lines = rb_ary_tmp_new_fill(n); + VALUE lines = n > 0 ? rb_ary_tmp_new_fill(n) : rb_ary_tmp_new(0); rb_hash_aset(coverages, fname, lines); return lines; } diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb index f4f192a578..3c767c0e58 100644 --- a/test/coverage/test_coverage.rb +++ b/test/coverage/test_coverage.rb @@ -61,4 +61,13 @@ class TestCoverage < Test::Unit::TestCase ensure $".replace loaded_features end -end + + def test_nonpositive_linenumber + bug12517 = '[ruby-core:76141] [Bug #12517]' + Coverage.start + assert_nothing_raised(ArgumentError, bug12517) do + RubyVM::InstructionSequence.compile(":ok", nil, "<compiled>", 0) + end + assert_include Coverage.result, "<compiled>" + end +end unless ENV['COVERAGE'] @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 368 +#define RUBY_PATCHLEVEL 369 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 |