Overview
Test Case Shrinking is the reduction or simplification of a failing test input into a smaller form that still demonstrates the same verification failure. In the TestRIG context, the evidence describes this as automated simplification and shrinking enabled by interactive verification through RVFI-DII.
Role in TestRIG
TestRIG extends the RISC-V Formal Interface (RVFI) with Direct Instruction Injection (DII). The evidence distinguishes the two directions of the interface: DII is used for instruction input, while RVFI is used for trace output. Together, RVFI-DII supports full interactive verification, and that interactive mode enables automated simplification and shrinking.
This matters because a verification engine can inject candidate instruction streams and observe corresponding architectural traces. When a divergence or failure is found, the same interactive mechanism can be used to simplify the input sequence while preserving the failure condition.
Shrinking instruction sequences with branches
The evidence specifically notes that instruction injection allows straightforward shrinking of sequences with branches. Branches are often problematic for reducing generated programs because control flow can make it difficult to preserve the behavior that triggers a bug. In the TestRIG/RVFI-DII design, instructions are injected directly, making it easier to control and reduce the executed sequence.
Relationship to minimal tests
The evidence also identifies Symbolic QED as another approach that generates minimal tests for verification, including post-silicon verification, using a formal pipeline model. This places Test Case Shrinking within a broader family of techniques aimed at producing small, useful counterexamples or tests for debugging and validation.
Implementation context
RVFI-DII requires synchronization between injected instructions and trace entries. The evidence notes that canceled instructions create a challenge because RVFI-DII requires a single RVFI trace entry for each injected DII instruction. A mature design described in the evidence attaches a sequence ID to each RVFI instruction and carries it through the pipeline, allowing redirects to work naturally.
Practical impact
The evidence reports that instruction injection and its support for shrinking helped the authors replace instruction-level unit tests for the CHERI extension, improving productivity and assurance and enabling more efficient extension of simulators and processors.