diff options
Diffstat (limited to 'src/trace/heap_test.zig')
| -rw-r--r-- | src/trace/heap_test.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/trace/heap_test.zig b/src/trace/heap_test.zig index 2cb5996..aca05b0 100644 --- a/src/trace/heap_test.zig +++ b/src/trace/heap_test.zig @@ -110,14 +110,17 @@ fn check(argv: []const []const u8) !void { } try std.testing.expectEqual(@as(usize, 17), smalls); try std.testing.expect(heaps[0].fastbins.len == 0 and heaps[0].bins.len == 0); - // glibc 2.44 makes the tcache at the first free. - if (heaps[0].tcache) |t| try std.testing.expectEqual(@as(usize, 0), t.bins.len) else try std.testing.expect(l.tcache_slots); + // glibc 2.44 makes the tcache at the first free: until then the thread's pointer is on its dummy. + if (heaps[0].tcache) |t| try std.testing.expectEqual(@as(usize, 0), t.bins.len) else try std.testing.expect(l.tcache_slots and heaps[0].tcache_dummy); + try std.testing.expect(!heaps[1].tcache_dummy); // 2: the tcache's 0x30 bin full, the last freed first, each link // protected by its own address; the rest in fastbin 0x30 where there are // fastbins, else in a bin. const t = heaps[1].tcache.?; try std.testing.expectEqual(@as(usize, 1), t.bins.len); + // Where a count is the slots left, an empty bin's is the capacity. + try std.testing.expectEqual(if (l.tcache_slots) @as(?u16, @intCast(fill)) else null, t.capacity); const bin = t.bins[0]; try std.testing.expectEqual(heap.Where{ .tcache = 1 }, bin.in); try std.testing.expectEqual(fill, bin.entries.len); |
