On Tue, Aug 19, 2025 at 12:08 PM Marco Elver <elver@xxxxxxxxxx> wrote: > For example something like: > For subsystem foo.c, define a KFuzzTest in foo_kfuzz.c, and then in > the Makfile add "obj-$(CONFIG_KFUZZTEST) += foo_kfuzz.o". I agree that fuzz targets should only be built if CONFIG_KFUZZTEST is enabled. Building a separate foo_kfuzz.o is probably ideal, but will need to think about how to cleanly handle static functions. > Alternatively, to test internal static functions, place the KFuzzTest > harness in a file foo_kfuzz.h, and include at the bottom of foo.c. > > Alex, Ethan, and KUnit folks: What's your preference? I think placing fuzz targets in separate files is a step in the right direction. Including a foo_kfuzz.h file inside of the source does still pollute the file to some extent but certainly less than having one or more KFuzzTest targets defined alongside the code.