Changeset 120348 in webkit


Ignore:
Timestamp:
Jun 14, 2012 12:40:06 PM (12 years ago)
Author:
dpranke@chromium.org
Message:

NRWT should honor --skipped=[default|ignore|only], like ORWT does
https://bugs.webkit.org/show_bug.cgi?id=66308

Reviewed by Ryosuke Niwa.

This patch adds support for ORWT's --skipped=(default|ignore|only)
flag and cleans up the interaction between that and --ignore.

Individual tests (but not directories) explicitly listed on the
command line will always be run regardless of what is passed
for --skipped and --ignore.

This patch also changes the "found" and "running" log messages
since it wasn't clear how the skipped tests were included in those numbers.

  • Scripts/webkitpy/layout_tests/controllers/manager.py:

(Manager.init):
(Manager.collect_tests):
(Manager.prepare_lists_and_print_output):

  • Scripts/webkitpy/layout_tests/port/test.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:

(_set_up_derived_options):
(parse_args):

  • Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:

(MainTest.test_ignore_flag):
(MainTest):
(MainTest.test_skipped_flag):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r120342 r120348  
     12012-06-14  Dirk Pranke  <dpranke@chromium.org>
     2
     3        NRWT should honor --skipped=[default|ignore|only], like ORWT does
     4        https://bugs.webkit.org/show_bug.cgi?id=66308
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This patch adds support for ORWT's --skipped=(default|ignore|only)
     9        flag and cleans up the interaction between that and --ignore.
     10
     11        Individual tests (but not directories) explicitly listed on the
     12        command line will always be run regardless of what is passed
     13        for --skipped and --ignore.
     14
     15        This patch also changes the "found" and "running" log messages
     16        since it wasn't clear how the skipped tests were included in those numbers.
     17
     18        * Scripts/webkitpy/layout_tests/controllers/manager.py:
     19        (Manager.__init__):
     20        (Manager.collect_tests):
     21        (Manager.prepare_lists_and_print_output):
     22        * Scripts/webkitpy/layout_tests/port/test.py:
     23        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     24        (_set_up_derived_options):
     25        (parse_args):
     26        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     27        (MainTest.test_ignore_flag):
     28        (MainTest):
     29        (MainTest.test_skipped_flag):
     30
    1312012-06-14  Takashi Toyoshima  <toyoshim@chromium.org>
    232
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r119017 r120348  
    317317        # a set of test files, and the same tests as a list
    318318
     319        self._paths = set()
     320
    319321        # FIXME: Rename to test_names.
    320322        self._test_files = set()
     
    341343        if self._options.test_list:
    342344            paths += self._strip_test_dir_prefixes(read_test_files(self._filesystem, self._options.test_list, self._port.TEST_PATH_SEPARATOR))
     345        self._paths = set(paths)
    343346        self._test_files = self._port.tests(paths)
    344347
     
    457460        # Remove skipped - both fixable and ignored - files from the
    458461        # top-level list of files to test.
     462        found_test_files = set(self._test_files)
    459463        num_all_test_files = len(self._test_files)
    460         self._printer.print_expected("Found:  %d tests" % (len(self._test_files)))
     464
     465        skipped = self._expectations.get_tests_with_result_type(test_expectations.SKIP)
     466        if not self._options.http:
     467            skipped.update(set(self._http_tests()))
     468
     469        if self._options.skipped == 'only':
     470            self._test_files = self._test_files.intersection(skipped)
     471        elif self._options.skipped == 'default':
     472            self._test_files -= skipped
     473        elif self._options.skipped == 'ignore':
     474            pass  # just to be clear that we're ignoring the skip list.
     475
     476        if self._options.skip_failing_tests:
     477            self._test_files -= self._expectations.get_tests_with_result_type(test_expectations.FAIL)
     478            self._test_files -= self._expectations.get_tests_with_result_type(test_expectations.FLAKY)
     479
     480        # now make sure we're explicitly running any tests passed on the command line.
     481        self._test_files.update(found_test_files.intersection(self._paths))
     482
    461483        if not num_all_test_files:
    462484            _log.critical('No tests to run.')
    463485            return None
    464486
    465         skipped = set()
    466 
    467         if not self._options.http:
    468             skipped = skipped.union(self._http_tests())
    469 
    470         if num_all_test_files > 1 and not self._options.force:
    471             skipped.update(self._expectations.get_tests_with_result_type(test_expectations.SKIP))
    472             if self._options.skip_failing_tests:
    473                 skipped.update(self._expectations.get_tests_with_result_type(test_expectations.FAIL))
    474                 skipped.update(self._expectations.get_tests_with_result_type(test_expectations.FLAKY))
    475 
    476         self._test_files -= skipped
     487        num_skipped = num_all_test_files - len(self._test_files)
     488        if num_skipped:
     489            self._printer.print_expected("Running %s (found %d, skipping %d)." % (
     490                grammar.pluralize('test', num_all_test_files - num_skipped),
     491                num_all_test_files, num_skipped))
     492        elif len(self._test_files) > 1:
     493            self._printer.print_expected("Running all %d tests." % len(self._test_files))
     494        else:
     495            self._printer.print_expected("Running %1 test.")
    477496
    478497        # Create a sorted list of test files so the subset chunk,
     
    505524        self._print_expected_results_of_type(result_summary, test_expectations.SKIP, "skipped")
    506525
    507         if self._options.force:
    508             self._printer.print_expected('Running all tests, including skips (--force)')
    509         else:
     526        if self._options.skipped != 'ignore':
    510527            # Note that we don't actually run the skipped tests (they were
    511528            # subtracted out of self._test_files, above), but we stub out the
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py

    r119520 r120348  
    175175              expected_checksum=None,
    176176              expected_image='tEXtchecksum\x00checksum_in_image-checksum')
     177    tests.add('passes/skipped/skip.html')
    177178
    178179    # Note that here the checksums don't match but the images do, so this test passes "unexpectedly".
     
    264265WONTFIX SKIP : failures/expected/keyboard.html = CRASH
    265266WONTFIX SKIP : failures/expected/exception.html = CRASH
     267WONTFIX SKIP : passes/skipped/skip.html = PASS
    266268""")
    267269
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r120007 r120348  
    158158        options.additional_platform_directory = normalized_platform_directories
    159159
    160     if not options.http and options.force:
    161         warnings.append("--no-http is ignored since --force is also provided")
     160    if not options.http and options.skipped in ('ignore', 'only'):
     161        warnings.append("--force/--skipped=%s overrides --no-http." % (options.skipped))
    162162        options.http = True
    163163
     
    348348                 "DumpRenderTree; option is split on whitespace before "
    349349                 "running. (Example: --wrapper='valgrind --smc-check=all')"),
    350         # old-run-webkit-tests:
    351         # -i|--ignore-tests               Comma-separated list of directories
    352         #                                 or tests to ignore
    353350        optparse.make_option("-i", "--ignore-tests", action="append", default=[],
    354351            help="directories or test to ignore (may specify multiple times)"),
    355352        optparse.make_option("--test-list", action="append",
    356353            help="read list of tests to run from file", metavar="FILE"),
    357         # old-run-webkit-tests uses --skipped==[default|ignore|only]
    358         # instead of --force:
    359         optparse.make_option("--force", action="store_true", default=False,
    360             help="Run all tests, even those marked SKIP in the test list"),
     354        optparse.make_option("--skipped", action="store", default="default",
     355            help="control how tests marked SKIP are run. 'default' == Skip, 'ignore' == Run them anyway, 'only' == only run the SKIP tests."),
     356        optparse.make_option("--force", dest="skipped", action="store_const", const='ignore',
     357            help="Run all tests, even those marked SKIP in the test list (same as --skipped=ignore)"),
    361358        optparse.make_option("--time-out-ms",
    362359            help="Set the timeout for each test"),
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r120240 r120348  
    402402        self.assertEquals(tests_run, ['passes/image.html', 'passes/text.html'])
    403403
    404     def test_ignore_tests(self):
    405         def assert_ignored(args, tests_expected_to_run):
    406             tests_to_run = ['failures/expected/image.html', 'passes/image.html']
    407             tests_run = get_tests_run(args + tests_to_run, tests_included=True, flatten_batches=True)
    408             self.assertEquals(tests_run, tests_expected_to_run)
    409 
    410         assert_ignored(['-i', 'failures/expected/image.html'], ['passes/image.html'])
    411         assert_ignored(['-i', 'passes'], ['failures/expected/image.html'])
    412 
    413         # Note here that there is an expectation for failures/expected/image.html already, but
    414         # it is overriden by the command line arg. This might be counter-intuitive.
    415         # FIXME: This isn't currently working ...
    416         # assert_ignored(['-i', 'failures/expected'], ['passes/image.html'])
     404    def test_ignore_flag(self):
     405        # Note that passes/image.html is expected to be run since we specified it directly.
     406        tests_run = get_tests_run(['-i', 'passes', 'passes/image.html'], flatten_batches=True, tests_included=True)
     407        self.assertFalse('passes/text.html' in tests_run)
     408        self.assertTrue('passes/image.html' in tests_run)
     409
     410    def test_skipped_flag(self):
     411        tests_run = get_tests_run(['passes'], tests_included=True, flatten_batches=True)
     412        self.assertFalse('passes/skipped/skip.html' in tests_run)
     413        num_tests_run_by_default = len(tests_run)
     414
     415        # Check that nothing changes when we specify skipped=default.
     416        self.assertEquals(len(get_tests_run(['--skipped=default', 'passes'], tests_included=True, flatten_batches=True)),
     417                          num_tests_run_by_default)
     418
     419        # Now check that we run one more test (the skipped one).
     420        tests_run = get_tests_run(['--skipped=ignore', 'passes'], tests_included=True, flatten_batches=True)
     421        self.assertTrue('passes/skipped/skip.html' in tests_run)
     422        self.assertEquals(len(tests_run), num_tests_run_by_default + 1)
     423
     424        # Now check that we only run the skipped test.
     425        self.assertEquals(get_tests_run(['--skipped=only', 'passes'], tests_included=True, flatten_batches=True),
     426                          ['passes/skipped/skip.html'])
    417427
    418428    def test_iterations(self):
Note: See TracChangeset for help on using the changeset viewer.