Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged |
| 3 # Copyright (C) 2011 Apple Inc. All rights reserved. | 3 # Copyright (C) 2011 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 are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 import logging | 31 import logging |
| 32 import optparse | 32 import optparse |
| 33 import os | 33 import os |
| 34 import subprocess | |
| 34 import sys | 35 import sys |
| 35 import traceback | 36 import traceback |
| 36 | 37 |
| 37 from webkitpy.common.host import Host | 38 from webkitpy.common.host import Host |
| 38 from webkitpy.layout_tests.controllers.manager import Manager | 39 from webkitpy.layout_tests.controllers.manager import Manager |
| 39 from webkitpy.layout_tests.models import test_run_results | 40 from webkitpy.layout_tests.models import test_run_results |
| 40 from webkitpy.layout_tests.port import configuration_options, platform_options | 41 from webkitpy.layout_tests.port import configuration_options, platform_options |
| 41 from webkitpy.layout_tests.views import buildbot_results | 42 from webkitpy.layout_tests.views import buildbot_results |
| 42 from webkitpy.layout_tests.views import printing | 43 from webkitpy.layout_tests.views import printing |
| 43 from webkitpy.layout_tests.generate_results_dashboard import GenerateDashBoard | 44 from webkitpy.layout_tests.generate_results_dashboard import GenerateDashBoard |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 63 return run_checks(host, options, stderr) | 64 return run_checks(host, options, stderr) |
| 64 | 65 |
| 65 try: | 66 try: |
| 66 port = host.port_factory.get(options.platform, options) | 67 port = host.port_factory.get(options.platform, options) |
| 67 except NotImplementedError, e: | 68 except NotImplementedError, e: |
| 68 # FIXME: is this the best way to handle unsupported port names? | 69 # FIXME: is this the best way to handle unsupported port names? |
| 69 print >> stderr, str(e) | 70 print >> stderr, str(e) |
| 70 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 71 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS |
| 71 | 72 |
| 72 try: | 73 try: |
| 73 run_details = run(port, options, args, stderr) | 74 run_details = run_tests(port, options, args, stderr) |
| 74 if ((run_details.exit_code not in test_run_results.ERROR_CODES or | 75 if ((run_details.exit_code not in test_run_results.ERROR_CODES or |
| 75 run_details.exit_code == test_run_results.EARLY_EXIT_STATUS) and | 76 run_details.exit_code == test_run_results.EARLY_EXIT_STATUS) and |
| 76 not run_details.initial_results.keyboard_interrupted): | 77 not run_details.initial_results.keyboard_interrupted): |
| 77 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug _rwt_logging) | 78 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug _rwt_logging) |
| 78 bot_printer.print_results(run_details) | 79 bot_printer.print_results(run_details) |
| 79 | 80 |
| 80 if options.enable_versioned_results: | 81 if options.enable_versioned_results: |
| 81 gen_dash_board = GenerateDashBoard(port) | 82 gen_dash_board = GenerateDashBoard(port) |
| 82 gen_dash_board.generate() | 83 gen_dash_board.generate() |
| 83 | 84 |
| 84 return run_details.exit_code | 85 if run_details.exit_code != 0: |
| 86 return run_details.exit_code | |
| 87 | |
| 88 analyzer_result = run_analyzer(port, options, args, stderr) | |
| 89 return analyzer_result | |
| 85 | 90 |
| 86 # We need to still handle KeyboardInterrupt, atleast for webkitpy unittest c ases. | 91 # We need to still handle KeyboardInterrupt, atleast for webkitpy unittest c ases. |
| 87 except KeyboardInterrupt: | 92 except KeyboardInterrupt: |
| 88 return test_run_results.INTERRUPTED_EXIT_STATUS | 93 return test_run_results.INTERRUPTED_EXIT_STATUS |
| 89 except test_run_results.TestRunException as e: | 94 except test_run_results.TestRunException as e: |
| 90 print >> stderr, e.msg | 95 print >> stderr, e.msg |
| 91 return e.code | 96 return e.code |
| 92 except BaseException as e: | 97 except BaseException as e: |
| 93 if isinstance(e, Exception): | 98 if isinstance(e, Exception): |
| 94 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) | 99 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 | 367 |
| 363 if not options.test_list: | 368 if not options.test_list: |
| 364 options.test_list = [] | 369 options.test_list = [] |
| 365 options.test_list.append(port.host.filesystem.join(port.layout_tests_dir (), 'SmokeTests')) | 370 options.test_list.append(port.host.filesystem.join(port.layout_tests_dir (), 'SmokeTests')) |
| 366 if not options.skipped: | 371 if not options.skipped: |
| 367 options.skipped = 'always' | 372 options.skipped = 'always' |
| 368 | 373 |
| 369 if not options.skipped: | 374 if not options.skipped: |
| 370 options.skipped = 'default' | 375 options.skipped = 'default' |
| 371 | 376 |
| 372 def run(port, options, args, logging_stream): | 377 def run_tests(port, options, args, logging_stream): |
| 373 logger = logging.getLogger() | 378 logger = logging.getLogger() |
| 374 logger.setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO ) | 379 logger.setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO ) |
| 375 | 380 |
| 376 try: | 381 try: |
| 377 printer = printing.Printer(port, options, logging_stream, logger=logger) | 382 printer = printing.Printer(port, options, logging_stream, logger=logger) |
| 378 | 383 |
| 379 _set_up_derived_options(port, options, args) | 384 _set_up_derived_options(port, options, args) |
| 380 manager = Manager(port, options, printer) | 385 manager = Manager(port, options, printer) |
| 381 printer.print_config(port.results_directory()) | 386 printer.print_config(port.results_directory()) |
| 382 | 387 |
| 383 run_details = manager.run(args) | 388 run_details = manager.run(args) |
| 384 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) | 389 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) |
| 385 return run_details | 390 return run_details |
| 386 finally: | 391 finally: |
| 387 printer.cleanup() | 392 printer.cleanup() |
| 388 | 393 |
| 394 def run_analyzer(port, options, args, logging_stream): | |
| 395 build_dir = port.analyzer_build_directory() | |
| 396 test_dir = os.path.dirname(os.path.abspath(__file__)) | |
| 397 tools_dir = os.path.dirname(os.path.dirname(test_dir)) | |
| 398 analyzer_path = os.path.join(tools_dir, 'skyanalyzer') | |
| 399 mojo_dir = os.path.dirname(os.path.dirname(build_dir)) | |
|
abarth-chromium
2015/06/19 00:12:28
s/mojo_dir/src_dir/
We should really just compute
| |
| 400 analyzer_target_path = os.path.join(mojo_dir, 'sky/examples/stocks2/lib/stoc k_app.dart') | |
| 401 analyzer_args = [ | |
| 402 analyzer_path, | |
| 403 build_dir, | |
| 404 analyzer_target_path | |
| 405 ] | |
| 406 try: | |
| 407 output = subprocess.check_output(analyzer_args, stderr=subprocess.STDOUT ) | |
| 408 except subprocess.CalledProcessError as e: | |
| 409 print >> logging_stream, "Analyzer found new issues:" | |
| 410 print >> logging_stream, e.output | |
| 411 return e.returncode | |
| 412 return 0 | |
| 413 | |
| 389 if __name__ == '__main__': | 414 if __name__ == '__main__': |
| 390 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) | 415 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) |
| OLD | NEW |