summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_ractor.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_ractor.rb b/test/ruby/test_ractor.rb
index 611b3b7715..e7eb0cd4b3 100644
--- a/test/ruby/test_ractor.rb
+++ b/test/ruby/test_ractor.rb
@@ -321,6 +321,17 @@ class TestRactor < Test::Unit::TestCase
RUBY
end
+ def test_mn_threads
+ # Ideally, we would assert that vm->ractor.sched.max_cpu equals sysconf(_SC_NPROCESSORS_ONLN)
+ # when RUBY_MAX_CPU is not set.
+ assert_ractor(<<~'RUBY', args: [{ "RUBY_MN_THREADS" => "1" }])
+ require "etc"
+ n = Etc.respond_to?(:nprocessors) ? Etc.nprocessors : 8
+ rs = n.times.map { Ractor.new { :ok } }
+ assert_equal [:ok] * n, rs.map(&:value)
+ RUBY
+ end
+
def test_symbol_proc_is_shareable
pr = :symbol.to_proc
assert_make_shareable(pr)