mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 04:04:44 +01:00
test-standalone: update cases from posix.getrandom
This commit is contained in:
parent
1ddae8585a
commit
5e5b328dac
4 changed files with 5 additions and 4 deletions
|
|
@ -52,7 +52,7 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {
|
||||
var buf: [8]u8 = undefined;
|
||||
try std.posix.getrandom(&buf);
|
||||
b.graph.io.random(&buf);
|
||||
break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
|
||||
};
|
||||
const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;
|
|||
|
||||
pub fn main(init: std.process.Init) !void {
|
||||
const gpa = init.gpa;
|
||||
const io = init.io;
|
||||
const args = try init.minimal.args.toSlice(init.arena.allocator());
|
||||
|
||||
if (args.len < 2) return error.MissingArgs;
|
||||
|
|
@ -23,7 +24,7 @@ pub fn main(init: std.process.Init) !void {
|
|||
if (args.len < 4) {
|
||||
rand_seed = true;
|
||||
var buf: [8]u8 = undefined;
|
||||
try std.posix.getrandom(&buf);
|
||||
io.random(&buf);
|
||||
break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
|
||||
}
|
||||
break :seed try std.fmt.parseUnsigned(u64, args[3], 10);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
const fuzz_seed = b.option(u64, "seed", "Seed to use for the PRNG (default: random)") orelse seed: {
|
||||
var buf: [8]u8 = undefined;
|
||||
try std.posix.getrandom(&buf);
|
||||
b.graph.io.random(&buf);
|
||||
break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
|
||||
};
|
||||
const fuzz_seed_arg = std.fmt.allocPrint(b.allocator, "{}", .{fuzz_seed}) catch @panic("oom");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn main(init: std.process.Init) !void {
|
|||
const seed_arg = it.next() orelse {
|
||||
rand_seed = true;
|
||||
var buf: [8]u8 = undefined;
|
||||
try std.posix.getrandom(&buf);
|
||||
io.random(&buf);
|
||||
break :seed std.mem.readInt(u64, &buf, builtin.cpu.arch.endian());
|
||||
};
|
||||
break :seed try std.fmt.parseUnsigned(u64, seed_arg, 10);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue