ruby-changes:54114
From: normal <ko1@a...>
Date: Tue, 11 Dec 2018 18:49:32 +0900 (JST)
Subject: [ruby-changes:54114] normal:r66335 (trunk): test/dtrace: improve diagnostics
normal 2018-12-11 18:49:26 +0900 (Tue, 11 Dec 2018) New Revision: 66335 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66335 Log: test/dtrace: improve diagnostics These will help us track down test failures more easily (on FreeBSD 11.2) Modified files: trunk/test/dtrace/test_array_create.rb trunk/test/dtrace/test_function_entry.rb trunk/test/dtrace/test_hash_create.rb trunk/test/dtrace/test_singleton_function.rb trunk/test/dtrace/test_string.rb Index: test/dtrace/test_function_entry.rb =================================================================== --- test/dtrace/test_function_entry.rb (revision 66334) +++ test/dtrace/test_function_entry.rb (revision 66335) @@ -17,7 +17,7 @@ ruby$target:::method-entry https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_function_entry.rb#L17 row.first == 'Foo' && row[1] == 'foo' } - assert_equal 10, foo_calls.length + assert_equal 10, foo_calls.length, probes line = '3' foo_calls.each { |f| assert_equal line, f[3] } foo_calls.each { |f| assert_equal rb_file, f[2] } @@ -38,7 +38,7 @@ ruby$target:::method-return https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_function_entry.rb#L38 row.first == 'Foo' && row[1] == 'foo' } - assert_equal 10, foo_calls.length + assert_equal 10, foo_calls.length, probes.inspect line = '3' foo_calls.each { |f| assert_equal line, f[3] } foo_calls.each { |f| assert_equal rb_file, f[2] } Index: test/dtrace/test_hash_create.rb =================================================================== --- test/dtrace/test_hash_create.rb (revision 66334) +++ test/dtrace/test_hash_create.rb (revision 66335) @@ -22,11 +22,11 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_hash_create.rb#L22 end def test_hash_lit_elements - trap_probe(probe, '{ :foo => :bar }') { |_,rbfile,saw| - saw = saw.map(&:split).find_all { |num, file, line| + trap_probe(probe, '{ :foo => :bar }') { |_,rbfile,orig| + saw = orig.map(&:split).find_all { |num, file, line| file == rbfile && num == '2' } - assert_operator saw.length, :>, 0 + assert_operator saw.length, :>, 0, orig } end Index: test/dtrace/test_string.rb =================================================================== --- test/dtrace/test_string.rb (revision 66334) +++ test/dtrace/test_string.rb (revision 66335) @@ -4,11 +4,11 @@ require_relative 'helper' https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_string.rb#L4 module DTrace class TestStringProbes < TestCase def test_object_create_start_string_lit - trap_probe(probe, '"omglolwutbbq"') { |_,rbfile,saw| - saw = saw.map(&:split).find_all { |klass, file, line, len| + trap_probe(probe, '"omglolwutbbq"') { |_,rbfile,orig| + saw = orig.map(&:split).find_all { |klass, file, line, len| file == rbfile && len == '12' && line == '1' } - assert_equal(%w{ String }, saw.map(&:first)) + assert_equal(%w{ String }, saw.map(&:first), orig.inspect) assert_equal([rbfile], saw.map { |line| line[1] }) assert_equal(['1'], saw.map { |line| line[2] }) } Index: test/dtrace/test_singleton_function.rb =================================================================== --- test/dtrace/test_singleton_function.rb (revision 66334) +++ test/dtrace/test_singleton_function.rb (revision 66335) @@ -17,7 +17,7 @@ ruby$target:::method-entry https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_singleton_function.rb#L17 row.first == 'Foo' && row[1] == 'foo' } - assert_equal 10, foo_calls.length + assert_equal 10, foo_calls.length, probes.inspect line = '3' foo_calls.each { |f| assert_equal line, f[3] } foo_calls.each { |f| assert_equal rb_file, f[2] } @@ -37,7 +37,7 @@ ruby$target:::method-return https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_singleton_function.rb#L37 row.first == 'Foo' && row[1] == 'foo' } - assert_equal 10, foo_calls.length + assert_equal 10, foo_calls.length, probes.inspect line = '3' foo_calls.each { |f| assert_equal line, f[3] } foo_calls.each { |f| assert_equal rb_file, f[2] } Index: test/dtrace/test_array_create.rb =================================================================== --- test/dtrace/test_array_create.rb (revision 66334) +++ test/dtrace/test_array_create.rb (revision 66335) @@ -14,11 +14,11 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/test_array_create.rb#L14 end def test_many_lit - trap_probe(probe, '[1,2,3,4]') { |_,rbfile,saw| - saw = saw.map(&:split).find_all { |num, file, line| + trap_probe(probe, '[1,2,3,4]') { |_,rbfile,orig| + saw = orig.map(&:split).find_all { |num, file, line| file == rbfile && num == '4' && line == '1' } - assert_operator saw.length, :>, 0 + assert_operator saw.length, :>, 0, orig } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/