11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci// 51cb0ef41Sopenharmony_ci// Run the test runner and dump a json file. Use this script to pass 61cb0ef41Sopenharmony_ci// the json file and return a list of failing tests that can be copied 71cb0ef41Sopenharmony_ci// to test262.status. 81cb0ef41Sopenharmony_ci// 91cb0ef41Sopenharmony_ci// Usage: 101cb0ef41Sopenharmony_ci// 111cb0ef41Sopenharmony_ci// Run the test runner to generate the results: 121cb0ef41Sopenharmony_ci// $ tools/run-tests.py --gn test262 --json-test-results=tools/.test262-results.json 131cb0ef41Sopenharmony_ci// 141cb0ef41Sopenharmony_ci// Run this script to print the formatted results: 151cb0ef41Sopenharmony_ci// $ node tools/test262-results-parser.js .test262-results.json 161cb0ef41Sopenharmony_ci// 171cb0ef41Sopenharmony_ci// Note: The json results file generated by the test runner should be 181cb0ef41Sopenharmony_ci// in the tools/ directly, which is the same dir as this script. 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_civar fs = require('fs'), 211cb0ef41Sopenharmony_ci path = require('path'); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_cifunction main() { 241cb0ef41Sopenharmony_ci if (process.argv.length === 2) { 251cb0ef41Sopenharmony_ci throw new Error('File name required as first arg.'); 261cb0ef41Sopenharmony_ci } 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci var fileName = process.argv[2], 291cb0ef41Sopenharmony_ci fullPath = path.join(__dirname, fileName), 301cb0ef41Sopenharmony_ci results = require(fullPath)[0].results, 311cb0ef41Sopenharmony_ci tests = new Set(); 321cb0ef41Sopenharmony_ci for (let result of results) { 331cb0ef41Sopenharmony_ci let [_, ...test] = result.name.split('/'); 341cb0ef41Sopenharmony_ci tests.add(` '${test.join('/')}': [FAIL],`); 351cb0ef41Sopenharmony_ci } 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci [...tests].sort().forEach(i => console.log(i)); 391cb0ef41Sopenharmony_ci} 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_cimain(); 42