一句话:提出随机差分测试方法,通过检测 C 代码覆盖率工具报告不一致来发现大量缺陷。
代码覆盖率工具广泛用于测试、模糊测试与调试等质量保障活动,但其自身可靠性鲜受关注。本文提出随机差分测试方法:生成随机输入程序,比较不同 C 代码覆盖率工具产生的覆盖率报告,将不一致视为潜在覆盖率缺陷。为有效报告缺陷,作者解决三个挑战:过滤触发同一缺陷的重复测试程序、自动将大程序缩减为保持相同性质的小程序、判定哪个工具存在缺陷。广泛评估验证了方法有效性,在 gcov 和 llvm-cov 中分别确认或修复 42 个和 28 个缺陷;案例表明覆盖率工具并不如预期可靠,亟需持续改进其可靠性,并开辟了覆盖率验证的新方向。
Reliable code coverage tools are critically important as it is heavily used to facilitate many quality assurance activities, such as software testing, fuzzing, and debugging. However, little attention has been devoted to assessing the reliability of code coverage tools. In this study, we propose a randomized differential testing approach to hunting for bugs in the most widely used C code coverage tools. Specifically, by generating random input programs, our approach seeks for inconsistencies in code coverage reports produced by different code coverage tools, and then identifies inconsistencies as potential code coverage bugs. To effectively report code coverage bugs, we addressed three specific challenges: (1) How to filter out duplicate test programs as many of them triggering the same bugs in code coverage tools; (2) how to automatically reduce large test programs to much smaller ones that have the same properties; and (3) how to determine which code coverage tools have bugs? The extensive evaluations validate the effectiveness of our approach, resulting in 42 and 28 confirmed/fixed bugs for gcov and llvm-cov, respectively. This case study indicates that code coverage tools are not as reliable as it might have been envisaged. It not only demonstrates the effectiveness of our approach, but also highlights the need to continue improving the reliability of code coverage tools. This work opens up a new direction in code coverage validation which calls for more attention in this area.
@inproceedings{YangZSS00X19,
title = {Hunting for Bugs in Code Coverage Tools via Randomized Differential Testing},
author = {Yibiao Yang and Yuming Zhou and Hao Sun and Zhendong Su and Zhiqiang Zuo and Lei Xu and Baowen Xu},
booktitle = {ICSE},
year = {2019},
doi = {10.1109/icse.2019.00061}
}