| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 # It's a bit lame to import mocks into real code, but this allows the us
er | 51 # 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 | 52 # to run tests against the test platform interactively, which is useful
for |
| 53 # debugging test failures. | 53 # debugging test failures. |
| 54 from webkitpy.common.host_mock import MockHost | 54 from webkitpy.common.host_mock import MockHost |
| 55 host = MockHost() | 55 host = MockHost() |
| 56 else: | 56 else: |
| 57 host = Host() | 57 host = Host() |
| 58 | 58 |
| 59 try: | 59 try: |
| 60 port = host.port_factory.get(options.platform, options) | 60 port = host.port_factory.get(options.platform, options) |
| 61 except (NotImplementedError, ValueError) as e: | 61 except (NotImplementedError, ValueError) as error: |
| 62 # FIXME: is this the best way to handle unsupported port names? | 62 # FIXME: is this the best way to handle unsupported port names? |
| 63 print >> stderr, str(e) | 63 print >> stderr, str(error) |
| 64 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 64 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS |
| 65 | 65 |
| 66 try: | 66 try: |
| 67 return run(port, options, args, stderr, stdout).exit_code | 67 return run(port, options, args, stderr, stdout).exit_code |
| 68 | 68 |
| 69 # We need to still handle KeyboardInterrupt, at least for webkitpy unittest
cases. | 69 # We need to still handle KeyboardInterrupt, at least for webkitpy unittest
cases. |
| 70 except KeyboardInterrupt: | 70 except KeyboardInterrupt: |
| 71 return test_run_results.INTERRUPTED_EXIT_STATUS | 71 return test_run_results.INTERRUPTED_EXIT_STATUS |
| 72 except test_run_results.TestRunException as e: | 72 except test_run_results.TestRunException as error: |
| 73 print >> stderr, e.msg | 73 print >> stderr, error.msg |
| 74 return e.code | 74 return error.code |
| 75 except BaseException as e: | 75 except BaseException as error: |
| 76 if isinstance(e, Exception): | 76 if isinstance(error, Exception): |
| 77 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) | 77 print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, erro
r) |
| 78 traceback.print_exc(file=stderr) | 78 traceback.print_exc(file=stderr) |
| 79 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 79 return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS |
| 80 | 80 |
| 81 | 81 |
| 82 def parse_args(args): | 82 def parse_args(args): |
| 83 option_group_definitions = [] | 83 option_group_definitions = [] |
| 84 | 84 |
| 85 option_group_definitions.append( | 85 option_group_definitions.append( |
| 86 ("Platform options", platform_options())) | 86 ("Platform options", platform_options())) |
| 87 | 87 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 _log.debug("\t%s", process) | 599 _log.debug("\t%s", process) |
| 600 | 600 |
| 601 return run_details | 601 return run_details |
| 602 | 602 |
| 603 finally: | 603 finally: |
| 604 printer.cleanup() | 604 printer.cleanup() |
| 605 | 605 |
| 606 if __name__ == '__main__': | 606 if __name__ == '__main__': |
| 607 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) | 607 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) |
| 608 sys.exit(exit_code) | 608 sys.exit(exit_code) |
| OLD | NEW |