| Differences between
and this patch
- a/Tools/ChangeLog +14 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2017-02-23  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 NOBODY (OOPS!).
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
1
2017-02-23  Saam Barati  <sbarati@apple.com>
15
2017-02-23  Saam Barati  <sbarati@apple.com>
2
16
3
        Speculative fix for jsc timing out tests
17
        Speculative fix for jsc timing out tests
- a/Tools/Scripts/run-bindings-tests -1 / +7 lines
Lines 29-34 a/Tools/Scripts/run-bindings-tests_sec1
29
# patch. This makes it easier to track and review changes in generated code.
29
# patch. This makes it easier to track and review changes in generated code.
30
30
31
import optparse
31
import optparse
32
import os
32
import sys
33
import sys
33
from webkitpy.common.system import executive
34
from webkitpy.common.system import executive
34
35
Lines 43-53 def main(argv): a/Tools/Scripts/run-bindings-tests_sec2
43
        help='Disable verobse output')
44
        help='Disable verobse output')
44
    option_parser.add_option('--reset-results', action='store_true', default=False,
45
    option_parser.add_option('--reset-results', action='store_true', default=False,
45
        help='Overwrites the reference files with the generated results')
46
        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.')
46
    options, args = option_parser.parse_args()    
49
    options, args = option_parser.parse_args()    
47
50
48
    from webkitpy.bindings.main import BindingsTests
51
    from webkitpy.bindings.main import BindingsTests
49
52
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()
51
57
52
58
53
if __name__ == '__main__':
59
if __name__ == '__main__':
- a/Tools/Scripts/webkitpy/bindings/main.py -1 / +21 lines
Lines 23-28 a/Tools/Scripts/webkitpy/bindings/main.py_sec1
23
#
23
#
24
24
25
import fnmatch
25
import fnmatch
26
import json
26
import os
27
import os
27
import os.path
28
import os.path
28
import shutil
29
import shutil
Lines 35-46 from webkitpy.common.system.executive import ScriptError a/Tools/Scripts/webkitpy/bindings/main.py_sec2
35
36
36
class BindingsTests:
37
class BindingsTests:
37
38
38
    def __init__(self, reset_results, generators, executive, verbose, patterns):
39
    def __init__(self, reset_results, generators, executive, verbose, patterns, json_file_name):
39
        self.reset_results = reset_results
40
        self.reset_results = reset_results
40
        self.generators = generators
41
        self.generators = generators
41
        self.executive = executive
42
        self.executive = executive
42
        self.verbose = verbose
43
        self.verbose = verbose
43
        self.patterns = patterns
44
        self.patterns = patterns
45
        self.json_file_name = json_file_name
46
47
        if self.json_file_name:
48
            self.failures = []
49
            self.errors = []
44
50
45
    def generate_from_idl(self, generator, idl_file, output_directory, supplemental_dependency_file):
51
    def generate_from_idl(self, generator, idl_file, output_directory, supplemental_dependency_file):
46
        cmd = ['perl', '-w',
52
        cmd = ['perl', '-w',
Lines 109-119 class BindingsTests: a/Tools/Scripts/webkitpy/bindings/main.py_sec3
109
            except ScriptError, e:
115
            except ScriptError, e:
110
                output = e.output
116
                output = e.output
111
                exit_code = e.exit_code
117
                exit_code = e.exit_code
118
                if self.json_file_name:
119
                    self.errors.append("(%s) %s" % (generator, output_file))
112
120
113
            if exit_code or output:
121
            if exit_code or output:
114
                print 'FAIL: (%s) %s' % (generator, output_file)
122
                print 'FAIL: (%s) %s' % (generator, output_file)
115
                print output
123
                print output
116
                changes_found = True
124
                changes_found = True
125
                if self.json_file_name:
126
                    self.failures.append("(%s) %s" % (generator, output_file))
117
            elif self.verbose:
127
            elif self.verbose:
118
                print 'PASS: (%s) %s' % (generator, output_file)
128
                print 'PASS: (%s) %s' % (generator, output_file)
119
        return changes_found
129
        return changes_found
Lines 189-194 class BindingsTests: a/Tools/Scripts/webkitpy/bindings/main.py_sec4
189
        os.remove(window_constructors_file)
199
        os.remove(window_constructors_file)
190
        os.remove(workerglobalscope_constructors_file)
200
        os.remove(workerglobalscope_constructors_file)
191
        os.remove(dedicatedworkerglobalscope_constructors_file)
201
        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
192
        print ''
212
        print ''
193
        if all_tests_passed:
213
        if all_tests_passed:
194
            print 'All tests PASS!'
214
            print 'All tests PASS!'

Return to Bug 168626