|
Lines 1-6
Tools/Scripts/webkitpy/test/main.py_sec1
|
| 1 |
# Copyright (C) 2012 Google, Inc. |
1 |
# Copyright (C) 2012 Google, Inc. |
| 2 |
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
2 |
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 3 |
# Copyright (C) 2018 Apple Inc. All rights reserved. |
3 |
# Copyright (C) 2018-2019 Apple Inc. All rights reserved. |
| 4 |
# |
4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without |
5 |
# Redistribution and use in source and binary forms, with or without |
| 6 |
# modification, are permitted provided that the following conditions |
6 |
# modification, are permitted provided that the following conditions |
|
Lines 38-54
import traceback
Tools/Scripts/webkitpy/test/main.py_sec2
|
| 38 |
import unittest |
38 |
import unittest |
| 39 |
|
39 |
|
| 40 |
from webkitpy.common.system.logutils import configure_logging |
40 |
from webkitpy.common.system.logutils import configure_logging |
| 41 |
from webkitpy.common.system.executive import Executive, ScriptError |
41 |
from webkitpy.common.system.executive import ScriptError |
| 42 |
from webkitpy.common.system.filesystem import FileSystem |
42 |
from webkitpy.common.system.filesystem import FileSystem |
| 43 |
from webkitpy.common.system.systemhost import SystemHost |
43 |
from webkitpy.common.host import Host |
| 44 |
from webkitpy.port.config import Config |
44 |
from webkitpy.port.config import Config |
| 45 |
from webkitpy.test.finder import Finder |
45 |
from webkitpy.test.finder import Finder |
| 46 |
from webkitpy.test.printer import Printer |
46 |
from webkitpy.test.printer import Printer |
| 47 |
from webkitpy.test.runner import Runner, unit_test_name |
47 |
from webkitpy.test.runner import Runner, unit_test_name |
|
|
48 |
from webkitpy.results.upload import Upload |
| 49 |
from webkitpy.results.options import upload_options |
| 48 |
|
50 |
|
| 49 |
_log = logging.getLogger(__name__) |
51 |
_log = logging.getLogger(__name__) |
| 50 |
|
52 |
|
| 51 |
_host = SystemHost() |
53 |
_host = Host() |
| 52 |
_webkit_root = None |
54 |
_webkit_root = None |
| 53 |
|
55 |
|
| 54 |
|
56 |
|
|
Lines 124-135
class Tester(object):
Tools/Scripts/webkitpy/test/main.py_sec3
|
| 124 |
parser = optparse.OptionParser(usage='usage: %prog [options] [args...]') |
126 |
parser = optparse.OptionParser(usage='usage: %prog [options] [args...]') |
| 125 |
|
127 |
|
| 126 |
# Configuration options only effect the building of lldbWebKitTester. |
128 |
# Configuration options only effect the building of lldbWebKitTester. |
| 127 |
configuration_group = optparse.OptionGroup(parser, 'Configuration options') |
129 |
for group_name, group_options in {'Upload Options': upload_options(), 'Configuration Options': [ |
| 128 |
configuration_group.add_option('--debug', action='store_const', const='Debug', dest="configuration", |
130 |
optparse.make_option('--debug', action='store_const', const='Debug', dest="configuration", |
| 129 |
help='Set the configuration to Debug') |
131 |
help='Set the configuration to Debug'), |
| 130 |
configuration_group.add_option('--release', action='store_const', const='Release', dest="configuration", |
132 |
optparse.make_option('--release', action='store_const', const='Release', dest="configuration", |
| 131 |
help='Set the configuration to Release') |
133 |
help='Set the configuration to Release'), |
| 132 |
parser.add_option_group(configuration_group) |
134 |
]}.iteritems(): |
|
|
135 |
option_group = optparse.OptionGroup(parser, group_name) |
| 136 |
option_group.add_options(group_options) |
| 137 |
parser.add_option_group(option_group) |
| 133 |
|
138 |
|
| 134 |
parser.add_option('-a', '--all', action='store_true', default=False, |
139 |
parser.add_option('-a', '--all', action='store_true', default=False, |
| 135 |
help='run all the tests') |
140 |
help='run all the tests') |
|
Lines 181-191
class Tester(object):
Tools/Scripts/webkitpy/test/main.py_sec4
|
| 181 |
from webkitpy.thirdparty import autoinstall_everything |
186 |
from webkitpy.thirdparty import autoinstall_everything |
| 182 |
autoinstall_everything() |
187 |
autoinstall_everything() |
| 183 |
|
188 |
|
|
|
189 |
start_time = time.time() |
| 190 |
config = Config(_host.executive, self.finder.filesystem) |
| 191 |
configuration_to_use = self._options.configuration or config.default_configuration() |
| 184 |
if will_run_lldb_webkit_tests: |
192 |
if will_run_lldb_webkit_tests: |
| 185 |
self.printer.write_update('Building lldbWebKitTester ...') |
193 |
self.printer.write_update('Building lldbWebKitTester ...') |
| 186 |
build_lldbwebkittester = self.finder.filesystem.join(_webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester') |
194 |
build_lldbwebkittester = self.finder.filesystem.join(_webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester') |
| 187 |
config = Config(_host.executive, self.finder.filesystem) |
|
|
| 188 |
configuration_to_use = self._options.configuration or config.default_configuration() |
| 189 |
try: |
195 |
try: |
| 190 |
_host.executive.run_and_throw_if_fail([build_lldbwebkittester, config.flag_for_configuration(configuration_to_use)], quiet=(not bool(self._options.verbose))) |
196 |
_host.executive.run_and_throw_if_fail([build_lldbwebkittester, config.flag_for_configuration(configuration_to_use)], quiet=(not bool(self._options.verbose))) |
| 191 |
except ScriptError as e: |
197 |
except ScriptError as e: |
|
Lines 218-223
class Tester(object):
Tools/Scripts/webkitpy/test/main.py_sec5
|
| 218 |
test_runner = Runner(self.printer, loader) |
224 |
test_runner = Runner(self.printer, loader) |
| 219 |
test_runner.run(parallel_tests, self._options.child_processes) |
225 |
test_runner.run(parallel_tests, self._options.child_processes) |
| 220 |
test_runner.run(serial_tests, 1) |
226 |
test_runner.run(serial_tests, 1) |
|
|
227 |
end_time = time.time() |
| 221 |
|
228 |
|
| 222 |
self.printer.print_result(time.time() - start) |
229 |
self.printer.print_result(time.time() - start) |
| 223 |
|
230 |
|
|
Lines 232-240
class Tester(object):
Tools/Scripts/webkitpy/test/main.py_sec6
|
| 232 |
if self._options.coverage: |
239 |
if self._options.coverage: |
| 233 |
cov.stop() |
240 |
cov.stop() |
| 234 |
cov.save() |
241 |
cov.save() |
|
|
242 |
|
| 243 |
failed_uploads = 0 |
| 244 |
if self._options.report_urls: |
| 245 |
self.printer.meter.writeln('\n') |
| 246 |
self.printer.write_update('Preparing upload data ...') |
| 247 |
|
| 248 |
results = {test: {} for test in test_runner.tests_run} |
| 249 |
for test, errors in test_runner.errors: |
| 250 |
results[test] = Upload.create_test_result(actual=Upload.Expectations.ERROR, log='/n'.join(errors)) |
| 251 |
for test, failures in test_runner.failures: |
| 252 |
results[test] = Upload.create_test_result(actual=Upload.Expectations.FAIL, log='/n'.join(failures)) |
| 253 |
|
| 254 |
_host.initialize_scm() |
| 255 |
upload = Upload( |
| 256 |
suite='webkitpy-tests', |
| 257 |
configuration=Upload.create_configuration( |
| 258 |
platform=_host.platform.os_name, |
| 259 |
version=str(_host.platform.os_version), |
| 260 |
version_name=_host.platform.os_version_name(), |
| 261 |
style=configuration_to_use, |
| 262 |
sdk=_host.platform.build_version(), |
| 263 |
), |
| 264 |
details=Upload.create_details(options=self._options), |
| 265 |
commits=[Upload.create_commit( |
| 266 |
repository_id='webkit', |
| 267 |
id=_host.scm().native_revision(_webkit_root), |
| 268 |
branch=_host.scm().native_branch(_webkit_root), |
| 269 |
)], |
| 270 |
run_stats=Upload.create_run_stats( |
| 271 |
start_time=start_time, |
| 272 |
end_time=end_time, |
| 273 |
tests_skipped=len(test_runner.tests_run) - len(parallel_tests) - len(serial_tests), |
| 274 |
), |
| 275 |
results=results, |
| 276 |
) |
| 277 |
for url in self._options.report_urls: |
| 278 |
self.printer.write_update('Uploading to {} ...'.format(url)) |
| 279 |
failed_uploads = failed_uploads if upload.upload(url, log_line=self.printer.meter.writeln) else (failed_uploads + 1) |
| 280 |
self.printer.meter.writeln('Uploads completed!') |
| 281 |
|
| 282 |
if self._options.coverage: |
| 235 |
cov.report(show_missing=False) |
283 |
cov.report(show_missing=False) |
| 236 |
|
284 |
|
| 237 |
return not self.printer.num_errors and not self.printer.num_failures |
285 |
return not self.printer.num_errors and not self.printer.num_failures and not failed_uploads |
| 238 |
|
286 |
|
| 239 |
def _check_imports(self, names): |
287 |
def _check_imports(self, names): |
| 240 |
for name in names: |
288 |
for name in names: |