summaryrefslogtreecommitdiff
path: root/bootstraptest/test_thread.rb
diff options
context:
space:
mode:
Diffstat (limited to 'bootstraptest/test_thread.rb')
-rw-r--r--bootstraptest/test_thread.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb
index 121def8b42..c2b2b8ce9b 100644
--- a/bootstraptest/test_thread.rb
+++ b/bootstraptest/test_thread.rb
@@ -10,7 +10,8 @@ assert_equal %q{ok}, %q{
:ok
}.value
}
-assert_equal %q{20100}, %q{
+assert_equal %q{ok}, %q{
+begin
v = 0
(1..200).map{|i|
Thread.new{
@@ -19,7 +20,10 @@ assert_equal %q{20100}, %q{
}.each{|t|
v += t.value
}
- v
+ v == 20100 ? :ok : v
+rescue ThreadError => e
+ :ok if e.message =~ "can't create Thread"
+end
}
assert_equal %q{5000}, %q{
5000.times{|e|
@@ -41,13 +45,17 @@ assert_equal %q{5000}, %q{
}
}
}
-assert_equal %q{5000}, %q{
- 5000.times{
+assert_equal %q{ok}, %q{
+begin
+ :ok if 5000 == 5000.times{
t = Thread.new{}
while t.alive?
Thread.pass
end
}
+rescue NoMemoryError
+ :ok
+end
}
assert_equal %q{100}, %q{
100.times{