arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

DBcover:一种用于提升覆盖率的白盒SQL测试生成框架

DBcover: A White-box SQL Test Generation Framework for Coverage Improvement

Yankai Rong, Shuang Liu, Jinhao Dong, Qiang Yin, Wei Lu, Jianhua Wang, Xiaoyong Du

arXiv 2608.25573首次发表:更新:

AI 中文总结

针对RDBMS测试覆盖率提升难题,提出LLM驱动的白盒SQL测试生成框架DBcover,经实验在PostgreSQL、MySQL及KingbaseES上均实现有效覆盖率提升。

AI 中文摘要

关系数据库管理系统(RDBMS)是现代数据密集型应用的核心,其可靠性和稳健性至关重要。然而,由于庞大的代码库和复杂的执行逻辑,在RDBMS测试中实现高覆盖率仍然具有挑战性。传统模糊测试依赖随机SQL生成,无法捕捉SQL输入与内部执行路径之间的对应关系;而符号执行则存在成本过高和可扩展性受限的问题。我们提出DBcover,一种基于上下文推理的大语言模型(LLM)驱动的白盒SQL测试生成框架。DBcover使用轻量级动态分析提取SQL到路径的对应关系和调用图作为全局上下文,并收集目标函数周围的源代码级信息作为局部上下文。这些上下文被组织成统一的知识图谱,以便高效检索和复用。DBcover执行两阶段测试生成:首先选择执行路径接近未覆盖目标的语义相关种子,然后利用全局和局部上下文引导LLM生成能触发先前未覆盖代码区域的SQL测试用例。实验表明,DBcover在PostgreSQL和MySQL上分别达到80.1%和82.3%的覆盖率,在企业级RDBMS人大金仓(KingbaseES)上也表现有效,证明其对闭源系统的实际适用性。

英文摘要

Relational Database Management Systems (RDBMSs) are the backbone of modern data-intensive applications, making reliability and robustness critical. However, achieving high coverage in RDBMS testing remains challenging because of large codebases and complex execution logic. Traditional fuzzing relies on random SQL generation and cannot capture the correspondence between SQL inputs and internal execution paths, while symbolic execution suffers from prohibitive cost and scalability limitations. We propose DBcover, an LLM-driven white-box SQL test generation framework based on contextual reasoning. DBcover uses lightweight dynamic analysis to extract SQL-to-path correspondence and call graphs as global context, and collects source-level information around target functions as local context. These contexts are organized in a unified knowledge graph for efficient retrieval and reuse. DBcover then performs two-phase test generation: it first selects a semantically relevant seed whose execution path is close to the uncovered target, and then guides the LLM with global and local context to generate SQL test cases that trigger previously uncovered code regions. Experiments show that DBcover achieves 80.1% and 82.3% coverage on PostgreSQL and MySQL, and is also effective on the enterprise RDBMS KingbaseES, demonstrating its practical applicability to closed-source systems.

CommentsAccepted to the ICSE 2026 Industry Challenge Track. 12 pages, 4 figures, 2 tables

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑