aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-10-18 11:01:43 +0200
committerPeter Zhu <peter@peterzhu.ca>2023-10-18 11:01:43 +0200
commitf546fe15d547472f60c4a2d2857321b3c5084f0f (patch)
tree261a1082ceda1263314520684f56e6c7d450235e /test
parentac8ece81f26f29dc2f9d77fcdb0620a51ba26f1e (diff)
downloadruby-f546fe15d547472f60c4a2d2857321b3c5084f0f.tar.gz
Loosen assertion for flaky weak references test
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 567e7b5d80..b22f5b8a65 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -327,7 +327,8 @@ class TestGc < Test::Unit::TestCase
# Run full GC again to collect stats about weak references
GC.start
- assert_equal(0, wmap.size)
+ # Sometimes the WeakMap has one element, which might be held on by registers.
+ assert_operator(wmap.size, :<=, 1)
assert_operator(GC.latest_gc_info(:weak_references_count), :<=, before_weak_references_count - count + error_tolerance)
assert_operator(GC.latest_gc_info(:retained_weak_references_count), :<=, before_retained_weak_references_count - count + error_tolerance)