authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-06 23:12:17-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-07 11:03:37-08:00
log5e5b328dacb23e0804f05e0e1228f1671001d7ff
treeee45647a875c83d1ac68fd7087f032197cdb9cfd
parent1ddae8585a00e5c6d283336b7421caf480611123

test-standalone: update cases from posix.getrandom


4 files changed, 5 insertions(+), 4 deletions(-)

test/standalone/windows_argv/build.zig+1-1
...@@ -52,7 +52,7 @@ pub fn build(b: *std.Build) !void {...@@ -52,7 +52,7 @@ pub fn build(b: *std.Build) !void {
5252
53 const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {53 const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {
54 var buf: [8]u8 = undefined;54 var buf: [8]u8 = undefined;
55 try std.posix.getrandom(&buf);55 b.graph.io.random(&buf);
56 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());56 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
57 };57 };
58 const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");58 const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");
test/standalone/windows_argv/fuzz.zig+2-1
...@@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;...@@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;
55
6pub fn main(init: std.process.Init) !void {6pub fn main(init: std.process.Init) !void {
7 const gpa = init.gpa;7 const gpa = init.gpa;
8 const io = init.io;
8 const args = try init.minimal.args.toSlice(init.arena.allocator());9 const args = try init.minimal.args.toSlice(init.arena.allocator());
910
10 if (args.len < 2) return error.MissingArgs;11 if (args.len < 2) return error.MissingArgs;
...@@ -23,7 +24,7 @@ pub fn main(init: std.process.Init) !void {...@@ -23,7 +24,7 @@ pub fn main(init: std.process.Init) !void {
23 if (args.len < 4) {24 if (args.len < 4) {
24 rand_seed = true;25 rand_seed = true;
25 var buf: [8]u8 = undefined;26 var buf: [8]u8 = undefined;
26 try std.posix.getrandom(&buf);27 io.random(&buf);
27 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());28 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
28 }29 }
29 break :seed try std.fmt.parseUnsigned(u64, args[3], 10);30 break :seed try std.fmt.parseUnsigned(u64, args[3], 10);
test/standalone/windows_bat_args/build.zig+1-1
...@@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {...@@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {
6565
66 const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {66 const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {
67 var buf: [8]u8 = undefined;67 var buf: [8]u8 = undefined;
68 try std.posix.getrandom(&buf);68 b.graph.io.random(&buf);
69 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());69 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
70 };70 };
71 const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");71 const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");
test/standalone/windows_bat_args/fuzz.zig+1-1
...@@ -22,7 +22,7 @@ pub fn main(init: std.process.Init) !void {...@@ -22,7 +22,7 @@ pub fn main(init: std.process.Init) !void {
22 const seed_arg = it.next() orelse {22 const seed_arg = it.next() orelse {
23 rand_seed = true;23 rand_seed = true;
24 var buf: [8]u8 = undefined;24 var buf: [8]u8 = undefined;
25 try std.posix.getrandom(&buf);25 io.random(&buf);
26 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());26 break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
27 };27 };
28 break :seed try std.fmt.parseUnsigned(u64, seed_arg, 10);28 break :seed try std.fmt.parseUnsigned(u64, seed_arg, 10);