| Differences between
and this patch
- a/Tools/ChangeLog +44 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2014-07-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2
3
        Add support for automated W3C conformance testing
4
        https://bugs.webkit.org/show_bug.cgi?id=134766
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        W3CConformanceRunner imports W3C tests and generates expected.txt files.
9
        Conformance is checked by analyzing the generated results using TestResultsManager.
10
11
        * Scripts/run-w3c-conformance-tests: Added.
12
        * Scripts/webkitpy/w3c/run_w3c_conformance_tests.py: Added.
13
        (W3CConformanceRunner): Responsible of checking WebKit conformance against W3C test suite.
14
        (W3CConformanceRunner.__init__):
15
        (W3CConformanceRunner.get_conformance_results_directory):
16
        (W3CConformanceRunner.layout_tests_result_directory):
17
        (W3CConformanceRunner.test_suites):
18
        (W3CConformanceRunner.run_test_suites):
19
        (W3CConformanceRunner.run_tests_to_generate_test_baseline):
20
        (W3CConformanceRunner.remove_test_expected_files):
21
        (W3CConformanceRunner.results_manager):
22
        (W3CConformanceRunner.run_tests):
23
        (W3CConformanceRunner.print_results_to_console):
24
        (W3CConformanceRunner.print_potential_test_expectations_update):
25
        (configure_logging):
26
        (configure_logging.LogHandler):
27
        (configure_logging.LogHandler.format):
28
        (main):
29
        * Scripts/webkitpy/w3c/test_results_manager.py: Added.
30
        (TestResultsManager): Responsible of analysing conformance based on expected.txt files generation.
31
        (TestResultsManager.__init__):
32
        (TestResultsManager._get_test_results):
33
        (TestResultsManager.test_results):
34
        (TestResultsManager._get_conformance_from_expected_text):
35
        (TestResultsManager.conformance_results):
36
        (TestResultsManager.summary):
37
        (TestResultsManager.write_conformance_results):
38
        * Scripts/webkitpy/w3c/web_platform_test_setup.py: Added.
39
        (WebPlatformTestSetup): Update imported W3C test platform with WebKit specific files (testharness and web platform test server config file).
40
        (WebPlatformTestSetup.__init__):
41
        (WebPlatformTestSetup.restore_w3c_testharnessreport):
42
        (WebPlatformTestSetup.copy_webkit_testharnessreport):
43
        (WebPlatformTestSetup.copy_wpt_json_config):
44
1
2014-07-03  Shivakumar JM  <shiva.jm@samsung.com>
45
2014-07-03  Shivakumar JM  <shiva.jm@samsung.com>
2
46
3
        [EFL][WK2] Enhance the Minibrowser to show text search count and close search bar.
47
        [EFL][WK2] Enhance the Minibrowser to show text search count and close search bar.
- a/Tools/Scripts/run-w3c-conformance-tests +31 lines
Line 0 a/Tools/Scripts/run-w3c-conformance-tests_sec1
1
#!/usr/bin/env python
2
3
# Copyright (c) 2014, Canon Inc. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
# 1.  Redistributions of source code must retain the above copyright
9
#     notice, this list of conditions and the following disclaimer.
10
# 2.  Redistributions in binary form must reproduce the above copyright
11
#     notice, this list of conditions and the following disclaimer in the
12
#     documentation and/or other materials provided with the distribution.
13
# 3.  Neither the name of Canon Inc. nor the names of
14
#     its contributors may be used to endorse or promote products derived
15
#     from this software without specific prior written permission.
16
#
17
# THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
18
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
# DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
21
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
"""Wrapper around webkitpy/w3c/run_w3c_conformance_tests.py"""
29
from webkitpy.common import multiprocessing_bootstrap
30
31
multiprocessing_bootstrap.run('webkitpy', 'w3c', 'run_w3c_conformance_tests.py')
- a/Tools/Scripts/webkitpy/w3c/run_w3c_conformance_tests.py +174 lines
Line 0 a/Tools/Scripts/webkitpy/w3c/run_w3c_conformance_tests.py_sec1
1
# Copyright (c) 2014, Canon Inc. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
5
# are met:
6
# 1.  Redistributions of source code must retain the above copyright
7
#     notice, this list of conditions and the following disclaimer.
8
# 2.  Redistributions in binary form must reproduce the above copyright
9
#     notice, this list of conditions and the following disclaimer in the
10
#     documentation and/or other materials provided with the distribution.
11
# 3.  Neither the name of Canon Inc. nor the names of
12
#     its contributors may be used to endorse or promote products derived
13
#     from this software without specific prior written permission.
14
#
15
# THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
16
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
# DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
19
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
"""
27
 This script evaluates W3C tests conformance by:
28
    - importing W3C tests as WebKit tests (using web_platform_test_importer)
29
    - generating expected.txt files (using run-webkit-tests)
30
    - computing whether a test is passing or not by checking PASS/FAIL assertions outputted within the expected.txt files
31
"""
32
33
import argparse
34
import logging
35
import optparse
36
import os
37
import sys
38
39
from webkitpy.common.host import Host
40
from webkitpy.common.system.executive import Executive
41
from webkitpy.layout_tests.models.test_expectations import TestExpectations
42
from webkitpy.port import platform_options
43
from webkitpy.w3c.factory import w3c_create_argument_parser
44
from webkitpy.w3c.test_results_manager import TestResultsManager
45
from webkitpy.w3c.web_platform_test_setup import WebPlatformTestSetup
46
from webkitpy.w3c.web_platform_test_importer import WebPlatformTestImporter
47
48
_log = logging.getLogger(__name__)
49
50
51
class W3CConformanceRunner(object):
52
53
    def __init__(self, port, options):
54
        self.port = port
55
        self.filesystem = port.host.filesystem
56
        self.options = options
57
        self.web_platform_test_importer = WebPlatformTestImporter(port, options)
58
        self.tests = None
59
        self._results_manager = None
60
61
    def get_conformance_results_directory(self):
62
        return self.filesystem.join(self.port.results_directory(), "..", "w3c-conformance-results")
63
64
    def layout_tests_result_directory(self):
65
        return self.filesystem.join(self.get_conformance_results_directory(), "layout-test-results")
66
67
    def test_suites(self):
68
        return self.web_platform_test_importer.test_suites()
69
70
    def run_test_suites(self, parameters):
71
        #TODO: clean this to have a better path computation
72
        up = os.path.dirname
73
        script_dir = up(up(up(os.path.abspath(__file__))))
74
        tmp_args = [self.filesystem.join(script_dir, 'run-webkit-tests')] + parameters + ['--results-directory=' + self.layout_tests_result_directory()]
75
        tmp_args.append('--' + self.options.platform)
76
        if self.options.webkit_test_runner is True:
77
            tmp_args.append('-2')
78
79
        #compute list of tests to run
80
        for test_suite in self.test_suites():
81
            path = self.filesystem.join('LayoutTests',  self.options.__dict__['importdir'], test_suite)
82
            tmp_args.append(path)
83
        Executive().run_command(tmp_args, error_handler=Executive.ignore_error, return_stderr=(not self.options.__dict__['w3c_verbose']), decode_output=False)
84
        self._results_manager = TestResultsManager(self.port, self.options.platform, self.options.__dict__['importdir'], self.layout_tests_result_directory(), self.tests)
85
86
    def run_tests_to_generate_test_baseline(self):
87
        self.run_test_suites(['-q', '--no-retry-failures', '--no-show-results', '--skipped=ignore'])
88
89
    def remove_test_expected_files(self):
90
        for test in self.tests:
91
            filename = self.port.expected_filename(test, '.txt', False)
92
            if not(filename is None):
93
                file_path = self.filesystem.join(self.port.layout_tests_dir(), filename)
94
                self.filesystem.remove(file_path)
95
96
    def results_manager(self):
97
        return self._results_manager
98
99
    def run_tests(self):
100
        if self.options.__dict__['w3c_list'] is True:
101
            return False
102
103
        # import tests
104
        _log.info('Importing tests...')
105
        self.web_platform_test_importer.import_tests()
106
        self.tests = self.web_platform_test_importer.tests()
107
108
        # setup the necessary configuration files
109
        wpt_setup = WebPlatformTestSetup(self.port.host, self.options)
110
        wpt_setup.copy_webkit_testharnessreport()
111
        wpt_setup.copy_wpt_json_config()
112
113
        self.remove_test_expected_files()
114
115
        _log.info('Running tests...')
116
        self.run_tests_to_generate_test_baseline()
117
118
        # generate conformance results
119
        self.filesystem.maybe_make_directory(self.get_conformance_results_directory())
120
        self.results_manager().write_conformance_results(self.get_conformance_results_directory())
121
122
        return True
123
124
    def print_results_to_console(self):
125
        summary = self.results_manager().summary()
126
        _log.info('Run ' + str(summary['total']) + ' tests')
127
        _log.info('Pass: ' + str(summary['num_pass']))
128
        _log.info('Partial: ' + str(summary['num_partial']))
129
        _log.info('Fail: ' + str(summary['num_fail']))
130
        _log.info('Error: ' + str(summary['num_error']))
131
132
    def print_potential_test_expectations_update(self):
133
        test_expectations = TestExpectations(self.port).model()
134
        conformance = self.results_manager().conformance_results()
135
        # TODO: Finalize this check to get meaningful information
136
        for test in self.tests:
137
            if not test_expectations.has_test(test):
138
                if not conformance[test] == 'PASS':
139
                    _log.info('test ' + test + ' is not passing')
140
            elif conformance[test] == 'PASS':
141
                _log.info('test ' + test + ' is now passing')
142
143
144
def configure_logging():
145
    class LogHandler(logging.StreamHandler):
146
        def format(self, record):
147
            if record.levelno > logging.INFO:
148
                return "%s: %s" % (record.levelname, record.getMessage())
149
            return record.getMessage()
150
151
    logger = logging.getLogger()
152
    logger.setLevel(logging.INFO)
153
    handler = LogHandler()
154
    handler.setLevel(logging.INFO)
155
    logger.addHandler(handler)
156
    return handler
157
158
159
def main(argv, stdout, stderr):
160
    configure_logging()
161
    host = Host()
162
    parser = w3c_create_argument_parser(host, host.filesystem.basename(__file__))
163
    options, args = parser.parse_known_args(argv)
164
    port = host.port_factory.get(options.platform, optparse.Values({'webkit_test_runner': options.webkit_test_runner}))
165
166
    runner = W3CConformanceRunner(port, options)
167
    if runner.run_tests():
168
        runner.print_results_to_console()
169
        runner.print_potential_test_expectations_update()
170
        runner.remove_test_expected_files()
171
        _log.info("Results exported in '" + runner.get_conformance_results_directory() + "'")
172
173
if '__main__' == __name__:
174
    sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))
- a/Tools/Scripts/webkitpy/w3c/test_results_manager.py +166 lines
Line 0 a/Tools/Scripts/webkitpy/w3c/test_results_manager.py_sec1
1
# Copyright (c) 2014, Canon Inc. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
5
# are met:
6
# 1.  Redistributions of source code must retain the above copyright
7
#     notice, this list of conditions and the following disclaimer.
8
# 2.  Redistributions in binary form must reproduce the above copyright
9
#     notice, this list of conditions and the following disclaimer in the
10
#     documentation and/or other materials provided with the distribution.
11
# 3.  Neither the name of Canon Inc. nor the names of
12
#     its contributors may be used to endorse or promote products derived
13
#     from this software without specific prior written permission.
14
#
15
# THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
16
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
# DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
19
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
"""
27
 This script manage JSON and results.html files for W3C test results.
28
29
"""
30
31
import collections
32
import fnmatch
33
import io
34
import json
35
import os
36
import tempfile
37
38
from webkitpy.common.host import Host
39
from webkitpy.layout_tests.layout_package import json_results_generator
40
41
42
class TestResultsManager(object):
43
44
    REASONS = ['TIMEOUT', 'CRASH', 'FAILURE']
45
    EXTENSIONS = ['.html', '.htm', '.xhtml', '.svg', '.xml', '.xht']
46
47
    _JSON_PREFIX = 'ADD_CONFORMANCE_RESULTS('
48
    _JSON_SUFFIX = ');'
49
50
    def __init__(self, port, platform, base_dir, result_dir, tests):
51
        self._port = port
52
        self._filesystem = port.host.filesystem
53
        self._results_directory = result_dir
54
        self._platform = platform
55
        self._tests = tests
56
        results_json_path = self._filesystem.join(self._results_directory, 'full_results.json')
57
        results_json = json_results_generator.load_json(self._filesystem, results_json_path)
58
59
        # Root directory of W3C imported test
60
        self._base_dir = base_dir
61
62
        # TODO: can we simplify this
63
        self._json_test_dict = None
64
        if results_json['tests']:
65
            path = []
66
            node = self._filesystem.split(self._base_dir)
67
            while node[0]:
68
                path.append(node[1])
69
                node = self._filesystem.split(node[0])
70
            path.append(node[1])
71
            path.reverse()
72
            self._json_test_dict = results_json['tests']
73
            for key in path:
74
                self._json_test_dict = self._json_test_dict[key]
75
76
    def _get_test_results(self, tests, test_dict=None, path=None):
77
        if test_dict is None:
78
            test_dict = self._json_test_dict
79
            if test_dict is None:
80
                return
81
        if path is None:
82
            path = self._base_dir
83
        for key in test_dict.keys():
84
            _path = self._filesystem.join(path, key)
85
            (filename, ext) = os.path.splitext(key)
86
            if ext in self.EXTENSIONS:
87
                tests[_path] = test_dict[key]
88
            else:
89
                # Process subdirectories
90
                self._get_test_results(tests, test_dict[key], _path)
91
92
    def test_results(self):
93
        test_results = {}
94
        self._get_test_results(test_results)
95
        return test_results
96
97
    def _get_conformance_from_expected_text(self, test_name, text, test_results):
98
        if text is None or len(text) == 0:
99
            # empty expected file, probably due to CRASH or TIMEOUT. Let's find why in json results.
100
            if test_name in test_results and 'actual' in test_results[test_name]:
101
                reason = test_results[test_name]['actual']
102
                if reason == 'CRASH' or reason == 'TIMEOUT':
103
                    return reason
104
                return 'ERROR'
105
            #If test is a ref test this is ok, otherwise this is an error
106
            # FIXME: We may want to validate that this is actually a ref test
107
            return 'PASS'
108
        # Let's check whether some lines start with PASS or FAIL
109
        # Test is said to PASS if at least one line is PASS an no line is FAIL
110
        hasFail = False
111
        hasPass = False
112
        buf = io.StringIO(unicode(text, "utf-8"))
113
        for line in buf.readlines():
114
            if line.startswith('PASS'):
115
                hasPass = True
116
            elif line.startswith('FAIL'):
117
                hasFail = True
118
        if hasPass:
119
            return 'PARTIAL' if hasFail else 'PASS'
120
        if hasFail:
121
            return 'FAIL'
122
        return 'ERROR'
123
124
    def conformance_results(self):
125
        status = {}
126
        test_results = self.test_results()
127
        for test_name in self._tests:
128
            status[test_name] = self._get_conformance_from_expected_text(test_name, self._port.expected_text(test_name), test_results)
129
        return status
130
131
    def summary(self):
132
        num_pass = num_partial = num_fail = num_error = 0
133
        status = self.conformance_results()
134
        for test_name in self._tests:
135
            result = status[test_name]
136
            if result == 'PASS':
137
                num_pass += 1
138
            elif result == 'PARTIAL':
139
                num_partial += 1
140
            elif result == 'FAIL':
141
                num_fail += 1
142
            else:
143
                num_error += 1
144
        summary = {}
145
        summary['total'] = num_pass + num_fail + num_partial + num_error
146
        summary['num_pass'] = num_pass
147
        summary['num_fail'] = num_fail
148
        summary['num_partial'] = num_partial
149
        summary['num_error'] = num_error
150
        return summary
151
152
    def write_conformance_results(self, path):
153
        status = self.conformance_results()
154
        results = {}
155
        results['conformance_results'] = status
156
        results['port_name'] = self._port.port_name
157
        # copy conformance results as json data
158
        json_string = json.dumps(results, separators=(',', ':'))
159
        json_string = self._JSON_PREFIX + json_string + self._JSON_SUFFIX
160
        self._filesystem.write_text_file(self._filesystem.join(path, 'w3c_conformance_results.json'), json_string)
161
        # copy html template
162
        results_file = self._port.path_from_webkit_base('LayoutTests', 'imported', 'w3c', 'resources', 'w3c_conformance_results.html')
163
        # Note that the results.html template file won't exist when we're using a MockFileSystem during unit tests,
164
        # so make sure it exists before we try to copy it.
165
        if self._filesystem.exists(results_file):
166
            self._filesystem.copyfile(results_file, self._filesystem.join(path, 'w3c_conformance_results.html'))
- a/Tools/Scripts/webkitpy/w3c/web_platform_test_setup.py +70 lines
Line 0 a/Tools/Scripts/webkitpy/w3c/web_platform_test_setup.py_sec1
1
#!/usr/bin/env python
2
3
# Copyright (c) 2014, Canon Inc. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
# 1.  Redistributions of source code must retain the above copyright
9
#     notice, this list of conditions and the following disclaimer.
10
# 2.  Redistributions in binary form must reproduce the above copyright
11
#     notice, this list of conditions and the following disclaimer in the
12
#     documentation and/or other materials provided with the distribution.
13
# 3.  Neither the name of Canon Inc. nor the names of
14
#     its contributors may be used to endorse or promote products derived
15
#     from this software without specific prior written permission.
16
#
17
# THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
18
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
# DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
21
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
"""
29
 This script allows setting up the web platform test parameters such as:
30
    - The config.json file used by the WPT http server
31
    - The testharnessreport.js used for web platform tests (copy of webkit testharnessreport.js).
32
"""
33
34
import logging
35
36
from webkitpy.common.host import Host
37
from webkitpy.common.webkit_finder import WebKitFinder
38
39
_log = logging.getLogger(__name__)
40
41
42
class WebPlatformTestSetup(object):
43
44
    def __init__(self, host, options):
45
        self.filesystem = host.filesystem
46
47
        webkit_finder = WebKitFinder(self.filesystem)
48
        self._webkit_root = webkit_finder.webkit_base()
49
        self._wpt_root = self.filesystem.join(self._webkit_root, 'LayoutTests', options.__dict__['importdir'])
50
        self._layout_root = self.filesystem.join(self._webkit_root, "LayoutTests")
51
52
    def restore_w3c_testharnessreport(self):
53
        _log.debug('Using W3C WPT testharnessreport.js')
54
        testharnessreport_wpt_filename = self.filesystem.join(self._wpt_root, "resources", "testharnessreport.js~")
55
        if self.filesystem.isfile(testharnessreport_wpt_filename):
56
            self.filesystem.copyfile(testharnessreport_wpt_filename, self.filesystem.join(self._wpt_root, "resources", "testharnessreport.js"))
57
            self.filesystem.remove(testharnessreport_wpt_filename)
58
59
    def copy_webkit_testharnessreport(self):
60
        _log.debug('Using WebKit testharnessreport.js')
61
        testharnessreport_wk_filename = self.filesystem.join(self._layout_root, "resources", "testharnessreport.js")
62
        if self.filesystem.isfile(testharnessreport_wk_filename):
63
            self.filesystem.copyfile(self.filesystem.join(self._wpt_root, "resources", "testharnessreport.js"), self.filesystem.join(self._wpt_root, "resources", "testharnessreport.js~"))
64
            self.filesystem.copyfile(self.filesystem.join(self._layout_root, "resources", "testharnessreport.js"), self.filesystem.join(self._wpt_root, "resources", "testharnessreport.js"))
65
66
    def copy_wpt_json_config(self):
67
        _log.debug('Copying json web platform server config')
68
        config_wpt_filename = self.filesystem.join(self._layout_root, "imported", "w3c", "config.json")
69
        if self.filesystem.isfile(config_wpt_filename):
70
            self.filesystem.copyfile(config_wpt_filename, self.filesystem.join(self._wpt_root, "config.json"))
- a/LayoutTests/imported/w3c/ChangeLog +18 lines
Lines 1-3 a/LayoutTests/imported/w3c/ChangeLog_sec1
1
2014-07-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2
3
        start supporting ref tests
4
5
        updating webplatform test setup to store testharnessreport.js as ~
6
7
        fixing test computation issue in run_w3c_conformance_tests
8
9
        adding conformance runner
10
11
        Add support for automated W3C conformance testing
12
        https://bugs.webkit.org/show_bug.cgi?id=134766
13
14
        Reviewed by NOBODY (OOPS!).
15
16
        * config.json: Added.
17
        * resources/w3c_conformance_results.html: Added.
18
1
2013-12-03  Ryosuke Niwa  <rniwa@webkit.org>
19
2013-12-03  Ryosuke Niwa  <rniwa@webkit.org>
2
20
3
        Import the XHTML parsing and serialization tests for template elements
21
        Import the XHTML parsing and serialization tests for template elements
- a/LayoutTests/imported/w3c/config.json +7 lines
Line 0 a/LayoutTests/imported/w3c/config.json_sec1
1
{"host": "localhost",
2
 "ports":{"http":[8800, 8801],
3
          "https":[],
4
          "ws":[49001]},
5
 "check_subdomains": false,
6
 "log_level":"debug",
7
 "bind_hostname": false}
- a/LayoutTests/imported/w3c/resources/w3c_conformance_results.html +135 lines
Line 0 a/LayoutTests/imported/w3c/resources/w3c_conformance_results.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
#results {
6
	display: table;
7
	clear: both;
8
	padding: 20px;
9
}
10
#summary {
11
	padding: 20px;
12
}
13
14
.test {
15
	display: table-row;
16
	background-color: lavender;
17
}
18
.testname, .testresult {
19
	border-bottom: 1px solid white;
20
	border-top: 1px solid white;
21
	padding-right: 10px;
22
	display: table-cell;
23
}
24
.testresult a {
25
	text-transform: capitalize;
26
}
27
28
.pass a {
29
	color: green;
30
}
31
32
.partial a {
33
	color: yellow;
34
}
35
36
.fail a {
37
	color: orange;
38
}
39
40
.timeout a {
41
	color: red;
42
}
43
44
.crash a {
45
	color: red;
46
}
47
48
.error a {
49
	color: red;
50
}
51
52
.error-results-hist {
53
    background-color: red;
54
    float: left;
55
}
56
57
.fail-results-hist {
58
    background-color: orange;
59
    float: left;
60
}
61
62
.partial-results-hist {
63
    background-color: yellow;
64
    float: left;
65
}
66
.pass-results-hist {
67
    background-color: green;
68
    float: left;
69
}
70
71
</style>
72
<script>
73
74
function pretty_testname(testname)
75
{
76
	return testname.replace("imported/w3c/wpt/","")
77
}
78
79
function get_test_link(testname)
80
{
81
	return "<a href='" + "../../../LayoutTests/" + testname + "'>" + pretty_testname(testname) + "</a>"
82
}
83
84
function get_test_result_link(testname, result)
85
{
86
	suffix = "." + testname.split('.').pop();
87
	return "<a href='" + "layout-test-results/" + testname.replace(suffix,"-actual.txt") + "'>" + result.toLowerCase() + "</a>"
88
}
89
90
function testSuiteHist(numError, numFail, numPartial, numPass)
91
{
92
    var total = numError + numPass + numPartial + numFail;
93
94
    html = '<div style="float:left;margin-right:10px"> Conformance summary </div> <div style="float:left;width:150px;">';
95
    if (numError)
96
        html += '<div class="error-results-hist" style="width:' + (100 * numError / total) + '%">&nbsp;</div>';
97
    if (numFail)
98
        html += '<div class="fail-results-hist" style="width:' + (100 * numFail / total)  + '%">&nbsp;</div>';
99
    if (numPartial)
100
        html += '<div class="partial-results-hist" style="width:' + (100 * numPartial / total) + '%">&nbsp;</div>';
101
    if (numPass)
102
        html += '<div class="pass-results-hist" style="width:' + (100 * numPass / total) + '%">&nbsp;</div>';
103
    html += '</div>';
104
    return html;
105
}
106
function ADD_CONFORMANCE_RESULTS(results)
107
{
108
	var numPass = numPartial = numFail = numError = 0
109
	var innerHTML = "<div class='test'><div class='testname'>Test Name</div><div class='testresult'>" + results.port_name.toUpperCase() + "</div></div>"
110
	Object.keys(results.conformance_results)
111
		.sort()
112
		.forEach(function(key, i) {
113
			result = results.conformance_results[key]
114
			innerHTML += "<div class='test'><div class='testname'>" + get_test_link(key) + "</div><div class='testresult " + result.toLowerCase() + "'>" + get_test_result_link(key, result) + "</div></div>"
115
			if (result == "PASS") numPass++
116
			else if (result == "PARTIAL") numPartial++
117
			else if (result == "FAIL") numFail++
118
			else numError++
119
       });
120
	document.getElementById("summary").innerHTML = testSuiteHist(numError, numFail, numPartial, numPass)
121
	document.getElementById("results").innerHTML = innerHTML
122
}
123
</script>
124
</head>
125
<body>
126
<div>
127
W3C conformance results from run-webkit-test (<a href="layout-test-results/results.html">run-webkit-test results</a>)
128
</div>
129
<div id="summary">
130
</div>
131
<div id="results">
132
</div>
133
<script src="w3c_conformance_results.json"></script>
134
</body>
135
</html>

Return to Bug 134766