| 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 15 matching lines...) Expand all Loading... |
| 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 sys | 33 import sys |
| 34 import traceback | 34 import traceback |
| 35 | 35 |
| 36 from webkitpy.common import exit_codes |
| 36 from webkitpy.common.host import Host | 37 from webkitpy.common.host import Host |
| 37 from webkitpy.layout_tests.controllers.manager import Manager | 38 from webkitpy.layout_tests.controllers.manager import Manager |
| 38 from webkitpy.layout_tests.generate_results_dashboard import DashBoardGenerator | 39 from webkitpy.layout_tests.generate_results_dashboard import DashBoardGenerator |
| 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.factory import configuration_options, platform_o
ptions | 41 from webkitpy.layout_tests.port.factory import configuration_options, platform_o
ptions |
| 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 | 44 |
| 44 _log = logging.getLogger(__name__) | 45 _log = logging.getLogger(__name__) |
| 45 | 46 |
| 46 | 47 |
| 47 def main(argv, stdout, stderr): | 48 def main(argv, stdout, stderr): |
| 48 options, args = parse_args(argv) | 49 options, args = parse_args(argv) |
| 49 | 50 |
| 50 if options.platform and 'test' in options.platform and not 'browser_test' in
options.platform: | 51 if options.platform and 'test' in options.platform and not 'browser_test' in
options.platform: |
| 51 # It's a bit lame to import mocks into real code, but this allows the us
er | 52 # It's a bit lame to import mocks into real code, but this allows the us
er |
| 52 # to run tests against the test platform interactively, which is useful
for | 53 # to run tests against the test platform interactively, which is useful
for |
| 53 # debugging test failures. | 54 # debugging test failures. |
| 54 from webkitpy.common.host_mock import MockHost | 55 from webkitpy.common.host_mock import MockHost |
| 55 host = MockHost() | 56 host = MockHost() |
| 56 else: | 57 else: |
| 57 host = Host() | 58 host = Host() |
| 58 | 59 |
| 59 try: | 60 try: |
| 60 port = host.port_factory.get(options.platform, options) | 61 port = host.port_factory.get(options.platform, options) |
| 61 except (NotImplementedError, ValueError) as error: | 62 except (NotImplementedError, ValueError) as error: |
| 62 # FIXME: is this the best way to handle unsupported port names? | 63 # FIXME: is this the best way to handle unsupported port names? |
| 63 print >> stderr, str(error) | 64 print >> stderr, str(error) |
| 64 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 65 return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS |
| 65 | 66 |
| 66 try: | 67 try: |
| 67 return run(port, options, args, stderr, stdout).exit_code | 68 return run(port, options, args, stderr, stdout).exit_code |
| 68 | 69 |
| 69 # We need to still handle KeyboardInterrupt, at least for webkitpy unittest
cases. | 70 # We need to still handle KeyboardInterrupt, at least for webkitpy unittest
cases. |
| 70 except KeyboardInterrupt: | 71 except KeyboardInterrupt: |
| 71 return test_run_results.INTERRUPTED_EXIT_STATUS | 72 return exit_codes.INTERRUPTED_EXIT_STATUS |
| 72 except test_run_results.TestRunException as error: | 73 except test_run_results.TestRunException as error: |
| 73 print >> stderr, error.msg | 74 print >> stderr, error.msg |
| 74 return error.code | 75 return error.code |
| 75 except BaseException as error: | 76 except BaseException as error: |
| 76 if isinstance(error, Exception): | 77 if isinstance(error, Exception): |
| 77 print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, erro
r) | 78 print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, erro
r) |
| 78 traceback.print_exc(file=stderr) | 79 traceback.print_exc(file=stderr) |
| 79 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 80 return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS |
| 80 | 81 |
| 81 | 82 |
| 82 def parse_args(args): | 83 def parse_args(args): |
| 83 option_group_definitions = [] | 84 option_group_definitions = [] |
| 84 | 85 |
| 85 option_group_definitions.append( | 86 option_group_definitions.append( |
| 86 ('Platform options', platform_options())) | 87 ('Platform options', platform_options())) |
| 87 | 88 |
| 88 option_group_definitions.append( | 89 option_group_definitions.append( |
| 89 ('Configuration options', configuration_options())) | 90 ('Configuration options', configuration_options())) |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 def run(port, options, args, logging_stream, stdout): | 573 def run(port, options, args, logging_stream, stdout): |
| 573 logger = logging.getLogger() | 574 logger = logging.getLogger() |
| 574 logger.setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO
) | 575 logger.setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO
) |
| 575 | 576 |
| 576 printer = printing.Printer(port, options, logging_stream, logger=logger) | 577 printer = printing.Printer(port, options, logging_stream, logger=logger) |
| 577 try: | 578 try: |
| 578 run_details = _run_tests(port, options, args, printer) | 579 run_details = _run_tests(port, options, args, printer) |
| 579 printer.flush() | 580 printer.flush() |
| 580 | 581 |
| 581 if (not options.dry_run and | 582 if (not options.dry_run and |
| 582 (run_details.exit_code not in test_run_results.ERROR_CODES or | 583 (run_details.exit_code not in exit_codes.ERROR_CODES or |
| 583 run_details.exit_code == test_run_results.EARLY_EXIT_STATUS) an
d | 584 run_details.exit_code == exit_codes.EARLY_EXIT_STATUS) and |
| 584 not run_details.initial_results.keyboard_interrupted): | 585 not run_details.initial_results.keyboard_interrupted): |
| 585 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug
_rwt_logging) | 586 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug
_rwt_logging) |
| 586 bot_printer.print_results(run_details) | 587 bot_printer.print_results(run_details) |
| 587 stdout.flush() | 588 stdout.flush() |
| 588 | 589 |
| 589 _log.debug('Generating dashboard...') | 590 _log.debug('Generating dashboard...') |
| 590 gen_dash_board = DashBoardGenerator(port) | 591 gen_dash_board = DashBoardGenerator(port) |
| 591 gen_dash_board.generate() | 592 gen_dash_board.generate() |
| 592 _log.debug('Dashboard generated.') | 593 _log.debug('Dashboard generated.') |
| 593 | 594 |
| 594 _log.debug('') | 595 _log.debug('') |
| 595 _log.debug('Testing completed, Exit status: %d', run_details.exit_code) | 596 _log.debug('Testing completed, Exit status: %d', run_details.exit_code) |
| 596 | 597 |
| 597 # Temporary process dump for debugging windows timeout issues, see crbug
.com/522396. | 598 # Temporary process dump for debugging windows timeout issues, see crbug
.com/522396. |
| 598 _log.debug('') | 599 _log.debug('') |
| 599 _log.debug('Process dump:') | 600 _log.debug('Process dump:') |
| 600 for process in port.host.executive.process_dump(): | 601 for process in port.host.executive.process_dump(): |
| 601 _log.debug('\t%s', process) | 602 _log.debug('\t%s', process) |
| 602 | 603 |
| 603 return run_details | 604 return run_details |
| 604 | 605 |
| 605 finally: | 606 finally: |
| 606 printer.cleanup() | 607 printer.cleanup() |
| 607 | 608 |
| 608 if __name__ == '__main__': | 609 if __name__ == '__main__': |
| 609 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) | 610 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) |
| 610 sys.exit(exit_code) | 611 sys.exit(exit_code) |
| OLD | NEW |