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 recognize 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 patches' changes 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 patches' changes 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 plain validation 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)的一个限制因素。尽管补丁验证与变异测试之间的对偶性已被认识,但目前尚无研究系统性地将变异测试技术适配到通用补丁验证中。为填补这一空白,我们研究了现有变异测试技术,并识别出五类适用于通用补丁验证的加速技术。其中,变异模式(mutant schemata)和变异去重(mutant deduplication)由于第三方APR方法可能引入任意变更而未被适配到通用补丁验证中。这带来了两个适应性问题:1)实现最先进变异去重方法所需的静态等价性分析存在难度;2)在运行时捕获补丁对系统状态的变更存在难度。为解决这些问题,我们提出了两种新方法:1)执行调度(execution scheduling),在线检测补丁间的等价性,避免静态等价性分析及其不精确性;2)基于拦截的插桩(interception-based instrumentation),拦截补丁对系统状态的变更,避免完整解释器及其开销。基于上述贡献,我们实现了ExpressAPR——一个集成了所有适用于补丁验证的技术类别的Java通用补丁验证器。使用四种APR方法进行的大规模评估表明,ExpressAPR比普通验证提速137.1倍,比最先进方法提速8.8倍,使补丁验证不再成为APR的时间瓶颈。在主流通用CPU上,单个缺陷的补丁验证时间可缩短至数分钟以内。