Software Engineering
New Rust-Based Tool Accelerates Grammar-Constrained Test Input Generation by Thousands of Times
Researchers develop FANDANGO-RS, an evolutionary algorithm that dramatically speeds up the creation of test inputs for compilers and other software requiring complex constraint satisfaction.
Generating test inputs that satisfy multiple constraints is a critical task in software testing, but existing methods for this work have been painfully slow. A new research paper describes a system that solves this problem by orders of magnitude, cutting what previously took hours down to mere seconds.
The Challenge#
Language-based testing typically pairs context-free grammar definitions with semantic constraints to produce valid test inputs. This approach offers the flexibility of unrestricted grammars while maintaining a predictable structure. However, actually generating inputs that meet all constraints has proven difficult. Previous approaches relied on either SMT solvers (which excel at logic problems but struggle with strings) or evolutionary algorithms (which are faster but still falter on intricate, real-world constraints like those needed for compiler testing).
A Faster Approach#
The researchers behind the paper achieved their dramatic speedup through two key innovations:
- Compiler-optimized type generation: They transform grammar rules into native Rust types and trait implementations, allowing the Rust compiler to apply aggressive optimizations to operations across arbitrary grammars.
- Better evolutionary algorithms: They deployed improved evolutionary search strategies that more effectively handle complex constraint systems than prior implementations.
Real-World Performance#
Their prototype, FANDANGO-RS, demonstrates the impact. In a case study targeting a C language subset, the tool generated 401 distinct, syntactically valid test inputs for a C compiler every minute—solving constraints that earlier systems could not manage at all. The overall performance gain reaches 3–4 orders of magnitude over the state of the art, transforming constraint-solving from a hours-long task into a seconds-long process.
Why It Matters#
Faster test input generation unlocks more thorough compiler testing and broader application to domains where constraint satisfaction has been a bottleneck. By pairing expressive grammar definitions with practical solving speed, this work opens new possibilities for automated quality assurance in language implementations and other domains requiring controlled input generation.