Changeset 92087 in webkit


Ignore:
Timestamp:
Jul 31, 2011 1:40:55 PM (13 years ago)
Author:
Dimitri Glazkov
Message:

Use set comparison to find duplicate or overlapping specifiers in test expectations.
https://bugs.webkit.org/show_bug.cgi?id=65430

Reviewed by Adam Barth.

  • Scripts/webkitpy/layout_tests/models/test_expectations.py: Changed to use set comparisons, because length

of a set is wrong.

  • Scripts/webkitpy/style/checkers/test_expectations_unittest.py: Added some unit tests to actually catch

regressions.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r92077 r92087  
     12011-07-31  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Use set comparison to find duplicate or overlapping specifiers in test expectations.
     4        https://bugs.webkit.org/show_bug.cgi?id=65430
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/layout_tests/models/test_expectations.py: Changed to use set comparisons, because length
     9            of a set is wrong.
     10        * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: Added some unit tests to actually catch
     11            regressions.
     12
    1132011-07-31  Xan Lopez  <xlopez@igalia.com>
    214
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r91884 r92087  
    528528        # to be warnings and return False".
    529529
    530         prev_specificity = len(prev_expectation_line.matching_configurations)
    531         specificity = len(prev_expectation_line.matching_configurations)
    532         if prev_specificity == specificity:
     530        if prev_expectation_line.matching_configurations == expectation_line.matching_configurations:
    533531            expectation_line.errors.append('Duplicate or ambiguous %s.' % expectation_source)
    534532            return True
    535533
    536         if prev_specificity < specificity:
     534        if prev_expectation_line.matching_configurations >= expectation_line.matching_configurations:
    537535            expectation_line.errors.append('More specific entry on line %d overrides line %d' % (expectation_line.line_number, prev_expectation_line.line_number))
    538536            # FIXME: return False if we want more specific to win.
    539537            return True
    540538
    541         expectation_line.errors.append('More specific entry on line %d overrides line %d' % (prev_expectation_line.line_number, expectation_line.line_number))
    542         return True
     539        if prev_expectation_line.matching_configurations <= expectation_line.matching_configurations:
     540            expectation_line.errors.append('More specific entry on line %d overrides line %d' % (prev_expectation_line.line_number, expectation_line.line_number))
     541            return True
     542
     543        if prev_expectation_line.matching_configurations & expectation_line.matching_configurations:
     544            expectation_line.errors.append('Entries on line %d and line %d match overlapping sets of configurations' % (prev_expectation_line.line_number, expectation_line.line_number))
     545            return True
     546
     547        # Configuration sets are disjoint, then.
     548        return False
    543549
    544550
  • trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py

    r91103 r92087  
    152152            "Duplicate or ambiguous expectation. %s  [test/expectations] [5]" % self._test_file)
    153153
     154        self.assert_lines_lint(
     155            ["BUGWK1 LEOPARD : passes/text.html = PASS",
     156             "BUGWK1 MAC : passes/text.html = TIMEOUT"],
     157            "More specific entry on line 1 overrides line 2 passes/text.html  [test/expectations] [5]")
     158
     159        self.assert_lines_lint(
     160            ["BUGWK1 LEOPARD : passes/text.html = PASS",
     161             "BUGWK1 LEOPARD RELEASE : passes/text.html = TIMEOUT"],
     162            "More specific entry on line 2 overrides line 1 passes/text.html  [test/expectations] [5]")
     163
     164        self.assert_lines_lint(
     165            ["BUGWK1 RELEASE : passes/text.html = PASS",
     166             "BUGWK1 CPU : passes/text.html = TIMEOUT"],
     167            "Entries on line 1 and line 2 match overlapping sets of configurations passes/text.html  [test/expectations] [5]")
     168
     169        self.assert_lines_lint(
     170            ["BUGWK1 WIN : passes/text.html = PASS",
     171             "BUGWK1 MAC : passes/text.html = TIMEOUT"],
     172            "")
     173
     174        self.assert_lines_lint(
     175            ["BUGWK1 LEOPARD DEBUG : passes/text.html = PASS",
     176             "BUGWK1 LEOPARD RELEASE : passes/text.html = TIMEOUT"],
     177            "")
     178
     179
    154180    def test_tab(self):
    155181        self.assert_lines_lint(
Note: See TracChangeset for help on using the changeset viewer.