Symbolic execution is a widely used technique for test generation, offering systematic exploration of program paths through constraint solving. However, it is fundamentally constrained by the capability to model the target code, including library functions, in terms of symbolic constraints and by the capability of underlying constraint solvers. As a result, many paths involving complex features remain unanalyzed or insufficiently modeled. Recent advances in large language models (LLMs) have shown promise in generating diverse and valid test inputs. Yet, LLMs lack mechanisms for systematically enumerating program paths and often fail to cover subtle corner cases. We observe that directly prompting an LLM with the full program leads to missed coverage of interesting paths. In this paper, we present PALM, a test generation system that combines symbolic path enumeration with LLM-assisted test generation. PALM statically enumerates possible paths through AST-level analysis and transforms each into an executable variant with embedded assertions that specify the target path. This avoids the need to translate path constraints into SMT formulas, by instead constructing program variants that the LLM can interpret. Importantly, PALM provides an interactive frontend that visualizes path coverage alongside generated tests, assembling tests based on the specific paths they exercise. A user study with 12 participants demonstrates that PALM's frontend helps users better understand path coverage and identify which paths are actually exercised by PALM-generated tests through verification and visualization of their path profiles.
翻译:符号执行是一种广泛应用的测试生成技术,通过约束求解实现对程序路径的系统性探索。然而,该技术本质上受限于将目标代码(包括库函数)建模为符号约束的能力,以及底层约束求解器的求解能力。因此,许多涉及复杂特性的路径仍未被分析或未能充分建模。近期大语言模型(LLMs)的发展在生成多样化且有效的测试输入方面展现出潜力。然而,LLMs缺乏系统枚举程序路径的机制,且往往难以覆盖微妙的边界情况。我们观察到,直接向LLM提供完整程序进行提示会导致遗漏具有研究价值的路径。本文提出PALM,一个将符号路径枚举与LLM辅助测试生成相结合的系统。PALM通过抽象语法树(AST)级别的静态分析枚举可能的路径,并将每条路径转换为包含嵌入式断言的可执行变体,这些断言明确了目标路径的具体要求。该方法无需将路径约束转换为可满足性模理论(SMT)公式,而是构建LLM能够解释的程序变体。值得注意的是,PALM提供了一个交互式前端界面,可同步可视化路径覆盖情况与生成的测试用例,并根据测试实际执行的路径进行用例整合。一项包含12名参与者的用户研究表明,PALM的前端界面能帮助用户更好地理解路径覆盖情况,并通过路径执行轨迹的验证与可视化,准确识别PALM生成的测试实际执行的路径。