| Differences between
and this patch
- 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 +173 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 = self.web_platform_test_importer.tests()
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
107
        # setup the necessary configuration files
108
        wpt_setup = WebPlatformTestSetup(self.port.host, self.options)
109
        wpt_setup.copy_webkit_testharnessreport()
110
        wpt_setup.copy_wpt_json_config()
111
112
        self.remove_test_expected_files()
113
114
        _log.info('Running tests...')
115
        self.run_tests_to_generate_test_baseline()
116
117
        # generate conformance results
118
        self.filesystem.maybe_make_directory(self.get_conformance_results_directory())
119
        self.results_manager().write_conformance_results(self.get_conformance_results_directory())
120
121
        return True
122
123
    def print_results_to_console(self):
124
        summary = self.results_manager().summary()
125
        _log.info('Run ' + str(summary['total']) + ' tests')
126
        _log.info('Pass: ' + str(summary['num_pass']))
127
        _log.info('Partial: ' + str(summary['num_partial']))
128
        _log.info('Fail: ' + str(summary['num_fail']))
129
        _log.info('Error: ' + str(summary['num_error']))
130
131
    def print_potential_test_expectations_update(self):
132
        test_expectations = TestExpectations(self.port).model()
133
        conformance = self.results_manager().conformance_results()
134
        # TODO: Finalize this check to get meaningful information
135
        for test in self.tests:
136
            if not test_expectations.has_test(test):
137
                if not conformance[test] == 'PASS':
138
                    _log.info('test ' + test + ' is not passing')
139
            elif conformance[test] == 'PASS':
140
                _log.info('test ' + test + ' is now passing')
141
142
143
def configure_logging():
144
    class LogHandler(logging.StreamHandler):
145
        def format(self, record):
146
            if record.levelno > logging.INFO:
147
                return "%s: %s" % (record.levelname, record.getMessage())
148
            return record.getMessage()
149
150
    logger = logging.getLogger()
151
    logger.setLevel(logging.INFO)
152
    handler = LogHandler()
153
    handler.setLevel(logging.INFO)
154
    logger.addHandler(handler)
155
    return handler
156
157
158
def main(argv, stdout, stderr):
159
    configure_logging()
160
    host = Host()
161
    parser = w3c_create_argument_parser(host, host.filesystem.basename(__file__))
162
    options, args = parser.parse_known_args(argv)
163
    port = host.port_factory.get(options.platform, optparse.Values({'webkit_test_runner': options.webkit_test_runner}))
164
165
    runner = W3CConformanceRunner(port, options)
166
    if runner.run_tests():
167
        runner.print_results_to_console()
168
        runner.print_potential_test_expectations_update()
169
        runner.remove_test_expected_files()
170
        _log.info("Results exported in '" + runner.get_conformance_results_directory() + "'")
171
172
if '__main__' == __name__:
173
    sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))
- a/Tools/Scripts/webkitpy/w3c/test_results_manager.py +163 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
        # Let's check whether some lines start with PASS or FAIL
106
        # Test is said to PASS if at least one line is PASS an no line is FAIL
107
        hasFail = False
108
        hasPass = False
109
        buf = io.StringIO(unicode(text, "utf-8"))
110
        for line in buf.readlines():
111
            if line.startswith('PASS'):
112
                hasPass = True
113
            elif line.startswith('FAIL'):
114
                hasFail = True
115
        if hasPass:
116
            return 'PARTIAL' if hasFail else 'PASS'
117
        if hasFail:
118
            return 'FAIL'
119
        return 'ERROR'
120
121
    def conformance_results(self):
122
        status = {}
123
        test_results = self.test_results()
124
        for test_name in self._tests:
125
            status[test_name] = self._get_conformance_from_expected_text(test_name, self._port.expected_text(test_name), test_results)
126
        return status
127
128
    def summary(self):
129
        num_pass = num_partial = num_fail = num_error = 0
130
        status = self.conformance_results()
131
        for test_name in self._tests:
132
            result = status[test_name]
133
            if result == 'PASS':
134
                num_pass += 1
135
            elif result == 'PARTIAL':
136
                num_partial += 1
137
            elif result == 'FAIL':
138
                num_fail += 1
139
            else:
140
                num_error += 1
141
        summary = {}
142
        summary['total'] = num_pass + num_fail + num_partial + num_error
143
        summary['num_pass'] = num_pass
144
        summary['num_fail'] = num_fail
145
        summary['num_partial'] = num_partial
146
        summary['num_error'] = num_error
147
        return summary
148
149
    def write_conformance_results(self, path):
150
        status = self.conformance_results()
151
        results = {}
152
        results['conformance_results'] = status
153
        results['port_name'] = self._port.port_name
154
        # copy conformance results as json data
155
        json_string = json.dumps(results, separators=(',', ':'))
156
        json_string = self._JSON_PREFIX + json_string + self._JSON_SUFFIX
157
        self._filesystem.write_text_file(self._filesystem.join(path, 'w3c_conformance_results.json'), json_string)
158
        # copy html template
159
        results_file = self._port.path_from_webkit_base('LayoutTests', 'imported', 'w3c', 'resources', 'w3c_conformance_results.html')
160
        # Note that the results.html template file won't exist when we're using a MockFileSystem during unit tests,
161
        # so make sure it exists before we try to copy it.
162
        if self._filesystem.exists(results_file):
163
            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-wpt.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-wpt.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/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