test/fiber/test_queue.rb: Make the stuck test fail. (#8791)
test/fiber/test_queue.rb: Make the stuck tests fail. We observed the 2 tests in the `test/fiber/test_queue.rb` getting stuck in some GCC compilers in Ubuntu ppc64le focal/jammy, even when the timeout `queue.pop(timeout: 0.0001)` is set in the code. This commit is to make the tests fail rather than getting stuck.
This commit is contained in:
parent
f7605db8c5
commit
3eaae72855
@ -5,9 +5,10 @@ require_relative 'scheduler'
|
|||||||
class TestFiberQueue < Test::Unit::TestCase
|
class TestFiberQueue < Test::Unit::TestCase
|
||||||
def test_pop_with_timeout
|
def test_pop_with_timeout
|
||||||
queue = Thread::Queue.new
|
queue = Thread::Queue.new
|
||||||
|
kill = false
|
||||||
result = :unspecified
|
result = :unspecified
|
||||||
|
|
||||||
Thread.new do
|
thread = Thread.new do
|
||||||
scheduler = Scheduler.new
|
scheduler = Scheduler.new
|
||||||
Fiber.set_scheduler(scheduler)
|
Fiber.set_scheduler(scheduler)
|
||||||
|
|
||||||
@ -16,17 +17,23 @@ class TestFiberQueue < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
scheduler.run
|
scheduler.run
|
||||||
end.join
|
end
|
||||||
|
until thread.join(2)
|
||||||
|
kill = true
|
||||||
|
thread.kill
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_false(kill, 'Getting stuck due to a possible compiler bug.')
|
||||||
assert_nil result
|
assert_nil result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pop_with_timeout_and_value
|
def test_pop_with_timeout_and_value
|
||||||
queue = Thread::Queue.new
|
queue = Thread::Queue.new
|
||||||
queue.push(:something)
|
queue.push(:something)
|
||||||
|
kill = false
|
||||||
result = :unspecified
|
result = :unspecified
|
||||||
|
|
||||||
Thread.new do
|
thread = Thread.new do
|
||||||
scheduler = Scheduler.new
|
scheduler = Scheduler.new
|
||||||
Fiber.set_scheduler(scheduler)
|
Fiber.set_scheduler(scheduler)
|
||||||
|
|
||||||
@ -35,8 +42,13 @@ class TestFiberQueue < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
scheduler.run
|
scheduler.run
|
||||||
end.join
|
end
|
||||||
|
until thread.join(2)
|
||||||
|
kill = true
|
||||||
|
thread.kill
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_false(kill, 'Getting stuck due to a possible compiler bug.')
|
||||||
assert_equal :something, result
|
assert_equal :something, result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user