| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import StringIO | 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.system.filesystem import FileSystem | 36 from webkitpy.common.system.filesystem import FileSystem |
| 37 from webkitpy.test.finder import Finder | 37 from webkitpy.test.finder import Finder |
| 38 from webkitpy.test.printer import Printer | 38 from webkitpy.test.printer import Printer |
| 39 from webkitpy.test.runner import Runner, unit_test_name | 39 from webkitpy.test.runner import Runner, unit_test_name |
| 40 from webkitpy.thirdparty import coverage |
| 40 | 41 |
| 41 _log = logging.getLogger(__name__) | 42 _log = logging.getLogger(__name__) |
| 42 | 43 |
| 43 | 44 |
| 44 def main(): | 45 def main(): |
| 45 up = os.path.dirname | 46 up = os.path.dirname |
| 46 webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) | 47 webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) |
| 47 | 48 |
| 48 tester = Tester() | 49 tester = Tester() |
| 49 tester.add_tree(os.path.join(webkit_root, 'Tools', 'Scripts'), 'webkitpy') | 50 tester.add_tree(os.path.join(webkit_root, 'Tools', 'Scripts'), 'webkitpy') |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if not names: | 116 if not names: |
| 116 _log.error('No tests to run') | 117 _log.error('No tests to run') |
| 117 return False | 118 return False |
| 118 | 119 |
| 119 return self._run_tests(names) | 120 return self._run_tests(names) |
| 120 | 121 |
| 121 def _run_tests(self, names): | 122 def _run_tests(self, names): |
| 122 # Make sure PYTHONPATH is set up properly. | 123 # Make sure PYTHONPATH is set up properly. |
| 123 sys.path = self.finder.additional_paths(sys.path) + sys.path | 124 sys.path = self.finder.additional_paths(sys.path) + sys.path |
| 124 | 125 |
| 125 # We autoinstall everything up so that we can run tests concurrently | |
| 126 # and not have to worry about autoinstalling packages concurrently. | |
| 127 self.printer.write_update("Checking autoinstalled packages ...") | |
| 128 from webkitpy.thirdparty import autoinstall_everything | |
| 129 installed_something = autoinstall_everything() | |
| 130 | |
| 131 # FIXME: There appears to be a bug in Python 2.6.1 that is causing multi
processing | |
| 132 # to hang after we install the packages in a clean checkout. | |
| 133 if installed_something: | |
| 134 _log.warning("We installed new packages, so running things serially
at first") | |
| 135 self._options.child_processes = 1 | |
| 136 | |
| 137 if self._options.coverage: | 126 if self._options.coverage: |
| 138 _log.warning("Checking code coverage, so running things serially") | 127 _log.warning("Checking code coverage, so running things serially") |
| 139 self._options.child_processes = 1 | 128 self._options.child_processes = 1 |
| 140 | 129 |
| 141 import webkitpy.thirdparty.autoinstalled.coverage as coverage | 130 cov = coverage.coverage(omit=["/usr/*", "*/webkitpy/thirdparty/*", "
/System/*"]) |
| 142 cov = coverage.coverage(omit=["/usr/*", "*/webkitpy/thirdparty/autoi
nstalled/*", "*/webkitpy/thirdparty/BeautifulSoup.py"]) | |
| 143 cov.start() | 131 cov.start() |
| 144 | 132 |
| 145 self.printer.write_update("Checking imports ...") | 133 self.printer.write_update("Checking imports ...") |
| 146 if not self._check_imports(names): | 134 if not self._check_imports(names): |
| 147 return False | 135 return False |
| 148 | 136 |
| 149 self.printer.write_update("Finding the individual test methods ...") | 137 self.printer.write_update("Finding the individual test methods ...") |
| 150 loader = _Loader() | 138 loader = _Loader() |
| 151 parallel_tests, serial_tests = self._test_names(loader, names) | 139 parallel_tests, serial_tests = self._test_names(loader, names) |
| 152 | 140 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if not hasattr(getattr(testCaseClass, attrname), '__call__'): | 216 if not hasattr(getattr(testCaseClass, attrname), '__call__'): |
| 229 return False | 217 return False |
| 230 return (any(attrname.startswith(prefix) for prefix in self.test_meth
od_prefixes)) | 218 return (any(attrname.startswith(prefix) for prefix in self.test_meth
od_prefixes)) |
| 231 testFnNames = filter(isTestMethod, dir(testCaseClass)) | 219 testFnNames = filter(isTestMethod, dir(testCaseClass)) |
| 232 testFnNames.sort() | 220 testFnNames.sort() |
| 233 return testFnNames | 221 return testFnNames |
| 234 | 222 |
| 235 | 223 |
| 236 if __name__ == '__main__': | 224 if __name__ == '__main__': |
| 237 sys.exit(main()) | 225 sys.exit(main()) |
| OLD | NEW |