aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/abi.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-09-26 05:28:46 -0700
committerGitHub <noreply@github.com>2025-09-26 05:28:46 -0700
commite0dc2e4e3ffe72e5e637e30bdf1d2c59b56f3cb6 (patch)
tree23cafd6ae8e80026c2f257d291b91bae932e5730 /lib/std/Build/abi.zig
parent3b365a1f9b277dd2cf7f7dac51e71647e164ff3c (diff)
parent52a13f6a7fb0933c065348128ee3e9aecd64255b (diff)
downloadzig-e0dc2e4e3ffe72e5e637e30bdf1d2c59b56f3cb6.tar.gz
zig-e0dc2e4e3ffe72e5e637e30bdf1d2c59b56f3cb6.zip
Merge pull request #25342 from ziglang/fuzz-limit
fuzzing: implement limited fuzzing
Diffstat (limited to 'lib/std/Build/abi.zig')
-rw-r--r--lib/std/Build/abi.zig16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/std/Build/abi.zig b/lib/std/Build/abi.zig
index 2398a8ed8d..020e2ed032 100644
--- a/lib/std/Build/abi.zig
+++ b/lib/std/Build/abi.zig
@@ -140,10 +140,10 @@ pub const Rebuild = extern struct {
pub const fuzz = struct {
pub const TestOne = *const fn (Slice) callconv(.c) void;
pub extern fn fuzzer_init(cache_dir_path: Slice) void;
- pub extern fn fuzzer_coverage_id() u64;
+ pub extern fn fuzzer_coverage() Coverage;
pub extern fn fuzzer_init_test(test_one: TestOne, unit_test_name: Slice) void;
pub extern fn fuzzer_new_input(bytes: Slice) void;
- pub extern fn fuzzer_main() void;
+ pub extern fn fuzzer_main(limit_kind: LimitKind, amount: u64) void;
pub const Slice = extern struct {
ptr: [*]const u8,
@@ -158,6 +158,8 @@ pub const fuzz = struct {
}
};
+ pub const LimitKind = enum(u8) { forever, iterations };
+
/// libfuzzer uses this and its usize is the one that counts. To match the ABI,
/// make the ints be the size of the target used with libfuzzer.
///
@@ -251,6 +253,16 @@ pub const fuzz = struct {
return .{ .locs_len_raw = @bitCast(locs_len) };
}
};
+
+ /// Sent by lib/fuzzer to test_runner to obtain information about the
+ /// active memory mapped input file and cumulative stats about previous
+ /// fuzzing runs.
+ pub const Coverage = extern struct {
+ id: u64,
+ runs: u64,
+ unique: u64,
+ seen: u64,
+ };
};
/// ABI bits specifically relating to the time report interface.