Changeset 72458 in webkit
- Timestamp:
- Nov 19, 2010 5:49:50 PM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r72457 r72458 1 2010-11-19 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 nrwt multiprocessing - add 'worker number' concept, move stuff to worker thread 6 7 Add the 'worker number' and 'worker name' concepts to the 8 TestShellThread objects, and move test_types and test_args from 9 the TestRunner to the TestShellThread. 10 11 https://bugs.webkit.org/show_bug.cgi?id=49768 12 13 * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py: 14 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 15 1 16 2010-11-19 Dirk Pranke <dpranke@chromium.org> 2 17 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
r72457 r72458 50 50 import time 51 51 52 53 from webkitpy.layout_tests.test_types import image_diff 54 from webkitpy.layout_tests.test_types import test_type_base 55 from webkitpy.layout_tests.test_types import text_diff 56 52 57 import test_failures 53 58 import test_output … … 65 70 66 71 def _process_output(port, options, test_input, test_types, test_args, 67 test_output ):72 test_output, worker_name): 68 73 """Receives the output from a DumpRenderTree process, subjects it to a 69 74 number of tests, and returns a list of failure types the test produced. … … 77 82 test_args: arguments to be passed to each test 78 83 test_output: a TestOutput object containing the output of the test 84 worker_name: worker name for logging 79 85 80 86 Returns: a TestResult object … … 87 93 failures.append(test_failures.FailureTimeout()) 88 94 95 test_name = port.relative_test_filename(test_input.filename) 89 96 if test_output.crash: 90 _log.debug("Stacktrace for %s:\n%s" % (test_input.filename, 91 test_output.error)) 92 # Strip off "file://" since RelativeTestFilename expects 93 # filesystem paths. 94 filename = os.path.join(options.results_directory, 95 port.relative_test_filename( 96 test_input.filename)) 97 _log.debug("%s Stacktrace for %s:\n%s" % (worker_name, test_name, 98 test_output.error)) 99 filename = os.path.join(options.results_directory, test_name) 97 100 filename = os.path.splitext(filename)[0] + "-stack.txt" 98 101 port.maybe_make_directory(os.path.split(filename)[0]) … … 100 103 file.write(test_output.error) 101 104 elif test_output.error: 102 _log.debug("Previous test output stderr lines:\n%s" % test_output.error) 105 _log.debug("%s %s output stderr lines:\n%s" % (worker_name, test_name, 106 test_output.error)) 103 107 104 108 expected_test_output = _expected_test_output(port, test_input.filename) … … 144 148 145 149 146 def _run_single_test(port, options, test_input, test_types, test_args, driver ):150 def _run_single_test(port, options, test_input, test_types, test_args, driver, worker_name): 147 151 # FIXME: Pull this into TestShellThread._run(). 148 152 … … 158 162 test_output = driver.run_test(uri, test_input.timeout, image_hash_to_driver) 159 163 return _process_output(port, options, test_input, test_types, test_args, 160 test_output )164 test_output, worker_name) 161 165 162 166 … … 164 168 """Thread wrapper for running a single test file.""" 165 169 166 def __init__(self, port, options, test_input, test_types, test_args): 170 def __init__(self, port, options, worker_number, worker_name, 171 test_input, test_types, test_args): 167 172 """ 168 173 Args: 169 174 port: object implementing port-specific hooks 170 175 options: command line argument object from optparse 176 worker_number: worker number for tests 177 (FIXME: this should be passed to port.create_driver()). 178 worker_name: for logging 171 179 test_input: Object containing the test filename and timeout 172 180 test_types: A list of TestType objects to run the test output … … 182 190 self._test_args = test_args 183 191 self._driver = None 192 self._worker_number = worker_number 193 self._name = worker_name 184 194 185 195 def run(self): … … 194 204 self._test_result = _run_single_test(self._port, self._options, 195 205 self._test_input, self._test_types, 196 self._test_args, self._driver) 206 self._test_args, self._driver, 207 self._name) 197 208 self._driver.stop() 198 209 … … 237 248 238 249 class TestShellThread(WatchableThread): 239 def __init__(self, port, options, filename_list_queue, result_queue,240 test_types, test_args):250 def __init__(self, port, options, worker_number, 251 filename_list_queue, result_queue): 241 252 """Initialize all the local state for this DumpRenderTree thread. 242 253 … … 244 255 port: interface to port-specific hooks 245 256 options: command line options argument from optparse 257 worker_number: identifier for a particular worker thread. 246 258 filename_list_queue: A thread safe Queue class that contains lists 247 259 of tuples of (filename, uri) pairs. 248 260 result_queue: A thread safe Queue class that will contain 249 261 serialized TestResult objects. 250 test_types: A list of TestType objects to run the test output251 against.252 test_args: A TestArguments object to pass to each TestType.253 262 """ 254 263 WatchableThread.__init__(self) 255 264 self._port = port 256 265 self._options = options 266 self._worker_number = worker_number 267 self._name = 'worker-%d' % worker_number 257 268 self._filename_list_queue = filename_list_queue 258 269 self._result_queue = result_queue 259 270 self._filename_list = [] 260 self._test_types = test_types261 self._test_args = test_args262 271 self._driver = None 263 272 self._test_group_timing_stats = {} … … 270 279 self._http_lock_wait_end = 0 271 280 281 self._test_types = [] 282 for cls in self._get_test_type_classes(): 283 self._test_types.append(cls(self._port, 284 self._options.results_directory)) 285 self._test_args = self._get_test_args(worker_number) 286 272 287 # Current group of tests we're running. 273 288 self._current_group = None … … 276 291 # Time at which we started running tests from self._current_group. 277 292 self._current_group_start_time = None 293 294 def _get_test_args(self, worker_number): 295 """Returns the tuple of arguments for tests and for DumpRenderTree.""" 296 test_args = test_type_base.TestArguments() 297 test_args.png_path = None 298 if self._options.pixel_tests: 299 png_path = os.path.join(self._options.results_directory, 300 "png_result%s.png" % 301 self._worker_number) 302 test_args.png_path = png_path 303 test_args.new_baseline = self._options.new_baseline 304 test_args.reset_results = self._options.reset_results 305 306 return test_args 307 308 def _get_test_type_classes(self): 309 classes = [text_diff.TestTextDiff] 310 if self._options.pixel_tests: 311 classes.append(image_diff.ImageDiff) 312 return classes 278 313 279 314 def get_test_group_timing_stats(self): … … 447 482 worker = SingleTestThread(self._port, 448 483 self._options, 484 self._worker_number, 485 self._name, 449 486 test_input, 450 487 self._test_types, … … 496 533 test_result = _run_single_test(self._port, self._options, test_input, 497 534 self._test_types, self._test_args, 498 self._driver )535 self._driver, self._name) 499 536 self._test_results.append(test_result) 500 537 return test_result -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r72339 r72458 73 73 from layout_package import test_results 74 74 from layout_package import test_results_uploader 75 from test_types import image_diff76 from test_types import text_diff77 from test_types import test_type_base78 75 79 76 from webkitpy.common.system import user … … 254 251 # self._websocket_secure_server = websocket_server.PyWebSocket( 255 252 # options.results_directory, use_tls=True, port=9323) 256 257 # a list of TestType objects258 self._test_types = [text_diff.TestTextDiff]259 if options.pixel_tests:260 self._test_types.append(image_diff.ImageDiff)261 253 262 254 # a set of test files, and the same tests as a list … … 560 552 return filename_queue 561 553 562 def _get_test_args(self, index):563 """Returns the tuple of arguments for tests and for DumpRenderTree."""564 test_args = test_type_base.TestArguments()565 test_args.png_path = None566 if self._options.pixel_tests:567 png_path = os.path.join(self._options.results_directory,568 "png_result%s.png" % index)569 test_args.png_path = png_path570 test_args.new_baseline = self._options.new_baseline571 test_args.reset_results = self._options.reset_results572 573 return test_args574 575 554 def _contains_tests(self, subdir): 576 555 for test_file in self._test_files: … … 590 569 # Instantiate TestShellThreads and start them. 591 570 threads = [] 592 for i in xrange(int(self._options.child_processes)): 593 # Create separate TestTypes instances for each thread. 594 test_types = [] 595 for test_type in self._test_types: 596 test_types.append(test_type(self._port, 597 self._options.results_directory)) 598 599 test_args = self._get_test_args(i) 571 for worker_number in xrange(int(self._options.child_processes)): 600 572 thread = dump_render_tree_thread.TestShellThread(self._port, 601 self._options, filename_queue, self._result_queue,602 test_types, test_args)573 self._options, worker_number, 574 filename_queue, self._result_queue) 603 575 if self._is_single_threaded(): 604 576 thread.run_in_main_thread(self, result_summary)
Note: See TracChangeset
for help on using the changeset viewer.