tiny.reducer.bytes
Defined in tiny.reducer.
The search deletes bytes from an input that reproduces a defect until a smaller input still reproduces it, carrying out test-case reduction over byte sequences.
API (16)
Actions
Public operations.
reduce: Shortens an initial byte sequence against the caller's oracle.
Types and contracts
Public types and contracts.
Capacity: Workspace layout derived from the caller's limits, sized so that a run in steady state needs no further allocation.Completion: Stopping condition that ended the search,one_minimalorbudget_exhausted.Error: Set of errors the reduction framework produces while acquiring the workspace or checking the input.Exhaustion: Set of errors raised when the input exceeds the workspace bounds or another run already holds the workspace.Interesting: Oracle's answer about one candidate,interestingoruninteresting.InterestingFn: Type of the caller's oracle function pointer.Limits: Sizing constraint the caller supplies for the byte reduction workspace.Result: Outcome of a run, with bytes borrowed from the acquired workspace.Settings: Options that control how a run executes.Status: Snapshot of one workspace's state, taken by value at the moment of the call.Storage: Workspace, allocated up front and double-buffered, that carries reduction in steady state.
Namespaces
Public namespaces.
capacity: Module holding the capacity derivation and the limits type.model: Module holding the data types, the oracle function interface, the error sets, and the execution settings.reduction: Module holding the reduction loop, the execution counters, and the borrowed result.storage: Module holding the workspace, allocated up front and double-buffered, and the phase-checked lifecycle around it.
Source
Source: lib/reducer/src/bytes/root.zig
zig
//! The search deletes bytes from an input that reproduces a defect until a//! smaller input still reproduces it, carrying out *test-case reduction* over//! byte sequences. It works on any `[]const u8`, and it finds a shorter//! *subsequence* of the input (a sequence obtained from another by deleting//! bytes and keeping the order of the rest) that still reproduces the failure.//! Two properties bound a run. First, the *attempt budget*, the ceiling on the//! number of oracle calls (`Settings.max_attempts`), caps the work. Second, a//! given input with a given *oracle*, the caller's function (`InterestingFn`)//! that answers whether one candidate still reproduces the defect, yields the//! same result every time. The search works on the raw bytes of the input.//!//! ## Module Organization//!//! Four internal modules divide the work://! - `capacity` works out the upper bound on the memory a run needs and catches//! arithmetic overflow in that sum.//! - `model` declares the error sets, the oracle type `InterestingFn`, the//! status flag the search reports, and the settings a run reads.//! - `storage` holds the *workspace* (the one byte allocation `Storage` makes//! and reuses for every run), allocated up front and double-buffered, and//! checks each lifecycle step against the *phase* recorded for `alloc_phase`.//! - `reduction` runs the search itself, deleting a *chunk* at a time (the//! number of adjacent bytes one candidate deletes) and halving the chunk//! greedily.//!//! ## Dataflow Pipeline//!//! The five calls of a run connect in one order://! 1. `Storage.init(allocator, limits)` takes the caller's *limits* (the//! longest input it will submit), derives the layout *capacity* itself, and//! allocates the backing memory once.//! 2. `storage.activate()` seals the workspace into steady state.//! 3. `reduce()` acquires the workspace regions, runs the search with no//! backing allocation of its own, and returns a `Result` borrowing from the//! workspace (`Result.bytes` points into the workspace without owning//! memory).//! 4. `Result.deinit()` gives up the *lease* (one run's exclusive hold on the//! workspace, recorded by `in_use`), returning the workspace to steady and//! *idle* so the next run can acquire it.//! 5. `storage.deinit(allocator)` tears down the idle workspace and frees the//! backing memory./// Module holding the capacity derivation and the limits type.pub const capacity = @import("capacity.zig");/// Module holding the data types, the oracle function interface, the error/// sets, and the execution settings.pub const model = @import("model.zig");/// Module holding the reduction loop, the execution counters, and the borrowed/// result.pub const reduction = @import("reduce.zig");/// Module holding the workspace, allocated up front and double-buffered, and/// the phase-checked lifecycle around it.pub const storage = @import("storage.zig");/// Workspace layout derived from the caller's limits, sized so that a run in/// steady state needs no further allocation.pub const Capacity = capacity.Capacity;/// Stopping condition that ended the search, `one_minimal` or/// `budget_exhausted`.pub const Completion = model.Completion;/// Sizing constraint the caller supplies for the byte reduction workspace.pub const Limits = capacity.Limits;/// Set of errors the reduction framework produces while acquiring the workspace/// or checking the input.pub const Error = model.Error;/// Set of errors raised when the input exceeds the workspace bounds or another/// run already holds the workspace.pub const Exhaustion = model.Exhaustion;/// Oracle's answer about one candidate, `interesting` or `uninteresting`.pub const Interesting = model.Interesting;/// Type of the caller's oracle function pointer.pub const InterestingFn = model.InterestingFn;/// Options that control how a run executes.pub const Settings = model.Settings;/// Outcome of a run, with bytes borrowed from the acquired workspace.pub const Result = reduction.Result;/// Snapshot of one workspace's state, taken by value at the moment of the call.pub const Status = storage.Status;/// Workspace, allocated up front and double-buffered, that carries reduction in/// steady state.pub const Storage = storage.Storage;/// Shortens an initial byte sequence against the caller's oracle.pub const reduce = reduction.reduce;Source: lib/reducer/src/root.zig:313
zig
/// Namespace holding the byte-oriented implementation.pub const bytes = @import("bytes/root.zig");Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |