zig/lib/std/zig/Client.zig
Loris Cro 0feacc2b81 fuzzing: implement limited fuzzing
Adds the limit option to `--fuzz=[limit]`. the limit expresses a number
of iterations that *each fuzz test* will perform at maximum before
exiting. The limit argument supports also 'K', 'M', and 'G' suffixeds
(e.g. '10K').

Does not imply `--web-ui` (like unlimited fuzzing does) and prints a
fuzzing report at the end.

Closes #22900 but does not implement the time based limit, as after
internal discussions we concluded to be problematic to both implement
and use correctly.
2025-09-24 12:46:48 +02:00

51 lines
1.9 KiB
Zig

pub const Message = struct {
pub const Header = extern struct {
tag: Tag,
/// Size of the body only; does not include this Header.
bytes_len: u32,
};
pub const Tag = enum(u32) {
/// Tells the compiler to shut down cleanly.
/// No body.
exit,
/// Tells the compiler to detect changes in source files and update the
/// affected output compilation artifacts.
/// If one of the compilation artifacts is an executable that is
/// running as a child process, the compiler will wait for it to exit
/// before performing the update.
/// No body.
update,
/// Tells the compiler to execute the executable as a child process.
/// No body.
run,
/// Tells the compiler to detect changes in source files and update the
/// affected output compilation artifacts.
/// If one of the compilation artifacts is an executable that is
/// running as a child process, the compiler will perform a hot code
/// swap.
/// No body.
hot_update,
/// Ask the test runner for metadata about all the unit tests that can
/// be run. Server will respond with a `test_metadata` message.
/// No body.
query_test_metadata,
/// Ask the test runner to run a particular test.
/// The message body is a u32 test index.
run_test,
/// Ask the test runner to start fuzzing a particular test forever or for a given amount of time/iterations.
/// The message body is:
/// - a u32 test index.
/// - a u8 test limit kind (std.Build.api.fuzz.LimitKind)
/// - a u64 value whose meaning depends on FuzzLimitKind (either a limit amount or an instance id)
start_fuzzing,
_,
};
comptime {
const std = @import("std");
std.debug.assert(@sizeOf(std.Build.abi.fuzz.LimitKind) == 1);
}
};