Changeset 213097 in webkit


Ignore:
Timestamp:
Feb 27, 2017 3:07:25 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Add machine-readable results for bindings tests
https://bugs.webkit.org/show_bug.cgi?id=168626

Patch by Srinivasan Vijayaraghavan <svijayaraghavan@apple.com> on 2017-02-27
Reviewed by Alexey Proskuryakov.

  • Scripts/run-bindings-tests:

(main): Add optional --json-output command-line parameter.

  • Scripts/webkitpy/bindings/main.py:

(BindingsTests.init): Add variables to store machine-readable results.
(BindingsTests.detect_changes): Store results in machine-readable form if applicable.
(BindingsTests.main): Write data to JSON file if applicable.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r213091 r213097  
     12017-02-27  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
     2
     3        Add machine-readable results for bindings tests
     4        https://bugs.webkit.org/show_bug.cgi?id=168626
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * Scripts/run-bindings-tests:
     9        (main): Add optional --json-output command-line parameter.
     10        * Scripts/webkitpy/bindings/main.py:
     11        (BindingsTests.__init__): Add variables to store machine-readable results.
     12        (BindingsTests.detect_changes): Store results in machine-readable form if applicable.
     13        (BindingsTests.main): Write data to JSON file if applicable.
     14
    1152017-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Tools/Scripts/run-bindings-tests

    r210676 r213097  
    3030
    3131import optparse
     32import os
    3233import sys
    3334from webkitpy.common.system import executive
     
    4445    option_parser.add_option('--reset-results', action='store_true', default=False,
    4546        help='Overwrites the reference files with the generated results')
     47    option_parser.add_option('--json-output', action='store', type='string', dest='json_file_name',
     48        help='Create a file at specified path, listing test results in JSON format.')
    4649    options, args = option_parser.parse_args()   
    4750
    4851    from webkitpy.bindings.main import BindingsTests
    4952
    50     return BindingsTests(options.reset_results, [ 'JS' ], executive.Executive(), not options.no_verbose, args).main()
     53    if options.json_file_name:
     54        options.json_file_name = os.path.abspath(options.json_file_name)
     55
     56    return BindingsTests(options.reset_results, [ 'JS' ], executive.Executive(), not options.no_verbose, args, options.json_file_name).main()
    5157
    5258
  • trunk/Tools/Scripts/webkitpy/bindings/main.py

    r210676 r213097  
    2424
    2525import fnmatch
     26import json
    2627import os
    2728import os.path
     
    3637class BindingsTests:
    3738
    38     def __init__(self, reset_results, generators, executive, verbose, patterns):
     39    def __init__(self, reset_results, generators, executive, verbose, patterns, json_file_name):
    3940        self.reset_results = reset_results
    4041        self.generators = generators
     
    4243        self.verbose = verbose
    4344        self.patterns = patterns
     45        self.json_file_name = json_file_name
     46
     47        if self.json_file_name:
     48            self.failures = []
     49            self.errors = []
    4450
    4551    def generate_from_idl(self, generator, idl_file, output_directory, supplemental_dependency_file):
     
    110116                output = e.output
    111117                exit_code = e.exit_code
     118                if self.json_file_name:
     119                    self.errors.append("(%s) %s" % (generator, output_file))
    112120
    113121            if exit_code or output:
     
    115123                print output
    116124                changes_found = True
     125                if self.json_file_name:
     126                    self.failures.append("(%s) %s" % (generator, output_file))
    117127            elif self.verbose:
    118128                print 'PASS: (%s) %s' % (generator, output_file)
     
    190200        os.remove(workerglobalscope_constructors_file)
    191201        os.remove(dedicatedworkerglobalscope_constructors_file)
     202
     203        if self.json_file_name:
     204            json_data = {
     205                'failures': self.failures,
     206                'errors': self.errors,
     207            }
     208
     209            with open(self.json_file_name, 'w') as json_file:
     210                json.dump(json_data, json_file)
     211
    192212        print ''
    193213        if all_tests_passed:
Note: See TracChangeset for help on using the changeset viewer.