Changeset 72149 in webkit
- Timestamp:
- Nov 16, 2010 4:36:06 PM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r72147 r72149 1 2010-11-16 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Ojan Vafai. 4 5 new-run-webkit-tests: rename TestInfo to TestInput, move image hash to work thread 6 7 Rename the TestInfo class to TestInput to be clearer about its 8 function, and move the checksum-reading code into dump_render_tree_thread 9 to avoid cross-thread access. 10 11 https://bugs.webkit.org/show_bug.cgi?id=49573 12 13 * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py: 14 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 15 * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py: 16 1 17 2010-11-16 Dave Hyatt <hyatt@apple.com> 2 18 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
r71527 r72149 75 75 76 76 77 def _process_output(port, options, test_in fo, test_types, test_args,77 def _process_output(port, options, test_input, test_types, test_args, 78 78 crash, timeout, test_run_time, actual_checksum, 79 79 output, error): … … 85 85 options: command line options argument from optparse 86 86 proc: an active DumpRenderTree process 87 test_in fo: Object containing the test filename, uri and timeout87 test_input: Object containing the test filename, uri and timeout 88 88 test_types: list of test types to subject the output to 89 89 test_args: arguments to be passed to each test … … 105 105 106 106 if crash: 107 _log.debug("Stacktrace for %s:\n%s" % (test_in fo.filename, error))107 _log.debug("Stacktrace for %s:\n%s" % (test_input.filename, error)) 108 108 # Strip off "file://" since RelativeTestFilename expects 109 109 # filesystem paths. 110 110 filename = os.path.join(options.results_directory, 111 111 port.relative_test_filename( 112 test_in fo.filename))112 test_input.filename)) 113 113 filename = os.path.splitext(filename)[0] + "-stack.txt" 114 114 port.maybe_make_directory(os.path.split(filename)[0]) … … 123 123 for test_type in test_types: 124 124 start_diff_time = time.time() 125 new_failures = test_type.compare_output(port, test_in fo.filename,125 new_failures = test_type.compare_output(port, test_input.filename, 126 126 output, local_test_args, 127 127 options.configuration) … … 135 135 136 136 total_time_for_all_diffs = time.time() - start_diff_time 137 return test_results.TestResult(test_in fo.filename, failures, test_run_time,137 return test_results.TestResult(test_input.filename, failures, test_run_time, 138 138 total_time_for_all_diffs, time_for_diffs) 139 139 … … 154 154 155 155 156 def _image_hash(test_info, test_args, options): 157 """Returns the image hash of the test if it's needed, otherwise None.""" 158 if (test_args.new_baseline or test_args.reset_results or not options.pixel_tests): 159 return None 160 return test_info.image_hash() 156 def _should_fetch_expected_checksum(options): 157 return options.pixel_tests and not (options.new_baseline or options.reset_results) 161 158 162 159 … … 164 161 """Thread wrapper for running a single test file.""" 165 162 166 def __init__(self, port, options, test_in fo, test_types, test_args):163 def __init__(self, port, options, test_input, test_types, test_args): 167 164 """ 168 165 Args: 169 166 port: object implementing port-specific hooks 170 167 options: command line argument object from optparse 171 test_in fo: Object containing the test filename, uri and timeout168 test_input: Object containing the test filename, uri and timeout 172 169 test_types: A list of TestType objects to run the test output 173 170 against. … … 178 175 self._port = port 179 176 self._options = options 180 self._test_in fo = test_info177 self._test_input = test_input 181 178 self._test_types = test_types 182 179 self._test_args = test_args … … 189 186 # FIXME: this is a separate routine to work around a bug 190 187 # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. 191 test_info = self._test_info 188 189 # FIXME: Pull this into TestShellThread._run(). 190 test_input = self._test_input 191 test_input.uri = self._port.filename_to_uri(test_input.filename) 192 if _should_fetch_expected_checksum(self._options): 193 test_input.image_checksum = self._port.expected_checksum(test_input.filename) 194 195 start = time.time() 192 196 self._driver = self._port.create_driver(self._test_args.png_path, 193 197 self._options) 194 198 self._driver.start() 195 image_hash = _image_hash(test_info, self._test_args, self._options)196 start = time.time()197 199 crash, timeout, actual_checksum, output, error = \ 198 self._driver.run_test(test_in fo.uri.strip(), test_info.timeout,199 image_hash)200 self._driver.run_test(test_input.uri, test_input.timeout, 201 test_input.image_checksum) 200 202 end = time.time() 201 203 self._test_result = _process_output(self._port, self._options, 202 test_in fo, self._test_types, self._test_args,204 test_input, self._test_types, self._test_args, 203 205 crash, timeout, end - start, 204 206 actual_checksum, output, error) … … 259 261 against. 260 262 test_args: A TestArguments object to pass to each TestType. 261 262 263 """ 263 264 WatchableThread.__init__(self) … … 403 404 self._current_group_start_time = time.time() 404 405 405 test_in fo= self._filename_list.pop()406 test_input = self._filename_list.pop() 406 407 407 408 # We have a url, run tests. … … 409 410 self._num_tests += 1 410 411 if self._options.run_singly: 411 result = self._run_test_singly(test_in fo)412 result = self._run_test_singly(test_input) 412 413 else: 413 result = self._run_test(test_in fo)414 415 filename = test_in fo.filename414 result = self._run_test(test_input) 415 416 filename = test_input.filename 416 417 tests_run_file.write(filename + "\n") 417 418 if result.failures: … … 441 442 test_runner.update_summary(result_summary) 442 443 443 def _run_test_singly(self, test_in fo):444 def _run_test_singly(self, test_input): 444 445 """Run a test in a separate thread, enforcing a hard time limit. 445 446 … … 449 450 450 451 Args: 451 test_in fo: Object containing the test filename, uri and timeout452 test_input: Object containing the test filename, uri and timeout 452 453 453 454 Returns: … … 457 458 worker = SingleTestThread(self._port, 458 459 self._options, 459 test_in fo,460 test_input, 460 461 self._test_types, 461 462 self._test_args) … … 464 465 465 466 thread_timeout = _milliseconds_to_seconds( 466 _pad_timeout(int(test_in fo.timeout)))467 _pad_timeout(int(test_input.timeout))) 467 468 thread._next_timeout = time.time() + thread_timeout 468 469 worker.join(thread_timeout) … … 486 487 failures = [] 487 488 _log.error('Cannot get results of test: %s' % 488 test_in fo.filename)489 result = test_results.TestResult(test_in fo.filename, failures=[],489 test_input.filename) 490 result = test_results.TestResult(test_input.filename, failures=[], 490 491 test_run_time=0, total_time_for_all_diffs=0, time_for_diffs=0) 491 492 492 493 return result 493 494 494 def _run_test(self, test_in fo):495 def _run_test(self, test_input): 495 496 """Run a single test file using a shared DumpRenderTree process. 496 497 497 498 Args: 498 test_in fo: Object containing the test filename, uri and timeout499 test_input: Object containing the test filename, uri and timeout 499 500 500 501 Returns: a TestResult object. … … 505 506 # are generating a new baseline. (Otherwise, an image from a 506 507 # previous run will be copied into the baseline.) 507 image_hash = _image_hash(test_info, self._test_args, self._options) 508 509 # FIXME: Pull this into TestShellThread._run(). 510 test_input.uri = self._port.filename_to_uri(test_input.filename) 511 if _should_fetch_expected_checksum(self._options): 512 test_input.image_checksum = self._port.expected_checksum(test_input.filename) 508 513 start = time.time() 509 514 510 515 thread_timeout = _milliseconds_to_seconds( 511 _pad_timeout(int(test_in fo.timeout)))516 _pad_timeout(int(test_input.timeout))) 512 517 self._next_timeout = start + thread_timeout 513 518 514 519 crash, timeout, actual_checksum, output, error = \ 515 self._driver.run_test(test_in fo.uri, test_info.timeout, image_hash)520 self._driver.run_test(test_input.uri, test_input.timeout, test_input.image_checksum) 516 521 end = time.time() 517 522 518 523 result = _process_output(self._port, self._options, 519 test_in fo, self._test_types,524 test_input, self._test_types, 520 525 self._test_args, crash, 521 526 timeout, end - start, actual_checksum, -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r71952 r72149 91 91 92 92 93 class TestIn fo:93 class TestInput: 94 94 """Groups information about a test for easy passing of data.""" 95 95 96 def __init__(self, port,filename, timeout):97 """ Generates the URI and stores the filename and timeout for thistest.96 def __init__(self, filename, timeout): 97 """Holds the input parameters for a test. 98 98 Args: 99 99 filename: Full path to the test. 100 timeout: Timeout for running the test in TestShell.100 timeout: Timeout in msecs the driver should use while running the test 101 101 """ 102 # FIXME: filename should really be test_name as a relative path. 102 103 self.filename = filename 103 self._port = port 104 self.uri = port.filename_to_uri(filename) 104 # The image checksum is passed to the driver so that the driver can optionally not have 105 # to output the image if the checksums match. 106 self.image_checksum = None 105 107 self.timeout = timeout 106 self._image_checksum = -1 107 108 def image_hash(self): 109 # Read the image_hash lazily to reduce startup time. 110 # This class is accessed across threads, but only one thread should 111 # ever be dealing with any given TestInfo so no locking is needed. 112 # 113 # Note that we use -1 to indicate that we haven't read the value, 114 # because expected_checksum() returns a string or None. 115 if self._image_checksum == -1: 116 self._image_checksum = self._port.expected_checksum(self.filename) 117 return self._image_checksum 108 109 # FIXME: Maybe the URI shouldn't be part of the TestInput at all? 110 self.uri = None 118 111 119 112 … … 498 491 return return_value 499 492 500 def _get_test_in fo_for_file(self, test_file):501 """Returns the appropriate TestIn foobject for the file. Mostly this493 def _get_test_input_for_file(self, test_file): 494 """Returns the appropriate TestInput object for the file. Mostly this 502 495 is used for looking up the timeout value (in ms) to use for the given 503 496 test.""" 504 497 if self._expectations.has_modifier(test_file, test_expectations.SLOW): 505 return TestInfo(self._port, test_file, 506 self._options.slow_time_out_ms) 507 return TestInfo(self._port, test_file, self._options.time_out_ms) 498 return TestInput(test_file, self._options.slow_time_out_ms) 499 return TestInput(test_file, self._options.time_out_ms) 508 500 509 501 def _test_requires_lock(self, test_file): … … 523 515 524 516 Return: 525 The Queue of lists of TestIn foobjects.517 The Queue of lists of TestInput objects. 526 518 """ 527 519 … … 531 523 self._is_single_threaded()): 532 524 for test_file in test_files: 533 test_in fo = self._get_test_info_for_file(test_file)525 test_input = self._get_test_input_for_file(test_file) 534 526 if self._test_requires_lock(test_file): 535 tests_to_http_lock.append(test_in fo)527 tests_to_http_lock.append(test_input) 536 528 else: 537 test_lists.append((".", [test_in fo]))529 test_lists.append((".", [test_input])) 538 530 else: 539 531 tests_by_dir = {} 540 532 for test_file in test_files: 541 533 directory = self._get_dir_for_test_file(test_file) 542 test_in fo = self._get_test_info_for_file(test_file)534 test_input = self._get_test_input_for_file(test_file) 543 535 if self._test_requires_lock(test_file): 544 tests_to_http_lock.append(test_in fo)536 tests_to_http_lock.append(test_input) 545 537 else: 546 538 tests_by_dir.setdefault(directory, []) 547 tests_by_dir[directory].append(test_in fo)539 tests_by_dir[directory].append(test_input) 548 540 # Sort by the number of tests in the dir so that the ones with the 549 541 # most tests get run first in order to maximize parallelization. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
r71580 r72149 381 381 self.assertTrue(any(f.find(baseline) != -1 for f in file_list)) 382 382 383 # FIXME: Add tests to ensure that we're *not* writing baselines when we're not 384 # supposed to be. 385 383 386 def disabled_test_reset_results(self): 384 387 # FIXME: This test is disabled until we can rewrite it to use a … … 427 430 428 431 class TestRunnerWrapper(run_webkit_tests.TestRunner): 429 def _get_test_in fo_for_file(self, test_file):432 def _get_test_input_for_file(self, test_file): 430 433 return test_file 431 434
Note: See TracChangeset
for help on using the changeset viewer.