From cd11688c8db316b69b98047d0f35b6f524a5c3a9 Mon Sep 17 00:00:00 2001 From: Prokop Randacek Date: Fri, 24 Jan 2025 16:05:15 +0100 Subject: [PATCH 1/3] fuzzer: document entry point --- lib/std/testing.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 1c109c48e21f..b49fbcb0186b 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -1148,6 +1148,18 @@ pub const FuzzInputOptions = struct { corpus: []const []const u8 = &.{}, }; +/// Calling this function from a test marks it as a fuzz test. +/// +/// Fuzz tests are run by `zig build test --fuzz`. The fuzzer repeatedly call +/// the given callback and evolve its input to maximize the code coverage and +/// find crashes in your program. +/// +/// Your test case should be 100% deterministic. You can spawn threads but +/// should join them all before returning to avoid resource leaks. There should +/// be zero global state that could affect execution across runs. The fuzzer +/// assumes that given identical input, your function will behave 100 % +/// identically. +/// /// Inline to avoid coverage instrumentation. pub inline fn fuzz( comptime testOne: fn (input: []const u8) anyerror!void, From 29840b5a5b36ca260fc53f49060a79281f722d62 Mon Sep 17 00:00:00 2001 From: Prokop Randacek Date: Fri, 24 Jan 2025 16:07:31 +0100 Subject: [PATCH 2/3] fuzzer: webui modifications --- lib/fuzzer/web/index.html | 160 +++++++------------------------ lib/fuzzer/web/main.zig | 1 + lib/std/Build/Fuzz/WebServer.zig | 28 +++--- 3 files changed, 51 insertions(+), 138 deletions(-) diff --git a/lib/fuzzer/web/index.html b/lib/fuzzer/web/index.html index 325342e8ebf5..3bab30691a77 100644 --- a/lib/fuzzer/web/index.html +++ b/lib/fuzzer/web/index.html @@ -4,53 +4,10 @@ Zig Build System Interface - +

Loading JavaScript...

-