summaryrefslogtreecommitdiff
path: root/bootstraptest/test_thread.rb
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-06-19 17:53:52 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-06-19 20:39:10 +1200
commit69195fd9b26d4585ad0d13d45ce9fd7b7ebac154 (patch)
tree5a36cf11e5da2d3a695f32f88ad1b1545b32cea8 /bootstraptest/test_thread.rb
parent3fd83cb6fcc483d2eac0795bc139c521a3a59bd2 (diff)
Show thread and fiber limits as part of bootstrap tests.
Diffstat (limited to 'bootstraptest/test_thread.rb')
-rw-r--r--bootstraptest/test_thread.rb26
1 files changed, 24 insertions, 2 deletions
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb
index 854065f87e..319f9ca625 100644
--- a/bootstraptest/test_thread.rb
+++ b/bootstraptest/test_thread.rb
@@ -1,5 +1,27 @@
-# Thread and Fiber
-
+show_limit %q{
+ threads = []
+ begin
+ threads << Thread.new{sleep}
+
+ raise Exception, "skipping" if threads.count >= 10_000
+ rescue Exception => error
+ puts "Thread count: #{threads.count} (#{error})"
+ break
+ end while true
+}
+show_limit %q{
+ fibers = []
+ begin
+ fiber = Fiber.new{Fiber.yield}
+ fiber.resume
+ fibers << fiber
+
+ raise Exception, "skipping" if fibers.count >= 10_000
+ rescue Exception => error
+ puts "Fiber count: #{fibers.count} (#{error})"
+ break
+ end while true
+}
assert_equal %q{ok}, %q{
Thread.new{
}.join