From 349f6a3275abb0b59d35df44c3d786a4af58449e Mon Sep 17 00:00:00 2001 From: normal Date: Tue, 11 Dec 2018 09:49:26 +0000 Subject: [PATCH] test/dtrace: improve diagnostics These will help us track down test failures more easily (on FreeBSD 11.2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/dtrace/test_array_create.rb | 6 +++--- test/dtrace/test_function_entry.rb | 4 ++-- test/dtrace/test_hash_create.rb | 6 +++--- test/dtrace/test_singleton_function.rb | 4 ++-- test/dtrace/test_string.rb | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/dtrace/test_array_create.rb b/test/dtrace/test_array_create.rb index a7c4687f6f..1bf20085ba 100644 --- a/test/dtrace/test_array_create.rb +++ b/test/dtrace/test_array_create.rb @@ -14,11 +14,11 @@ module DTrace 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 diff --git a/test/dtrace/test_function_entry.rb b/test/dtrace/test_function_entry.rb index 2fac424fe4..0030560d54 100644 --- a/test/dtrace/test_function_entry.rb +++ b/test/dtrace/test_function_entry.rb @@ -17,7 +17,7 @@ ruby$target:::method-entry 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 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] } diff --git a/test/dtrace/test_hash_create.rb b/test/dtrace/test_hash_create.rb index 83a4d0062c..603ee21872 100644 --- a/test/dtrace/test_hash_create.rb +++ b/test/dtrace/test_hash_create.rb @@ -22,11 +22,11 @@ module DTrace 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 diff --git a/test/dtrace/test_singleton_function.rb b/test/dtrace/test_singleton_function.rb index a896b91975..ef1381a321 100644 --- a/test/dtrace/test_singleton_function.rb +++ b/test/dtrace/test_singleton_function.rb @@ -17,7 +17,7 @@ ruby$target:::method-entry 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 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] } diff --git a/test/dtrace/test_string.rb b/test/dtrace/test_string.rb index 407280b1fc..a72f989f63 100644 --- a/test/dtrace/test_string.rb +++ b/test/dtrace/test_string.rb @@ -4,11 +4,11 @@ require_relative 'helper' 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] }) }