testingx API reference Changelog View on GitHub

API reference

testingx: a test runner that replaces the built-in one, and benchmarks that sit beside your tests.

This file is the library root. The bench side lives in bench.zig. runner.zig is the --test-runner replacement and compiles as its own module.

module bench

src

Benchmarks that sit beside your tests: Go's testing.B, in Zig.

more

A benchmark suite is a program that registers what runs. The entrypoint is pub fn benchmarkMain(b: *B) !void in the suite root:

const sort_bench = @import("bench/sort.zig");

pub fn benchmarkMain(b: *testingx.B) !void {
    try b.addMod(sort_bench); // bulk: every pub benchmark* at top level
    try b.add("Parser/Baseline", benchmarkParserBaseline); // one-off
}

add and addMod register. finish executes everything registered. Inside a running benchmark, b.run executes a sub-benchmark immediately (Go's b.Run); registering there is an error.

addMod walks top-level declarations only, never nested structs. The convention inside a module: pub fn benchmark*(b: *B) !void.

Flags (parsed by the generated main, Go's set): --benchtime D run for duration D (default 1s), or Nx for exactly N --count N run each benchmark N times (default 1) --filter P comma-separated patterns: contains, ^ anchors start, $ anchors end, * matches any bytes --benchmem print B/op and allocs/op --parallelism N default B.runParallel multiplier --config K=V add a config line to the output header (repeatable) --jsonl emit one JSON object per record instead of benchfmt text

Text output is the Go benchmark format (benchfmt.zig); FAIL and SKIP rows are comments so the result stream stays parseable. --jsonl is an opt-in machine-readable mode.

Environment, for CI policy: TESTINGX_BENCH_FILTER (same as --filter), TESTINGX_BENCH_JSONL (1 or true, same as --jsonl), and TESTINGX_BENCH_CYCLES (same as --cycles, so a shell can make counters the local default). Flags win.

Constants

pub const panic = std.debug.FullPanic(panicFn)

src

Panic handler for benchmark executables: print the active benchmark, dump the stack trace, and exit 1 instead of aborting into a core file. src/bench_main.zig wires this automatically; a custom main can bind pub const panic = testingx.benchPanic;.

pub const Error = …

src
value
error{
    BenchmarkFailed,
    BenchmarkSkipped,
    InvalidMetricUnit,
    // `b.run` before `finish` executes anything, or `add`/`addMod` while a
    // benchmark is running. Registration happens in `benchmarkMain`; `b.run`
    // belongs inside a benchmark function.
    InvalidPhase,
}

pub const Function = *const fn (*B) anyerror!void

src

Functions

pub fn benchmark(allocator: Allocator, io: Io, func: Function, options: Options) !Result

src

Run one benchmark function in isolation and return its result.

pub fn benchMain(comptime root: type, init: std.process.Init) u8

src

The generated bench main calls this: parse flags, run benchmarkMain, exit non-zero on failure.

pub fn printUsage(writer: *Io.Writer) !void

src

Types

struct Options

src

The flags, as parsed by benchMain or built by a test.

Fields

benchtime: DurationOrCount = .{ .duration_ns = time.ns_per_s }
benchmem: bool = false
count: usize = 1
parallelism: usize = 1
filter: ?[]const u8 = null
emit_environment: bool = true
jsonl: bool = false
disasm: ?[]const u8 = null

--disasm: print the linker symbol and disassembly of matching benchmarks instead of running anything.

cycles: bool = false

--cycles: read hardware counters around each timed section.

help: bool = false
writer: ?*Io.Writer = null
config: std.ArrayList(benchfmt.Config) = .empty

Extra config lines from --config, emitted before the environment. The list and its values are owned by this Options.

Functions

pub fn deinit(self: *Options, allocator: Allocator) void

src

pub fn parse(allocator: Allocator, args: anytype, defaults: Options) !Options

src

Accepts a standard-library argument iterator. Skips argv[0]. Returned filter strings borrow the iterator's storage; --config values are duplicated with allocator, which also owns the list. defaults must not already carry config entries.

struct SliceArgs

src

Arguments as a slice: the process main already has one in hand.

Fields

args: []const []const u8
i: usize

Functions

pub fn init(args: []const []const u8) SliceArgs

src

An iterator positioned after argv[0].

pub fn skip(self: *SliceArgs) void

src

pub fn next(self: *SliceArgs) ?[]const u8

src

union DurationOrCount

src
pub const DurationOrCount = union(enum)

Fields

count: u64

Functions

pub fn parse(s: []const u8) !DurationOrCount

src

struct Spec

src

Fields

name: []const u8
func: Function

struct Result

src

Fields

n: u64
t_ns: u64
bytes: i64
mem_allocs: u64
mem_bytes: u64
extra: MetricMap

Constants

pub const zero: Result = …

src
value
.{
        .n = 0,
        .t_ns = 0,
        .bytes = 0,
        .mem_allocs = 0,
        .mem_bytes = 0,
        .extra = .empty,
    }

Nothing measured: no iterations, time, bytes, allocations, or metrics.

Functions

pub fn deinit(self: *Result, allocator: Allocator) void

src

pub fn nsPerOp(self: *const Result) i64

src

pub fn mbPerSec(self: *const Result) f64

src

pub fn allocsPerOp(self: *const Result) i64

src

pub fn allocedBytesPerOp(self: *const Result) i64

src

pub fn appendValues( self: *const Result, allocator: Allocator, values: *std.ArrayList(benchfmt.Value), include_mem: bool, ) !void

src

Append this result's measurements in print order. ns/op is always present, so the encoded result line always has a value/unit pair.

struct CountingAllocator

src

Fields

child: Allocator
total_allocs: atomic.Value(u64)
total_bytes: atomic.Value(u64)

Functions

pub fn init(child: Allocator) CountingAllocator

src

pub fn allocator(self: *CountingAllocator) Allocator

src

pub fn reset(self: *CountingAllocator) void

src

pub fn allocs(self: *CountingAllocator) u64

src

pub fn bytes(self: *CountingAllocator) u64

src

struct B

src

A B is the suite during registration (benchmarkMain) and one running benchmark during execution. The phase decides what add/addMod/run do.

Fields

internal_allocator: Allocator
io: Io

The I/O of this B. In the suite phase it is the process I/O; in a spawned benchmark it is io_instance.io() (mirrors testing.io: a fresh Io.Threaded per benchmark, on the same counting allocator as allocator, so its allocations are counted).

io_instance: Io.Threaded
argv0: Io.Threaded.Argv0
environ: std.process.Environ
options: Options
specs: std.ArrayList(Spec)
writer: ?*Io.Writer
stdout_buf: [4096]u8
stdout: Io.File.Writer
executing: bool
allocator: Allocator
counting_allocator: CountingAllocator
name: []const u8
n: u64
failed: bool
skipped: bool
bench_func: ?Function
bench_time: DurationOrCount
bytes: i64
timer: Timer
timer_on: bool
net_allocs: u64
net_bytes: u64
benchmem: bool
jsonl: bool
filter_pattern: ?[]const u8
counters: perfcounter.Counters
counters_error: ?anyerror
result: Result
parallelism: usize
previous_n: u64
loop_state: LoopState
has_sub: bool
extra: MetricMap

Functions

pub fn init(allocator: Allocator, io: Io, options: Options) B

src

Create a suite for registration. io is required: everything here does I/O and refuses to guess.

pub fn initProcess(entry: std.process.Init) !B

src

Create a suite from a process entry: parses flags from argv.

pub fn deinit(self: *B) void

src

pub fn add(self: *B, name: []const u8, func: Function) !void

src

Register one benchmark by name.

pub fn addMod(self: *B, comptime mod: type) !void

src

Register every top-level pub fn benchmark*(b: *B) !void in mod. One line per module, zero per function. Names drop the prefix: benchmarkSort registers as "Sort".

pub fn finish(self: *B) !bool

src

Execute everything registered. Returns true when all passed.

pub fn run(self: *B, name: []const u8, func: Function) !bool

src

Execute a sub-benchmark (Go's b.Run). Only valid inside a running benchmark: benchmarkMain registers with add/addMod instead.

pub fn startTimer(self: *B) void

src

pub fn stopTimer(self: *B) void

src

pub fn resetTimer(self: *B) void

src

pub fn elapsed(self: *B) u64

src

pub fn setBytes(self: *B, n: i64) void

src

pub fn reportAllocs(self: *B) void

src

pub fn reportCounters(self: *B) void

src

Count hardware events for this benchmark, the per-benchmark form of --cycles: the row gains cycles/op, instructions/op, ipc, and whatever else the PMU granted. Counters open here, inside the timed body, so a benchmark that asks for them pays for them whether or not the suite passed --cycles. A host without a PMU reports timings alone; requesting counters never fails a run.

pub fn reportMetric(self: *B, n: f64, unit: []const u8) !void

src

pub fn fail(self: *B) Error!void

src

pub fn skip(self: *B) Error!void

src

pub fn loop(self: *B) !bool

src

pub fn runParallel(self: *B, body: *const fn (*Pb) anyerror!void) !void

src

pub fn setParallelism(self: *B, p: usize) void

src

pub inline fn keepAlive(_: *B, value: anytype) void

src

Keep a computed value from being optimized away. Idiomatic shape: declare the sink, defer b.keepAlive(sink);, then compute in the loop. The defer guarantees the final value is observed, which keeps every iteration that contributes to it.

pub inline fn blackBox(_: *B, value: anytype) @TypeOf(value)

src

struct Pb

src

Fields

global_n: *atomic.Value(u64)
grain: u64
cache: u64
b_n: u64

Functions

pub fn init(global_n: *atomic.Value(u64), grain: u64, b_n: u64) Pb

src

An iterator over b_n iterations, with no grain cached yet.

pub fn next(self: *Pb) bool

src

module benchfmt

src

The Go benchmark file format: https://golang.org/design/14313-benchmark-format

more

A stream is a sequence of lines. Configuration lines set key/value pairs for the results that follow, result lines name a benchmark and its measurements, and everything else (including # comments) is ignorable for tooling:

rev: 4f2b1c9
target: aarch64-linux-gnu
BenchmarkSort/Quick  1200  99.18 ns/op  16 B/op  1 allocs/op
# FAIL: BenchmarkBroken

The reader and writer mirror golang.org/x/perf/benchfmt: the writer streams records, and the reader parses a byte slice into records plus an accumulated configuration map. Reader records are valid until the next call, and syntax errors are records, not fatal errors.

Keys are checked against the ASCII subset of the benchfmt key rule: a key begins with a lowercase letter and contains no whitespace, uppercase letter, or colon. Values are free text without newlines. Result names are the text after the Benchmark prefix; the writer adds the prefix, and the reader strips it, matching benchfmt.Name.Full(). Unit metadata lines (Unit <unit> key=value) are not interpreted; the reader ignores them and the writer never emits them.

Constants

pub const Error = …

src
value
error{
    InvalidConfigKey,
    InvalidConfigValue,
    InvalidCommentText,
    InvalidName,
    InvalidUnit,
    MissingValues,
}

Functions

pub fn isValidConfigKey(key: []const u8) bool

src

Types

struct Config

src

One configuration line, or one --config entry.

Fields

key: []const u8
value: []const u8

struct Value

src

One <value> <unit> measurement from a result line.

Fields

value: f64
unit: []const u8

struct Writer

src

Writer emits benchfmt lines to writer.

Fields

writer: *Io.Writer

Functions

pub fn init(writer: *Io.Writer) Writer

src

pub fn writeConfig(self: *Writer, key: []const u8, value: []const u8) !void

src

Write one configuration line. An empty value is written as key:, which readers interpret as deleting the key.

pub fn writeResult( self: *Writer, name: []const u8, iters: u64, values: []const Value, ) !void

src

Write one result line. The writer supplies the Benchmark prefix and keeps the columns aligned; any run of whitespace parses as a separator.

pub fn writeComment(self: *Writer, text: []const u8) !void

src

Write one comment line, e.g. a FAIL or SKIP marker that must stay out of the result stream.

pub fn writeCommentFmt(self: *Writer, comptime format: []const u8, args: anytype) !void

src

Write one formatted comment line.

struct Name

src

Fields

full: []const u8

The name without the Benchmark prefix, e.g. Sort/Quick-8.

Functions

pub fn base(self: Name) []const u8

src

The base name, without any /part or trailing -N GOMAXPROCS suffix.

pub fn splitGomaxprocs(self: Name) Gomaxprocs

src

Split off Go's trailing -N GOMAXPROCS suffix, if present.

pub fn parts(self: Name, allocator: Allocator) !Parts

src

Split the name into its base and sub-benchmark parts. Each part is one of /key=value, /positional, or a trailing -N GOMAXPROCS suffix. items[0] is the base; concatenating items rebuilds full.

Types

struct Gomaxprocs

src

Fields

prefix: []const u8
gomaxprocs: ?[]const u8

struct Parts

src

Fields

items: []const []const u8
allocator: Allocator

Functions

pub fn deinit(self: *Parts) void

src

struct Result

src

One parsed result line.

Fields

name: Name
iters: u64
values: []const Value

Borrowed from the reader; valid until the next Reader.next call.

struct SyntaxError

src

A recoverable parse error. Scanning continues after one is returned.

Fields

line: usize
kind: Kind

Functions

pub fn message(self: SyntaxError) []const u8

src

Types

enum Kind

src

Fields

missing_name missing_name
missing_iterations missing_iterations
invalid_iterations invalid_iterations
missing_measurements missing_measurements
invalid_measurement invalid_measurement
missing_unit missing_unit

union Record

src
pub const Record = union(enum)

Fields

config: Config
result: Result
comment: []const u8
syntax_error: SyntaxError

struct Reader

src

Reader parses a benchfmt stream held in memory.

Fields

allocator: Allocator
input: []const u8
offset: usize
line: usize
config: ConfigMap

Configuration accumulated from every config line read so far.

values: std.ArrayList(Value)

Constants

pub const ConfigMap = std.array_hash_map.String([]const u8)

src

Functions

pub fn init(allocator: Allocator, input: []const u8) Reader

src

pub fn deinit(self: *Reader) void

src

pub fn next(self: *Reader) !?Record

src

Return the next record, or null at end of input. Syntax errors are returned as records; parsing resumes on the next line.

struct B

src
pub const B = bench.B

A B is the suite during registration (benchmarkMain) and one running benchmark during execution. The phase decides what add/addMod/run do.

Fields

internal_allocator: Allocator
io: Io

The I/O of this B. In the suite phase it is the process I/O; in a spawned benchmark it is io_instance.io() (mirrors testing.io: a fresh Io.Threaded per benchmark, on the same counting allocator as allocator, so its allocations are counted).

io_instance: Io.Threaded
argv0: Io.Threaded.Argv0
environ: std.process.Environ
options: Options
specs: std.ArrayList(Spec)
writer: ?*Io.Writer
stdout_buf: [4096]u8
stdout: Io.File.Writer
executing: bool
allocator: Allocator
counting_allocator: CountingAllocator
name: []const u8
n: u64
failed: bool
skipped: bool
bench_func: ?Function
bench_time: DurationOrCount
bytes: i64
timer: Timer
timer_on: bool
net_allocs: u64
net_bytes: u64
benchmem: bool
jsonl: bool
filter_pattern: ?[]const u8
counters: perfcounter.Counters
counters_error: ?anyerror
result: Result
parallelism: usize
previous_n: u64
loop_state: LoopState
has_sub: bool
extra: MetricMap

Functions

pub fn init(allocator: Allocator, io: Io, options: Options) B

src

Create a suite for registration. io is required: everything here does I/O and refuses to guess.

pub fn initProcess(entry: std.process.Init) !B

src

Create a suite from a process entry: parses flags from argv.

pub fn deinit(self: *B) void

src

pub fn add(self: *B, name: []const u8, func: Function) !void

src

Register one benchmark by name.

pub fn addMod(self: *B, comptime mod: type) !void

src

Register every top-level pub fn benchmark*(b: *B) !void in mod. One line per module, zero per function. Names drop the prefix: benchmarkSort registers as "Sort".

pub fn finish(self: *B) !bool

src

Execute everything registered. Returns true when all passed.

pub fn run(self: *B, name: []const u8, func: Function) !bool

src

Execute a sub-benchmark (Go's b.Run). Only valid inside a running benchmark: benchmarkMain registers with add/addMod instead.

pub fn startTimer(self: *B) void

src

pub fn stopTimer(self: *B) void

src

pub fn resetTimer(self: *B) void

src

pub fn elapsed(self: *B) u64

src

pub fn setBytes(self: *B, n: i64) void

src

pub fn reportAllocs(self: *B) void

src

pub fn reportCounters(self: *B) void

src

Count hardware events for this benchmark, the per-benchmark form of --cycles: the row gains cycles/op, instructions/op, ipc, and whatever else the PMU granted. Counters open here, inside the timed body, so a benchmark that asks for them pays for them whether or not the suite passed --cycles. A host without a PMU reports timings alone; requesting counters never fails a run.

pub fn reportMetric(self: *B, n: f64, unit: []const u8) !void

src

pub fn fail(self: *B) Error!void

src

pub fn skip(self: *B) Error!void

src

pub fn loop(self: *B) !bool

src

pub fn runParallel(self: *B, body: *const fn (*Pb) anyerror!void) !void

src

pub fn setParallelism(self: *B, p: usize) void

src

pub inline fn keepAlive(_: *B, value: anytype) void

src

Keep a computed value from being optimized away. Idiomatic shape: declare the sink, defer b.keepAlive(sink);, then compute in the loop. The defer guarantees the final value is observed, which keeps every iteration that contributes to it.

pub inline fn blackBox(_: *B, value: anytype) @TypeOf(value)

src

pub const Error = bench.Error

src

struct Options

src
pub const Options = bench.Options

The flags, as parsed by benchMain or built by a test.

Fields

benchtime: DurationOrCount = .{ .duration_ns = time.ns_per_s }
benchmem: bool = false
count: usize = 1
parallelism: usize = 1
filter: ?[]const u8 = null
emit_environment: bool = true
jsonl: bool = false
disasm: ?[]const u8 = null

--disasm: print the linker symbol and disassembly of matching benchmarks instead of running anything.

cycles: bool = false

--cycles: read hardware counters around each timed section.

help: bool = false
writer: ?*Io.Writer = null
config: std.ArrayList(benchfmt.Config) = .empty

Extra config lines from --config, emitted before the environment. The list and its values are owned by this Options.

Functions

pub fn deinit(self: *Options, allocator: Allocator) void

src

pub fn parse(allocator: Allocator, args: anytype, defaults: Options) !Options

src

Accepts a standard-library argument iterator. Skips argv[0]. Returned filter strings borrow the iterator's storage; --config values are duplicated with allocator, which also owns the list. defaults must not already carry config entries.

struct Result

src
pub const Result = bench.Result

Fields

n: u64
t_ns: u64
bytes: i64
mem_allocs: u64
mem_bytes: u64
extra: MetricMap

Constants

pub const zero: Result = …

src
value
.{
        .n = 0,
        .t_ns = 0,
        .bytes = 0,
        .mem_allocs = 0,
        .mem_bytes = 0,
        .extra = .empty,
    }

Nothing measured: no iterations, time, bytes, allocations, or metrics.

Functions

pub fn deinit(self: *Result, allocator: Allocator) void

src

pub fn nsPerOp(self: *const Result) i64

src

pub fn mbPerSec(self: *const Result) f64

src

pub fn allocsPerOp(self: *const Result) i64

src

pub fn allocedBytesPerOp(self: *const Result) i64

src

pub fn appendValues( self: *const Result, allocator: Allocator, values: *std.ArrayList(benchfmt.Value), include_mem: bool, ) !void

src

Append this result's measurements in print order. ns/op is always present, so the encoded result line always has a value/unit pair.

struct Spec

src
pub const Spec = bench.Spec

Fields

name: []const u8
func: Function

pub const Function = bench.Function

src

pub fn benchmark(allocator: Allocator, io: Io, func: Function, options: Options) !Result

src

Run one benchmark function in isolation and return its result.

pub fn benchMain(comptime root: type, init: std.process.Init) u8

src

The generated bench main calls this: parse flags, run benchmarkMain, exit non-zero on failure.

pub const benchPanic = bench.panic

src

Panic handler for benchmark executables: print the active benchmark, dump the stack trace, and exit 1 instead of aborting into a core file. src/bench_main.zig wires this automatically; a custom main can bind pub const panic = testingx.benchPanic;.

module filter

src

Functions

pub fn matchesAny(patterns: []const u8, name: []const u8) bool

src

pub fn matches(pattern: []const u8, name: []const u8) bool

src

pub fn mayMatchAnyChild(patterns: []const u8, name: []const u8) bool

src

pub fn mayMatchChild(pattern: []const u8, name: []const u8) bool

src

struct Timer

src
pub const Timer = @import("timer.zig").Timer

Fields

io: Io
started: Io.Timestamp

Functions

pub fn start(io: Io) Timer

src

pub fn reset(self: *Timer) void

src

pub fn read(self: *const Timer) u64

src

module artifacts

src

Retention for test output.

A test asks for a directory, writes files into it, and the runner keeps the directory only when the test fails. The path appears under the failure, so the files are where the person reading the failure looks.

Functions

pub fn artifactDir(allocator: Allocator) !?[]const u8

src

The directory this test may write files into, or null when the runner was not asked to collect artifacts with --artifacts=DIR or TESTINGX_ARTIFACTS.

more

Call this from a test. The directory is created on the first call. The runner keeps it when the test fails, deletes it when the test passes, and prints its path with the failure. The returned path belongs to allocator.

The value travels on testing.environ, the one channel the runner and the test module share.

pub fn writeArtifact(allocator: Allocator, name: []const u8, bytes: []const u8) !void

src

Write name into the test's artifact directory. Does nothing when the runner was not asked to keep artifacts.

name is relative to the directory, which already exists. A name that contains a path separator needs the parent directory to exist first.

pub fn artifactDir(allocator: Allocator) !?[]const u8

src

The directory this test may write files into, or null when the runner was not asked to collect artifacts with --artifacts=DIR or TESTINGX_ARTIFACTS.

more

Call this from a test. The directory is created on the first call. The runner keeps it when the test fails, deletes it when the test passes, and prints its path with the failure. The returned path belongs to allocator.

The value travels on testing.environ, the one channel the runner and the test module share.

pub fn writeArtifact(allocator: Allocator, name: []const u8, bytes: []const u8) !void

src

Write name into the test's artifact directory. Does nothing when the runner was not asked to keep artifacts.

name is relative to the directory, which already exists. A name that contains a path separator needs the parent directory to exist first.

module txtar

src

Compile-time txtar parsing, and one runtime writer for artifacts.

The grammar matches mattrobenolt/txtar: a comment, then -- name -- markers with section text between them. parse runs at comptime; format is the inverse at runtime, so a test can dump an archive that fixtures() reads back after it is checked in.

Constants

pub const FormatError = …

src
value
error{
    InvalidName,
    OutOfMemory,
}

Functions

pub fn format( allocator: Allocator, comment: []const u8, files: []const File, ) FormatError![]u8

src

Format files as a txtar archive. The result is owned by allocator.

parse reads this back. Section text that does not end in a newline gains one, matching what the parser does on the way in, so a round trip is stable.

pub fn parse(comptime text: []const u8) Parse(count(text))

src

pub fn count(comptime text: []const u8) usize

src

pub fn markerName(line: []const u8) ?[]const u8

src

The marker name for a line, or null when the line is content.

Types

struct File

src

Fields

name: []const u8

The marker name, trimmed.

text: []const u8

Section text. A final line without a newline gains one, as in txtar.

type fn Parse

src
pub fn Parse(comptime n: usize) type

Fields

comment: []const u8
files: [n]File

pub fn fixtures(comptime archive: []const u8) Set(archive)

src

An embedded txtar archive, read at comptime.

more

archive must be comptime-known; @embedFile provides that. The value holds the comment and the section list; the decoded bytes live in compile-time constants on the generated type. A local const fx = fixtures(@embedFile(...)) works.

The value has:

  • comment: the archive comment.
  • files: every section, as Fixture { name, text }.
  • get(name): the section text.
  • b64(name) and hex(name): decoded bytes.
  • find(name): runtime lookup, returning a Fixture.

pub inline fn b64(comptime text: []const u8) []const u8

src

Base64-decode one embedded file at comptime.

pub inline fn hex(comptime text: []const u8) []const u8

src

Hex-decode one embedded file at comptime.

struct Fixture

src
pub const Fixture = @import("fixtures.zig").Fixture

Fields

name: []const u8

The marker name, trimmed.

text: []const u8

Section text. A final line without a newline gains one, as in txtar.

pub fn fuzzBytes( context: anytype, comptime max_len: usize, comptime testOne: fn (@TypeOf(context), []const u8) anyerror!void, options: testing.FuzzInputOptions, ) anyerror!void

src

Adapt std.testing.fuzz to a byte-slice target.

more

Fills a max_len stack buffer with bytes from the fuzzer's Smith and calls testOne with the filled slice. max_len is comptime because it sizes that buffer. Under testingx's runner the adapter replays options.corpus and one empty input. Under the built-in runner in fuzz mode it mutates.

A corpus entry is the bytes the target receives, so a seed file named for what the target should see holds exactly that. Smith.slice reads a length before the bytes, so the adapter frames each entry and no seed file carries a hand-written prefix.

Two consequences follow. An entry longer than max_len reaches the target as its first max_len bytes: the adapter writes the length that will arrive, because an untouched length is read back as 0 during corpus replay and as an arbitrary length under the fuzzer. And an input the fuzzer saved is already framed, so a crash file cannot be copied into options.corpus as-is; unwrap it first, or keep it out of the corpus.