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.
翻译:JavaScript 应用大型手写测试套件测试符合 ECMAScript 标准 。 不仅在这种乏味的方法中, 它还完全依赖自然语言规范来区分行为, 而隐藏的实施细节也会影响行为并引入差异。 我们提议通过动态执行多填充物来生成符合性测试, 用于替换尚未得到广泛支持的更新的 JavaScript 语言特征。 然后我们用多数选票对 JavaScript 的多重实施进行这些生成的测试, 以识别正确的行为 。 为了便利多填码的生成, 我们引入了适合 JavaScript 动态特性的结构化符号输入模式。 在我们的评估中, 我们发现在广泛使用的核心- j 多元填充物中存在17个差异, 并且能够将翻译代码的分支覆盖率提高15%。 由于多填充物通常在标准化之前就已写, 我们的方法将允许维持和扩展标准化测试套件, 并减少努力 。