mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_function.rb: fix messages
* test/fiddle/test_function.rb (test_nogvl_poll): fix messages as failed conditions, with errno description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d383426a4c
commit
440f4421ee
1 changed files with 14 additions and 3 deletions
|
@ -86,9 +86,9 @@ module Fiddle
|
||||||
n1 = f.call(nil, 0, msec)
|
n1 = f.call(nil, 0, msec)
|
||||||
n2 = th.value
|
n2 = th.value
|
||||||
t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
||||||
assert_in_delta(msec, t1 - t0, 100, 'slept correct amount of time')
|
assert_in_delta(msec, t1 - t0, 100, 'slept amount of time')
|
||||||
assert_equal(0, n1, 'poll(2) called correctly main-thread')
|
assert_equal(0, n1, perror("poll(2) in main-thread"))
|
||||||
assert_equal(0, n2, 'poll(2) called correctly in sub-thread')
|
assert_equal(0, n2, perror("poll(2) in sub-thread"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_memory_leak
|
def test_no_memory_leak
|
||||||
|
@ -96,5 +96,16 @@ module Fiddle
|
||||||
code = 'begin r.call(a); rescue TypeError; end'
|
code = 'begin r.call(a); rescue TypeError; end'
|
||||||
assert_no_memory_leak(%w[-W0 -rfiddle], "#{prep}\n1000.times{#{code}}", "10_000.times {#{code}}", limit: 1.2)
|
assert_no_memory_leak(%w[-W0 -rfiddle], "#{prep}\n1000.times{#{code}}", "10_000.times {#{code}}", limit: 1.2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def perror(m)
|
||||||
|
proc do
|
||||||
|
if e = Fiddle.last_error
|
||||||
|
m = "#{m}: #{SystemCallError.new(e).message}"
|
||||||
|
end
|
||||||
|
m
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end if defined?(Fiddle)
|
end if defined?(Fiddle)
|
||||||
|
|
Loading…
Reference in a new issue