mirror of
https://github.com/vercel-labs/fx.git
synced 2026-10-28 10:15:17 +08:00
Remove the unused failing allocator from the terminal store tests
The only test that used it was removed when fx started loading shell startup files once per process, and the allocator stayed behind with no callers.
This commit is contained in:
1 file changed
-77
@@ -6119,83 +6119,6 @@ const TestStoreFixture = struct {
|
||||
}
|
||||
};
|
||||
|
||||
const OneShotFailingAllocator = struct {
|
||||
failing: std.testing.FailingAllocator,
|
||||
|
||||
fn init(alloc: Allocator) OneShotFailingAllocator {
|
||||
return .{ .failing = .init(alloc, .{}) };
|
||||
}
|
||||
|
||||
fn allocator(self: *OneShotFailingAllocator) Allocator {
|
||||
return .{ .ptr = self, .vtable = &.{
|
||||
.alloc = allocate,
|
||||
.resize = resize,
|
||||
.remap = remap,
|
||||
.free = free,
|
||||
} };
|
||||
}
|
||||
|
||||
fn allocate(
|
||||
raw: *anyopaque,
|
||||
len: usize,
|
||||
alignment: std.mem.Alignment,
|
||||
return_address: usize,
|
||||
) ?[*]u8 {
|
||||
const self: *OneShotFailingAllocator = @ptrCast(@alignCast(raw));
|
||||
const result = self.failing.allocator().rawAlloc(
|
||||
len,
|
||||
alignment,
|
||||
return_address,
|
||||
);
|
||||
if (result == null and self.failing.has_induced_failure) {
|
||||
self.failing.fail_index = std.math.maxInt(usize);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
fn resize(
|
||||
raw: *anyopaque,
|
||||
memory: []u8,
|
||||
alignment: std.mem.Alignment,
|
||||
new_len: usize,
|
||||
return_address: usize,
|
||||
) bool {
|
||||
const self: *OneShotFailingAllocator = @ptrCast(@alignCast(raw));
|
||||
return self.failing.allocator().rawResize(
|
||||
memory,
|
||||
alignment,
|
||||
new_len,
|
||||
return_address,
|
||||
);
|
||||
}
|
||||
|
||||
fn remap(
|
||||
raw: *anyopaque,
|
||||
memory: []u8,
|
||||
alignment: std.mem.Alignment,
|
||||
new_len: usize,
|
||||
return_address: usize,
|
||||
) ?[*]u8 {
|
||||
const self: *OneShotFailingAllocator = @ptrCast(@alignCast(raw));
|
||||
return self.failing.allocator().rawRemap(
|
||||
memory,
|
||||
alignment,
|
||||
new_len,
|
||||
return_address,
|
||||
);
|
||||
}
|
||||
|
||||
fn free(
|
||||
raw: *anyopaque,
|
||||
memory: []u8,
|
||||
alignment: std.mem.Alignment,
|
||||
return_address: usize,
|
||||
) void {
|
||||
const self: *OneShotFailingAllocator = @ptrCast(@alignCast(raw));
|
||||
self.failing.allocator().rawFree(memory, alignment, return_address);
|
||||
}
|
||||
};
|
||||
|
||||
const ConcurrentAppend = struct {
|
||||
session: *DurableSession,
|
||||
result: ?anyerror = null,
|
||||
|
||||
Reference in new issue
Block a user