mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									785ace12f9
								
							
						
					
					
						commit
						349f6a3275
					
				
					 5 changed files with 13 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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] })
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue