p2 build tests

This commit is contained in:
Peter Li 2025-04-11 22:15:19 -07:00
parent 9a295f3f2f
commit b2495bcff7
6 changed files with 15 additions and 14 deletions

View File

@ -1,8 +1,9 @@
.{
.name = "miniaudio",
.name = .miniaudio,
.version = "0.0.0",
.dependencies = .{},
.paths = .{
"",
},
.fingerprint = 0xaeac616fa937921a,
}

View File

@ -1,8 +1,9 @@
.{
.name = "nfd",
.name = .nfd,
.version = "0.0.0",
.dependencies = .{ .p2 = .{ .path = "../p2" } },
.paths = .{
"",
},
.fingerprint = 0xc4705658dee6a489,
}

16
lib/p2/src/p2.zig vendored
View File

@ -73,14 +73,14 @@ pub const Span = spans.Span;
pub const shell = @import("utils/shell.zig");
comptime {
// std.testing.refAllDecls(utils);
// std.testing.refAllDecls(static_structures);
// std.testing.refAllDecls(ring_queue);
// std.testing.refAllDecls(sparse_set);
// std.testing.refAllDecls(stack_structures);
// std.testing.refAllDecls(index_pool);
// std.testing.refAllDecls(concurrent_queue);
// std.testing.refAllDecls(string_pool);
std.testing.refAllDecls(utils);
std.testing.refAllDecls(static_structures);
std.testing.refAllDecls(ring_queue);
std.testing.refAllDecls(sparse_set);
std.testing.refAllDecls(stack_structures);
std.testing.refAllDecls(index_pool);
std.testing.refAllDecls(concurrent_queue);
std.testing.refAllDecls(string_pool);
std.testing.refAllDecls(spans);
}

View File

@ -36,7 +36,7 @@ pub fn ConcurrentQueueUnmanagedAdvanced(comptime T: type, comptime opts: struct
// tail points to next free slot
// head points to the next one to pop
pub fn initCapacity(allocator: std.mem.Allocator, cap: usize) !@This() {
const new = .{
const new = @This(){
.data = try allocator.alloc(T, cap + 1),
.status = try allocator.alloc(Atomic(bool), cap + 1),
.head = Atomic(usize).init(0),

View File

@ -161,7 +161,7 @@ test "index pool test" {
}
// Insert 1 randomly add and delete objects another million objects in groups
var prng = std.rand.DefaultPrng.init(0x1234);
var prng = std.Random.DefaultPrng.init(0x1234);
var rand = prng.random();
var workBuffer: [5]Handle = .{ .{}, .{}, .{}, .{}, .{} };

View File

@ -92,7 +92,6 @@ const StringAllocation = struct {
const rc: [*]std.atomic.Value(u8) = @ptrCast(self.ptr); //+= 1;
if (rc[3].fetchSub(1, .release) == 1) {
rc[3].fence(.acquire);
return true;
}
@ -203,7 +202,7 @@ const Bucket = struct {
return rv;
} else {
const index = self.freeSlots.pop();
const index = self.freeSlots.pop().?;
const rv: BucketAllocation = .{
.bytes = self.indexToSlot(self.i2p(index), self.ibp(index)),