Long patch validation time is a limiting factor for automated program repair (APR). Though the duality between patch validation and mutation testing is recognized, so far there exists no study of systematically adapting mutation testing techniques to general-purpose patch validation. To address this gap, we investigate existing mutation testing techniques and identify five classes of acceleration techniques that are suitable for general-purpose patch validation. Among them, mutant schemata and mutant deduplication have not been adapted to general-purpose patch validation due to the arbitrary changes that third-party APR approaches may introduce. This presents two problems for adaption: 1) the difficulty of implementing the static equivalence analysis required by the state-of-the-art mutant deduplication approach; 2) the difficulty of capturing the changes of patches to the system state at runtime. To overcome these problems, we propose two novel approaches: 1) execution scheduling, which detects the equivalence between patches online, avoiding the static equivalence analysis and its imprecision; 2) interception-based instrumentation, which intercepts the changes of patches to the system state, avoiding a full interpreter and its overhead. Based on the contributions above, we implement ExpressAPR, a general-purpose patch validator for Java that integrates all recognized classes of techniques suitable for patch validation. Our large-scale evaluation with four APR approaches shows that ExpressAPR accelerates patch validation by 137.1x over plainvalidation or 8.8x over the state-of-the-art approach, making patch validation no longer the time bottleneck of APR. Patch validation time for a single bug can be reduced to within a few minutes on mainstream CPUs.
翻译:补丁验证时间过长是自动化程序修复(APR)面临的主要瓶颈。尽管已有研究认识到补丁验证与变异测试之间的对偶关系,但目前尚无系统性地将变异测试技术迁移至通用补丁验证领域的相关研究。为填补这一空白,本文系统梳理了现有变异测试技术,识别出五类适用于通用补丁验证的加速技术。其中,由于第三方APR方法可能引入任意性修改,变异模式(mutant schemata)与变异去重(mutant deduplication)尚未被应用于通用补丁验证。这带来了两大适配难题:1)实现现有最先进变异去重方法所需的静态等价分析存在困难;2)运行时捕获补丁对系统状态的修改存在困难。为解决上述问题,我们提出两种创新方法:1)执行调度技术,通过在线检测补丁间的等价性,避免静态等价分析及其精度损失;2)基于拦截的插桩技术,通过拦截补丁对系统状态的修改,避免全量解释器及其带来的性能开销。基于上述贡献,我们实现了ExpressAPR——一个面向Java的通用补丁验证器,集成了所有适用于补丁验证的加速技术。针对四种APR方法的大规模评估表明,ExpressAPR较普通验证方法加速137.1倍,较当前最先进方法加速8.8倍,使补丁验证不再成为APR的时间瓶颈。在主流CPU上,单个缺陷的补丁验证时间可缩短至数分钟内。