数学执行:测试数字代码的统一方法
Mathematical Execution: A Unified Approach for Testing Numerical Code
摘要:
本文介绍了数学执行(ME),一个新的,统一的方法来测试数字代码。其核心思想是:(1)通过一个表示函数来捕获期望的测试目标;(2)将自动化测试问题转化为表示函数的最小化问题。最小化问题将通过数学优化来解决。ME的主要特征是它仅通过执行表示函数来指导输入空间探索,从而避免了对程序语义的静态或符号推理,这对于数字代码来说特别具有挑战性。为了说明这一特点,我们开发了一个基于ME的算法覆盖率为基础的测试的数字代码。我们还展示了应用和适应ME到其他相关问题的潜力,包括路径可达性测试,边界值分析和可满足性检查。为了证明ME的实际好处,我们实现了CoverMe,这是一个基于分支覆盖率测试的概念验证实现,并在Sun的C数学库(用于例如Android,Matlab,Java和JavaScript)上对其进行了评估。我们比较了CoverMe与随机测试和Austin,一个公开的基于分支覆盖的测试工具,支持数字代码(Austin结合了符号执行和基于搜索的自动化)。我们的实验结果表明,CoverMe实现了接近最佳的覆盖率,大大高于随机测试的所有测试程序,在所有评估的覆盖率指标。与Austin相比,CoverMe将分支覆盖率从43%提高到91%,所需时间明显缩短(平均6.9秒对6058.4秒)。
英文摘要:
This paper presents Mathematical Execution (ME), a new, unified approach for testing numerical code. The key idea is to (1) capture the desired testing objective via a representing function and (2) transform the automated testing problem to the minimization problem of the representing function. The minimization problem is to be solved via mathematical optimization. The main feature of ME is that it directs input space exploration by only executing the representing function, thus avoiding static or symbolic reasoning about the program semantics, which is particularly challenging for numerical code. To illustrate this feature, we develop an ME-based algorithm for coverage-based testing of numerical code. We also show the potential of applying and adapting ME to other related problems, including path reachability testing, boundary value analysis, and satisfiability checking. To demonstrate ME's practical benefits, we have implemented CoverMe, a proof-of-concept realization for branch coverage based testing, and evaluated it on Sun's C math library (used in, for example, Android, Matlab, Java and JavaScript). We have compared CoverMe with random testing and Austin, a publicly available branch coverage based testing tool that supports numerical code (Austin combines symbolic execution and search-based heuristics). Our experimental results show that CoverMe achieves near-optimal and substantially higher coverage ratios than random testing on all tested programs, across all evaluated coverage metrics. Compared with Austin, CoverMe improves branch coverage from 43% to 91%, with significantly less time (6.9 vs. 6058.4 seconds on average).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。