@@ -167,6 +167,8 @@ def test_function_as_method
167
167
end
168
168
169
169
def test_nogvl_poll
170
+ require "envutil" unless defined? ( EnvUtil )
171
+
170
172
# XXX hack to quiet down CI errors on EINTR from r64353
171
173
# [ruby-core:88360] [Misc #14937]
172
174
# Making pipes (and sockets) non-blocking by default would allow
@@ -180,13 +182,13 @@ def test_nogvl_poll
180
182
end
181
183
f = Function . new ( poll , [ TYPE_VOIDP , TYPE_INT , TYPE_INT ] , TYPE_INT )
182
184
183
- msec = 200
185
+ msec = EnvUtil . apply_timeout_scale ( 1000 )
184
186
t0 = Process . clock_gettime ( Process ::CLOCK_MONOTONIC , :millisecond )
185
187
th = Thread . new { f . call ( nil , 0 , msec ) }
186
188
n1 = f . call ( nil , 0 , msec )
187
189
n2 = th . value
188
190
t1 = Process . clock_gettime ( Process ::CLOCK_MONOTONIC , :millisecond )
189
- assert_in_delta ( msec , t1 - t0 , 180 , 'slept amount of time' )
191
+ assert_in_delta ( msec , t1 - t0 , EnvUtil . apply_timeout_scale ( 500 ) , 'slept amount of time' )
190
192
assert_equal ( 0 , n1 , perror ( "poll(2) in main-thread" ) )
191
193
assert_equal ( 0 , n2 , perror ( "poll(2) in sub-thread" ) )
192
194
end
0 commit comments