系统生成JavaScript的一致性检验
Systematic Generation of Conformance Tests for JavaScript
摘要:
使用大型手写测试套件测试JavaScript实现是否符合ECMAScript标准。不仅在这一繁琐的方法中,它还完全依赖于自然语言规范来区分行为,而隐藏的实现细节也会影响行为并引入分歧。我们建议通过动态符号执行polyfills生成一致性测试,这些polyfills是尚未得到广泛支持的新JavaScript语言功能的替代品。然后,我们对多个JavaScript实现运行这些生成的测试,使用多数投票来识别正确的行为。为了便于测试生成polyfill代码,我们引入了一个模型,结构化的符号输入,适合于动态性质的JavaScript。在我们的评估中,我们在广泛使用的core-js polyfill中发现了17个分歧,并且能够将解释器代码中的分支覆盖率提高15%。因为polyfill通常在标准化之前就已经编写好了,所以我们的方法将允许以更少的工作来维护和扩展标准化测试套件。
英文摘要:
JavaScript implementations are tested for conformance to the ECMAScript standard using a large hand-written test suite. Not only in this a tedious approach, it also relies solely on the natural language specification for differentiating behaviors, while hidden implementation details can also affect behavior and introduce divergences. We propose to generate conformance tests through dynamic symbolic execution of polyfills, drop-in replacements for newer JavaScript language features that are not yet widely supported. We then run these generated tests against multiple implementations of JavaScript, using a majority vote to identify the correct behavior. To facilitate test generation for polyfill code, we introduce a model for structured symbolic inputs that is suited to the dynamic nature of JavaScript. In our evaluation, we found 17 divergences in the widely used core-js polyfill and were able to increase branch coverage in interpreter code by up to 15%. Because polyfills are typically written even before standardization, our approach will allow to maintain and extend standardization test suites with reduced effort.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。