summaryrefslogtreecommitdiff
path: root/test/ruby/test_thread_queue.rb
AgeCommit message (Collapse)Author
2023-09-27Make {Queue,SizedQueue}#freeze raise TypeErrorJeremy Evans
Fixes [Bug #17146]
2023-05-22Ensure producer threads do not start running earlyCharles Oliver Nutter
This test caused issues occasionally on JRuby because it's possible for a producer thread to run to completion before the status checks begin. This results in Thread#status returning false and the =~ call triggering a warning (3.1) or error (3.2) and either emitting thousands of deprecation warnings or failing outright. The patch here introduces a mutex that remains locked until all producer threads are seen to have started. The lock is then released and the test proceeds. This prevents any producers from running to completion, which in turn prevents consumers running to completion, avoiding the warnings or error calling =~ on false. This patch also modifies the status checks to to_s the thread status, preventing any prematurely terminated threads from triggering similar deprecation warnings or missing method errors when =~ is called on nil. Notes: Merged: https://github.com/ruby/ruby/pull/7830
2023-05-22Revert "Apply timeout-scale to test_thr_kill." (#7838)Jun Aruga
This reverts commit bbbec4b87c1e66909f5bee9acd3e460b8c1ad663. Because the commit is a bug. The `apply_timeout_scale` to scale the timeout is called 2 times in the process. The `test/ruby/test_thread_queue.rb#test_thr_kill` is calling `EnvUtil.apply_timeout_scale`, and calling `tool/lib/core_assertions.rb#assert_normal_exit`. calling `tool/lib/envutil.rb#invoke_ruby` (`EnvUtil.invoke_ruby`) calling the `apply_timeout_scale`. ``` $ make test-all V=1 TESTS="-v test/ruby/test_thread_queue.rb -n TestThreadQueue#test_thr_kill --timeout-scale=2" ``` Notes: Merged-By: junaruga
2023-05-22Don't leak pipes. (#7820)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-03-24Write keyword arguments directlyNobuyoshi Nakada
`assert_normal_exit` uses keyword arguments since 2013, commit 05dd6b194cc29961a7cecfd5c3852f06dd56a871. Notes: Merged: https://github.com/ruby/ruby/pull/7589
2023-03-10Revert and refine tests for uninitialized queueNobuyoshi Nakada
`Queue` and `SizedQueue` still check array members. Only the test of `ConditionVariable` is useless.
2023-03-10Remove stale testsNobuyoshi Nakada
These tests were added at a198bb3929a4562a12b4aa245a297c7d3695149f, when these classes were `Struct`s. Since these classes have been rewritten, these tests no longer make sense.
2022-08-19Harden SizedQueue#push timeout testNobuyoshi Nakada
2022-08-18Implement SizedQueue#push(timeout: sec)Jean Boussier
[Feature #18944] If both `non_block=true` and `timeout:` are supplied, ArgumentError is raised. Notes: Merged: https://github.com/ruby/ruby/pull/6207
2022-08-03Harden Queue#pop timeout testsJean Boussier
They occasionaly fail with; ``` FLeaked thread: TestThreadQueue#test_queue_pop_timeout: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep> .Finished thread: TestThreadQueue#test_deny_pushers: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 dead> ... Retrying... 1) Failure: TestThreadQueue#test_sized_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:157]: <#<Thread:0x00000001084bc7e8 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:156 sleep>> expected but was <nil>. 2) Failure: TestThreadQueue#test_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:124]: <#<Thread:0x00000001083ff058 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep>> expected but was <nil>. ``` I'm hoping joining for longer should help avoid this. Notes: Merged: https://github.com/ruby/ruby/pull/6210
2022-08-02Implement Queue#pop(timeout: sec)Jean Boussier
[Feature #18774] As well as `SizedQueue#pop(timeout: sec)` If both `non_block=true` and `timeout:` are supplied, ArgumentError is raised. Notes: Merged: https://github.com/ruby/ruby/pull/6185
2022-05-30Also skip failing test with freebsd 12Hiroshi SHIBATA
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-06-29Prefer qualified names under ThreadNobuyoshi Nakada
2021-02-12Thread::Queue.new should accept an Enumerable [Feature #17327]Nobuyoshi Nakada
Enumerable implements #to_a but not #to_array.
2020-08-06Apply timeout-scale to test_thr_kill.Jun Aruga
Notes: Merged: https://github.com/ruby/ruby/pull/3380
2020-02-09test/ruby/test_thread_queue.rb: add a wait to yield a threadYusuke Endoh
On Arch, sending a signal in a loop seems hardly to yield the execution. ``` 1) Error: TestThreadQueue#test_queue_with_trap: Timeout::Error: execution of assert_in_out_err expired timeout (10 sec) ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/arch/ruby-master/log/20200209T120002Z.fail.html.gz This change allows the test to pass.
2019-12-30MinGW on Actions (#2791)MSP-Greg
* MinGW - skip spec in spec/ruby/optional/capi/thread_spec.rb C-API Thread function rb_thread_call_without_gvl -- runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO stops/freezes spec tests See https://bugs.ruby-lang.org/issues/16265 * MinGW - skip test test/resolv/test_dns.rb Test times out in CI (both AppVeyor & Actions), cannot repo locally * MinGW - skip test test/ruby/test_thread_queue.rb * Add Actions mingw.yml
2019-08-30Fix keyword argument separation warnings in testJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-06-30Producer threads check is the primary conditionNobuyoshi Nakada
2019-06-30Fixed non-working testNobuyoshi Nakada
2019-06-30Fixed ClosedQueueError by a timing issueNobuyoshi Nakada
2019-06-30Removed unused variablesNobuyoshi Nakada
2018-10-07appveyor.yml: give up running TestThreadQueue#test_queue_with_trapk0kubun
for mswin. We tried to increase timeout and execute separately but both didn't work. Let me skip this until somebody starts to work on fixing this behavior, since this makes AppVeyor almost impossible to be used as CI. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31Move obsoleted test/thread/test_*.rb with the current implementation.hsbt
* test/ruby/test_thread_{cv,queue}.rb: Move under the test/ruby directory. and rename TestThread* from Test*. * test/test_sync.rb: Move toplevel of test diretory because sync is still standard library. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e