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 |
40 from webkitpy.layout_tests.port import configuration_options, platform_options | 39 from webkitpy.layout_tests.port import configuration_options, platform_options |
41 from webkitpy.layout_tests.views import buildbot_results | 40 from webkitpy.layout_tests.views import buildbot_results |
42 from webkitpy.layout_tests.views import printing | 41 from webkitpy.layout_tests.views import printing |
43 | 42 |
44 | 43 |
45 _log = logging.getLogger(__name__) | 44 _log = logging.getLogger(__name__) |
46 | 45 |
47 | 46 |
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 | 47 # This is a randomly chosen exit code that can be tested against to |
52 # indicate that an unexpected exception occurred. | 48 # indicate that an unexpected exception occurred. |
53 EXCEPTIONAL_EXIT_STATUS = 254 | 49 EXCEPTIONAL_EXIT_STATUS = 254 |
54 | 50 |
55 | 51 |
56 def main(argv, stdout, stderr): | 52 def main(argv, stdout, stderr): |
57 options, args = parse_args(argv) | 53 options, args = parse_args(argv) |
58 | 54 |
59 if options.platform and 'test' in options.platform: | 55 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 | 56 # It's a bit lame to import mocks into real code, but this allows the us
er |
(...skipping 15 matching lines...) Expand all Loading... |
76 print >> stderr, str(e) | 72 print >> stderr, str(e) |
77 return EXCEPTIONAL_EXIT_STATUS | 73 return EXCEPTIONAL_EXIT_STATUS |
78 | 74 |
79 try: | 75 try: |
80 run_details = run(port, options, args, stderr) | 76 run_details = run(port, options, args, stderr) |
81 if run_details.exit_code != -1: | 77 if run_details.exit_code != -1: |
82 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug
_rwt_logging) | 78 bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug
_rwt_logging) |
83 bot_printer.print_results(run_details) | 79 bot_printer.print_results(run_details) |
84 | 80 |
85 return run_details.exit_code | 81 return run_details.exit_code |
86 except KeyboardInterrupt: | |
87 return INTERRUPTED_EXIT_STATUS | |
88 except BaseException as e: | 82 except BaseException as e: |
89 if isinstance(e, Exception): | 83 if isinstance(e, Exception): |
90 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) | 84 print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) |
91 traceback.print_exc(file=stderr) | 85 traceback.print_exc(file=stderr) |
92 return EXCEPTIONAL_EXIT_STATUS | 86 return EXCEPTIONAL_EXIT_STATUS |
93 | 87 |
94 | 88 |
95 def parse_args(args): | 89 def parse_args(args): |
96 option_group_definitions = [] | 90 option_group_definitions = [] |
97 | 91 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 printer.print_config(port.results_directory()) | 341 printer.print_config(port.results_directory()) |
348 | 342 |
349 run_details = manager.run(args) | 343 run_details = manager.run(args) |
350 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) | 344 _log.debug("Testing completed, Exit status: %d" % run_details.exit_code) |
351 return run_details | 345 return run_details |
352 finally: | 346 finally: |
353 printer.cleanup() | 347 printer.cleanup() |
354 | 348 |
355 if __name__ == '__main__': | 349 if __name__ == '__main__': |
356 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) | 350 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) |
OLD | NEW |