summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-05-31 09:22:52 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-05-31 09:22:52 -0400
commit1ac17693de4e80f7b1e11622dd77376e409cd4ea (patch)
treecae3c40683c3149dd4b6f37b8e878dba18710c34 /test
parente502600fb9094fe9413db54ce93b7328bec40b9f (diff)
Add debug code to GC compaction test
This test is flaky on some CI systems.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc_compact.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb
index 221ca677e3..64077e6cdf 100644
--- a/test/ruby/test_gc_compact.rb
+++ b/test/ruby/test_gc_compact.rb
@@ -422,19 +422,21 @@ class TestGCCompact < Test::Unit::TestCase
# AR and ST hashes are in the same size pool on 32 bit
omit unless RbConfig::SIZEOF["uint64_t"] <= RbConfig::SIZEOF["void*"]
- assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10, signal: :SEGV)
+ assert_separately(%w[-robjspace], "#{<<~'begin;'}\n#{<<~'end;'}", timeout: 10, signal: :SEGV)
begin;
HASH_COUNT = 500
GC.verify_compaction_references(expand_heap: true, toward: :empty)
+ before_read_barrier_faults = GC.stat(:read_barrier_faults)
+
base_hash = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8 }
ary = HASH_COUNT.times.map { base_hash.dup }
ary.each { |h| h[:i] = 9 }
stats = GC.verify_compaction_references(expand_heap: true, toward: :empty)
- assert_operator(stats[:moved_down][:T_HASH], :>=, HASH_COUNT)
+ assert_operator(stats[:moved_down][:T_HASH], :>=, 500, "read barrier faults: before #{before_read_barrier_faults}, after #{GC.stat(:read_barrier_faults)}")
end;
end