| OLD | NEW |
| 1 # Copyright (C) 2012 Google, Inc. | 1 # Copyright (C) 2012 Google, Inc. |
| 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions | 5 # modification, are permitted provided that the following conditions |
| 6 # are met: | 6 # are met: |
| 7 # 1. Redistributions of source code must retain the above copyright | 7 # 1. Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # 2. Redistributions in binary form must reproduce the above copyright | 9 # 2. Redistributions in binary form must reproduce the above copyright |
| 10 # notice, this list of conditions and the following disclaimer in the | 10 # notice, this list of conditions and the following disclaimer in the |
| 11 # documentation and/or other materials provided with the distribution. | 11 # documentation and/or other materials provided with the distribution. |
| 12 # | 12 # |
| 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
| 14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR | 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
| 17 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 17 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | 23 |
| 24 """unit testing code for webkitpy.""" | 24 """unit testing code for webkitpy.""" |
| 25 | 25 |
| 26 import StringIO |
| 26 import logging | 27 import logging |
| 27 import multiprocessing | 28 import multiprocessing |
| 28 import optparse | 29 import optparse |
| 29 import os | 30 import os |
| 30 import StringIO | |
| 31 import sys | 31 import sys |
| 32 import time | 32 import time |
| 33 import traceback | 33 import traceback |
| 34 import unittest | 34 import unittest |
| 35 | 35 |
| 36 from webkitpy.common.webkit_finder import WebKitFinder | 36 from webkitpy.common.webkit_finder import WebKitFinder |
| 37 from webkitpy.common.system.filesystem import FileSystem | 37 from webkitpy.common.system.filesystem import FileSystem |
| 38 from webkitpy.common.system.executive import Executive | 38 from webkitpy.common.system.executive import Executive |
| 39 from webkitpy.test.finder import Finder | 39 from webkitpy.test.finder import Finder |
| 40 from webkitpy.test.printer import Printer | 40 from webkitpy.test.printer import Printer |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 return parser.parse_args(argv) | 111 return parser.parse_args(argv) |
| 112 | 112 |
| 113 def run(self): | 113 def run(self): |
| 114 argv = sys.argv[1:] | 114 argv = sys.argv[1:] |
| 115 self._options, args = self._parse_args(argv) | 115 self._options, args = self._parse_args(argv) |
| 116 | 116 |
| 117 # Make sure PYTHONPATH is set up properly. | 117 # Make sure PYTHONPATH is set up properly. |
| 118 sys.path = self.finder.additional_paths(sys.path) + sys.path | 118 sys.path = self.finder.additional_paths(sys.path) + sys.path |
| 119 | 119 |
| 120 # FIXME: unittest2 needs to be in sys.path for its internal imports to w
ork. | 120 # FIXME: coverage needs to be in sys.path for its internal imports to wo
rk. |
| 121 thirdparty_path = self.webkit_finder.path_from_webkit_base('Tools', 'Scr
ipts', 'webkitpy', 'thirdparty') | 121 thirdparty_path = self.webkit_finder.path_from_webkit_base('Tools', 'Scr
ipts', 'webkitpy', 'thirdparty') |
| 122 if not thirdparty_path in sys.path: | 122 if not thirdparty_path in sys.path: |
| 123 sys.path.append(thirdparty_path) | 123 sys.path.append(thirdparty_path) |
| 124 | 124 |
| 125 self.printer.configure(self._options) | 125 self.printer.configure(self._options) |
| 126 | 126 |
| 127 # Do this after configuring the printer, so that logging works properly. | 127 # Do this after configuring the printer, so that logging works properly. |
| 128 if self._options.coverage: | 128 if self._options.coverage: |
| 129 argv = ['-j', '1'] + [arg for arg in argv if arg not in ('-c', '--co
verage', '-j', '--child-processes')] | 129 argv = ['-j', '1'] + [arg for arg in argv if arg not in ('-c', '--co
verage', '-j', '--child-processes')] |
| 130 _log.warning('Checking code coverage, so running things serially') | 130 _log.warning('Checking code coverage, so running things serially') |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 def _log_exception(self): | 209 def _log_exception(self): |
| 210 s = StringIO.StringIO() | 210 s = StringIO.StringIO() |
| 211 traceback.print_exc(file=s) | 211 traceback.print_exc(file=s) |
| 212 for l in s.buflist: | 212 for l in s.buflist: |
| 213 _log.error(' ' + l.rstrip()) | 213 _log.error(' ' + l.rstrip()) |
| 214 | 214 |
| 215 | 215 |
| 216 | 216 |
| 217 if __name__ == '__main__': | 217 if __name__ == '__main__': |
| 218 sys.exit(main()) | 218 sys.exit(main()) |
| OLD | NEW |