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 signal | |
| 35 import sys | 34 import sys |
| 36 import traceback | 35 import traceback |
| 37 | 36 |
| 38 from webkitpy.common.host import Host | 37 from webkitpy.common.host import Host |
| 39 from webkitpy.layout_tests.controllers.manager import Manager | 38 from webkitpy.layout_tests.controllers.manager import Manager |
| 39 from webkitpy.layout_tests.models.test_run_results import TestRunResults | |
|
Dirk Pranke
2013/09/13 05:37:31
Change this to
from webkitpy.layout_tests.models
r.kasibhatla
2013/09/13 13:43:35
Done.
| |
| 40 from webkitpy.layout_tests.port import configuration_options, platform_options | 40 from webkitpy.layout_tests.port import configuration_options, platform_options |
| 41 from webkitpy.layout_tests.views import buildbot_results | 41 from webkitpy.layout_tests.views import buildbot_results |
| 42 from webkitpy.layout_tests.views import printing | 42 from webkitpy.layout_tests.views import printing |
| 43 | 43 |
| 44 | 44 |
| 45 _log = logging.getLogger(__name__) | 45 _log = logging.getLogger(__name__) |
| 46 | 46 |
| 47 | 47 |
| 48 # This mirrors what the shell normally does. | |
| 49 INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128 | |
| 50 | |
| 51 # This is a randomly chosen exit code that can be tested against to | 48 # This is a randomly chosen exit code that can be tested against to |
| 52 # indicate that an unexpected exception occurred. | 49 # indicate that an unexpected exception occurred. |
| 53 EXCEPTIONAL_EXIT_STATUS = 254 | 50 EXCEPTIONAL_EXIT_STATUS = 254 |
| 54 | 51 |
| 55 | 52 |
| 56 def main(argv, stdout, stderr): | 53 def main(argv, stdout, stderr): |
| 57 options, args = parse_args(argv) | 54 options, args = parse_args(argv) |
| 58 | 55 |
| 59 if options.platform and 'test' in options.platform: | 56 if options.platform and 'test' in options.platform: |
| 60 # It's a bit lame to import mocks into real code, but this allows the us er | 57 # It's a bit lame to import mocks into real code, but this allows the us er |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 71 | 68 |
| 72 try: | 69 try: |
| 73 port = host.port_factory.get(options.platform, options) | 70 port = host.port_factory.get(options.platform, options) |
| 74 except NotImplementedError, e: | 71 except NotImplementedError, e: |
| 75 # FIXME: is this the best way to handle unsupported port names? | 72 # FIXME: is this the best way to handle unsupported port names? |
| 76 print >> stderr, str(e) | 73 print >> stderr, str(e) |
| 77 return EXCEPTIONAL_EXIT_STATUS | 74 return EXCEPTIONAL_EXIT_STATUS |
| 78 | 75 |
| 79 try: | 76 try: |
| 80 run_details = run(port, options, args, stderr) | 77 run_details = run(port, options, args, stderr) |
| 81 if run_details.exit_code != -1: | 78 if run_details.exit_code != -1 and not run_details.initial_results.keybo ard_interrupted: |
| 82 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug _rwt_logging) | 79 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug _rwt_logging) |
| 83 bot_printer.print_results(run_details) | 80 bot_printer.print_results(run_details) |
| 84 | 81 |
| 85 return run_details.exit_code | 82 return run_details.exit_code |
| 83 # We need to still handle KeyboardInterrupt, atleast for webkitpy unittest c ases. | |
| 86 except KeyboardInterrupt: | 84 except KeyboardInterrupt: |
| 87 return INTERRUPTED_EXIT_STATUS | 85 return TestRunResults.INTERRUPTED_EXIT_STATUS |
|
Dirk Pranke
2013/09/13 05:37:31
Now you can use the old unqualified name here.
r.kasibhatla
2013/09/13 13:43:35
Done.
| |
| 88 except BaseException as e: | 86 except BaseException as e: |
| 89 if isinstance(e, Exception): | 87 if isinstance(e, Exception): |
| 90 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) | 88 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) |
| 91 traceback.print_exc(file=stderr) | 89 traceback.print_exc(file=stderr) |
| 92 return EXCEPTIONAL_EXIT_STATUS | 90 return EXCEPTIONAL_EXIT_STATUS |
| 93 | 91 |
| 94 | 92 |
| 95 def parse_args(args): | 93 def parse_args(args): |
| 96 option_group_definitions = [] | 94 option_group_definitions = [] |
| 97 | 95 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 printer.print_config(port.results_directory()) | 345 printer.print_config(port.results_directory()) |
| 348 | 346 |
| 349 run_details = manager.run(args) | 347 run_details = manager.run(args) |
| 350 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) | 348 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) |
| 351 return run_details | 349 return run_details |
| 352 finally: | 350 finally: |
| 353 printer.cleanup() | 351 printer.cleanup() |
| 354 | 352 |
| 355 if __name__ == '__main__': | 353 if __name__ == '__main__': |
| 356 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) | 354 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) |
| OLD | NEW |