Changeset 90055 in webkit


Ignore:
Timestamp:
Jun 29, 2011 3:25:58 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-06-29 Adam Barth <abarth@webkit.org>

Reviewed by Dirk Pranke.

new-run-webkit-tests complains about missing pixel results instead of plopping down new expectations
https://bugs.webkit.org/show_bug.cgi?id=38063

This patch changes new-run-webkit-tests to match old-run-webkit-tests
in generating new expected results when the expected results are
missing.

There are still a couple details that are different:

1) Image baselines aren't generated unless you run with -p.
2) Render tree dumps are places in the cross-platform directory instead
of the platform-specific directory.

I'm inclined to deal with both of these issues in follow-up patches.

  • Scripts/webkitpy/common/net/layouttestresults.py:
  • Scripts/webkitpy/layout_tests/layout_package/manager.py:
  • Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
  • Scripts/webkitpy/layout_tests/layout_package/test_results.py:
  • Scripts/webkitpy/layout_tests/port/test.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90054 r90055  
     12011-06-29  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Dirk Pranke.
     4
     5        new-run-webkit-tests complains about missing pixel results instead of plopping down new expectations
     6        https://bugs.webkit.org/show_bug.cgi?id=38063
     7
     8        This patch changes new-run-webkit-tests to match old-run-webkit-tests
     9        in generating new expected results when the expected results are
     10        missing.
     11
     12        There are still a couple details that are different:
     13
     14        1) Image baselines aren't generated unless you run with -p.
     15        2) Render tree dumps are places in the cross-platform directory instead
     16        of the platform-specific directory.
     17
     18        I'm inclined to deal with both of these issues in follow-up patches.
     19
     20        * Scripts/webkitpy/common/net/layouttestresults.py:
     21        * Scripts/webkitpy/layout_tests/layout_package/manager.py:
     22        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
     23        * Scripts/webkitpy/layout_tests/layout_package/test_results.py:
     24        * Scripts/webkitpy/layout_tests/port/test.py:
     25        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     26        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     27
    1282011-06-29  Adam Roben  <aroben@apple.com>
    229
  • trunk/Tools/Scripts/webkitpy/common/net/layouttestresults.py

    r89868 r90055  
    162162
    163163    def results_matching_failure_types(self, failure_types):
    164         return [result for result in self._test_results if result.has_failure_matching_types(failure_types)]
     164        return [result for result in self._test_results if result.has_failure_matching_types(*failure_types)]
    165165
    166166    def tests_matching_failure_types(self, failure_types):
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/manager.py

    r89868 r90055  
    796796        # We exclude the crashes from the list of results to retry, because
    797797        # we want to treat even a potentially flaky crash as an error.
    798         failures = self._get_failures(result_summary, include_crashes=False)
     798        failures = self._get_failures(result_summary, include_crashes=False, include_missing=False)
    799799        retry_summary = result_summary
    800800        while (len(failures) and self._options.retry_failures and
     
    807807            # Note that we intentionally ignore the return value here.
    808808            self._run_tests(failures.keys(), retry_summary)
    809             failures = self._get_failures(retry_summary, include_crashes=True)
     809            failures = self._get_failures(retry_summary, include_crashes=True, include_missing=True)
    810810
    811811        end_time = time.time()
     
    934934                self._fs.rmtree(self._fs.join(self._results_directory, dirname))
    935935
    936     def _get_failures(self, result_summary, include_crashes):
     936    def _get_failures(self, result_summary, include_crashes, include_missing):
    937937        """Filters a dict of results and returns only the failures.
    938938
     
    949949        for test, result in result_summary.unexpected_results.iteritems():
    950950            if (result.type == test_expectations.PASS or
    951                 result.type == test_expectations.CRASH and not include_crashes):
     951                (result.type == test_expectations.CRASH and not include_crashes) or
     952                (result.type == test_expectations.MISSING and not include_missing)):
    952953                continue
    953954            failed_results[test] = result.type
     
    12981299            test_files = result_summary.failures.keys()
    12991300        else:
    1300             unexpected_failures = self._get_failures(result_summary, include_crashes=True)
     1301            unexpected_failures = self._get_failures(result_summary, include_crashes=True, include_missing=True)
    13011302            test_files = unexpected_failures.keys()
    13021303
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py

    r89868 r90055  
    129129        expected_driver_output = self._expected_driver_output()
    130130        test_result = self._compare_output(driver_output, expected_driver_output)
    131         test_result_writer.write_test_result(self._port, self._filename,
    132                                              driver_output, expected_driver_output, test_result.failures)
     131        if self._options.new_test_results:
     132            self._add_missing_baselines(test_result, driver_output)
     133        test_result_writer.write_test_result(self._port, self._filename, driver_output, expected_driver_output, test_result.failures)
    133134        return test_result
    134135
     
    136137        driver_output = self._driver.run_test(self._driver_input())
    137138        failures = self._handle_error(driver_output)
    138         test_result_writer.write_test_result(self._port, self._filename,
    139                                              driver_output, None, failures)
     139        test_result_writer.write_test_result(self._port, self._filename, driver_output, None, failures)
    140140        # FIXME: It the test crashed or timed out, it might be bettter to avoid
    141141        # to write new baselines.
    142         self._save_baselines(driver_output)
     142        self._overwrite_baselines(driver_output)
    143143        return TestResult(self._filename, failures, driver_output.test_time, driver_output.has_stderr())
    144144
    145     def _save_baselines(self, driver_output):
     145    def _add_missing_baselines(self, test_result, driver_output):
     146        if test_result.has_failure_matching_types(test_failures.FailureMissingResult):
     147            # FIXME: We seem to be putting new text results in non-platform
     148            # specific directories even when they're rendertree dumps. Maybe
     149            # we should have a different kind of failure for render tree dumps
     150            # than for text tests?
     151            self._save_baseline_data(driver_output.text, ".txt", generate_new_baseline=False)
     152        if test_result.has_failure_matching_types(test_failures.FailureMissingAudio):
     153            self._save_baseline_data(driver_output.audio, ".wav", generate_new_baseline=False)
     154        if test_result.has_failure_matching_types(test_failures.FailureMissingImage, test_failures.FailureMissingImageHash):
     155            self._save_baseline_data(driver_output.image, ".png", generate_new_baseline=False)
     156
     157    def _overwrite_baselines(self, driver_output):
    146158        # Although all DumpRenderTree output should be utf-8,
    147159        # we do not ever decode it inside run-webkit-tests.  For some tests
    148160        # DumpRenderTree may not output utf-8 text (e.g. webarchives).
    149         self._save_baseline_data(driver_output.text, ".txt",
    150                                  generate_new_baseline=self._options.new_baseline)
    151         self._save_baseline_data(driver_output.audio, '.wav',
    152                                  generate_new_baseline=self._options.new_baseline)
     161        self._save_baseline_data(driver_output.text, ".txt", generate_new_baseline=self._options.new_baseline)
     162        self._save_baseline_data(driver_output.audio, ".wav", generate_new_baseline=self._options.new_baseline)
    153163        if self._options.pixel_tests:
    154             self._save_baseline_data(driver_output.image, ".png",
    155                                      generate_new_baseline=self._options.new_baseline)
     164            self._save_baseline_data(driver_output.image, ".png", generate_new_baseline=self._options.new_baseline)
    156165
    157166    def _save_baseline_data(self, data, modifier, generate_new_baseline=True):
     
    179188            fs.maybe_make_directory(output_dir)
    180189            output_path = fs.join(output_dir, output_file)
    181             _log.debug('writing new baseline result "%s"' % (output_path))
     190            _log.debug('Writing new baseline result "%s"' % output_path)
    182191        else:
    183192            output_path = port.expected_filename(self._filename, modifier)
    184             _log.debug('resetting baseline result "%s"' % output_path)
     193            _log.debug('Resetting baseline result "%s"' % output_path)
    185194
    186195        port.update_baseline(output_path, data)
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_results.py

    r89854 r90055  
    5656        return not (self == other)
    5757
    58     def has_failure_matching_types(self, types):
     58    def has_failure_matching_types(self, *args, **kargs):
    5959        for failure in self.failures:
    60             if type(failure) in types:
     60            if type(failure) in args:
    6161                return True
    6262        return False
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py

    r89854 r90055  
    137137              expected_text="foo\r\r\r\n", actual_text="foo\n")
    138138    tests.add('failures/expected/text.html', actual_text='text_fail-png')
     139    tests.add('failures/unexpected/missing_text.html', expected_text=None)
     140    tests.add('failures/unexpected/missing_image.html', expected_image=None)
    139141    tests.add('failures/unexpected/crash.html', crash=True)
    140142    tests.add('failures/unexpected/crash-with-stderr.html', crash=True,
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r89963 r90055  
    280280
    281281    old_run_webkit_tests_compat = [
    282         # NRWT doesn't generate results by default anyway.
    283         _compat_shim_option("--no-new-test-results"),
    284282        # NRWT doesn't sample on timeout yet anyway.
    285283        _compat_shim_option("--no-sample-on-timeout"),
     
    308306            default=False, help="Reset any existing baselines to the "
    309307                 "generated results"),
     308        optparse.make_option("--no-new-test-results", action="store_false",
     309            dest="new_test_results", default=True,
     310            help="Don't create new baselines when no expected results exist"),
    310311        optparse.make_option("--skip-failing-tests", action="store_true",
    311312            default=False, help="Skip tests that are expected to fail. "
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r89873 r90055  
    642642
    643643class RebaselineTest(unittest.TestCase):
    644     def assertBaselines(self, file_list, file):
     644    def assertBaselines(self, file_list, file, extensions):
    645645        "assert that the file_list contains the baselines."""
    646         for ext in (".txt", ".png"):
     646        for ext in extensions:
    647647            baseline = file + "-expected" + ext
    648648            self.assertTrue(any(f.find(baseline) != -1 for f in file_list))
     
    663663        file_list.remove('/tmp/layout-test-results/tests_run0.txt')
    664664        self.assertEqual(len(file_list), 4)
    665         self.assertBaselines(file_list, "/passes/image")
    666         self.assertBaselines(file_list, "/failures/expected/missing_image")
     665        self.assertBaselines(file_list, "/passes/image", [".txt", ".png"])
     666        self.assertBaselines(file_list, "/failures/expected/missing_image", [".txt", ".png"])
     667
     668    def test_missing_results(self):
     669        # Test that we update expectations in place. If the expectation
     670        # is missing, update the expected generic location.
     671        fs = port.unit_test_filesystem()
     672        passing_run(['--no-show-results',
     673                     'failures/unexpected/missing_text.html',
     674                     'failures/unexpected/missing_image.html',
     675                     'failures/unexpected/missing_audio.html'],
     676                     tests_included=True, filesystem=fs)
     677        file_list = fs.written_files.keys()
     678        file_list.remove('/tmp/layout-test-results/tests_run0.txt')
     679        self.assertEqual(len(file_list), 4)
     680        self.assertBaselines(file_list, "/failures/unexpected/missing_text", [".txt"])
     681        self.assertBaselines(file_list, "/failures/unexpected/missing_image", [".png"])
    667682
    668683    def test_new_baseline(self):
     
    679694        self.assertEqual(len(file_list), 4)
    680695        self.assertBaselines(file_list,
    681             "/platform/test-mac-leopard/passes/image")
     696            "/platform/test-mac-leopard/passes/image", [".txt", ".png"])
    682697        self.assertBaselines(file_list,
    683             "/platform/test-mac-leopard/failures/expected/missing_image")
     698            "/platform/test-mac-leopard/failures/expected/missing_image", [".txt", ".png"])
    684699
    685700
Note: See TracChangeset for help on using the changeset viewer.