1// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// Run the test runner and dump a json file. Use this script to pass
6// the json file and return a list of failing tests that can be copied
7// to test262.status.
8//
9// Usage:
10//
11// Run the test runner to generate the results:
12// $ tools/run-tests.py --gn test262 --json-test-results=tools/.test262-results.json
13//
14// Run this script to print the formatted results:
15// $ node tools/test262-results-parser.js .test262-results.json
16//
17// Note: The json results file generated by the test runner should be
18// in the tools/ directly, which is the same dir as this script.
19
20var fs = require('fs'),
21    path = require('path');
22
23function main() {
24  if (process.argv.length === 2)  {
25    throw new Error('File name required as first arg.');
26  }
27
28  var fileName = process.argv[2],
29      fullPath = path.join(__dirname, fileName),
30      results = require(fullPath)[0].results,
31      tests = new Set();
32  for (let result of results) {
33    let [_, ...test] = result.name.split('/');
34    tests.add(`  '${test.join('/')}': [FAIL],`);
35  }
36
37
38  [...tests].sort().forEach(i => console.log(i));
39}
40
41main();
42