arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.05987cs.SEcs.FLcs.PL
收藏

约束输入的高性能生成

High-Performance Generation of Constrained Inputs

CISPA Helmholtz Center for Information Security(CISPA 赫尔姆霍兹信息安全中心)

Addison Crump, Alexi Turcotte, José Antonio Zamudio Amaya, Andreas Zeller

AI总结:

研究基于语言测试中生成带约束输入的问题,提出将语法定义转换为Rust类型及使用更好进化算法的方法,使原型FANDANGO-RS性能大幅提升,能解决复杂约束,每分钟为C编译器生成401个有效测试输入。

摘要:

基于语言的测试将上下文无关语法定义与语法元素上的语义约束相结合来生成测试输入。通过将上下文无关语法与约束配对,用户拥有无限制语法的表达能力,同时保持简单结构。然而,在存在此类约束的情况下生成输入具有挑战性。过去的方法中,SMT求解器在寻找字符串解时非常慢;进化算法更快且更通用,但当前实现仍难以处理编译器测试等领域所需的复杂约束。本文提出一种新颖的基于进化语言的测试方法,性能比当前技术水平提高3到4个数量级,将生成和约束求解时间从数小时减少到数秒。通过将语法定义仔细转换为Rust类型和trait实现,以及使用更好的进化算法来实现。这些改进使我们的原型FANDANGO-RS能够解决以前策略无法处理的约束。通过对C子集的案例研究证明,FANDANGO-RS每分钟能够为C编译器生成401个不同、复杂且有效的测试输入。

英文摘要:

Language-based testing combines context-free grammar definitions with semantic constraints over grammar elements to generate test inputs. By pairing context-free grammars with constraints, users have the expressiveness of unrestricted grammars while retaining simple structure. However, producing inputs in the presence of such constraints can be challenging. In past approaches, SMT solvers have been found to be very slow at finding string solutions; evolutionary algorithms are faster and more general, but current implementations still struggle with complex constraints that would be required for domains such as compiler testing. In this paper, we present a novel approach for evolutionary language-based testing that improves performance by 3-4 orders of magnitude over the current state of the art, reducing hours of generation and constraint solving time to seconds. We accomplish this by (1) carefully transforming grammar definitions into Rust types and trait implementations, ensuring that the compiler may near-maximally optimize arbitrary operations on arbitrary grammars; and (2) using better evolutionary algorithms that improve the ability of language-based testing to solve complex constraint systems. These performance and algorithmic improvements allow our prototype, FANDANGO-RS, to solve constraints that previous strategies simply cannot handle. We demonstrate this by a case study for a C subset, in which FANDANGO-RS is able to generate 401 diverse, complex, and valid test inputs for a C compiler per minute.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑