[webkitpy] Add platform specific Skipped file mechanism for performance tests
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 18:07:06 +0000 (18:07 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 18:07:06 +0000 (18:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141152

Reviewed by Csaba Osztrogon√°c.

Support a test-expectation-like syntax in performance tests' skipped files.
e.g. [Mac] Parsed/BadTest.html will skip Parsed/BadTest.html on Mac ports.

* Scripts/webkitpy/port/base.py:
(Port.skipped_perf_tests): Implemented the syntax support by a regular expression.

* Scripts/webkitpy/port/base_unittest.py:
(PortTest.test_skipped_perf_tests): Test the new syntax.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179610 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/base_unittest.py

index 6d22bf0cea324a1d79b96c4fab5227a5a73db655..35a5c957b83d067b717e1061b25431e8fd435ccc 100644 (file)
@@ -1,3 +1,19 @@
+2015-02-03  Ryosuke Niwa  <rniwa@webkit.org>
+
+        [webkitpy] Add platform specific Skipped file mechanism for performance tests
+        https://bugs.webkit.org/show_bug.cgi?id=141152
+
+        Reviewed by Csaba Osztrogon√°c.
+
+        Support a test-expectation-like syntax in performance tests' skipped files.
+        e.g. [Mac] Parsed/BadTest.html will skip Parsed/BadTest.html on Mac ports.
+
+        * Scripts/webkitpy/port/base.py:
+        (Port.skipped_perf_tests): Implemented the syntax support by a regular expression.
+
+        * Scripts/webkitpy/port/base_unittest.py:
+        (PortTest.test_skipped_perf_tests): Test the new syntax.
+
 2015-02-04  Alexey Proskuryakov  <ap@apple.com>
 
         When tests fail on leaks bot so much that there are no leaks detected, dashboard erroneously shows green
index c8045559d376a5a9453674d79f8e104ea8ee5559..aadab4c1c9c2349f1f5e4b0c32035775b2c66fb0 100644 (file)
@@ -699,7 +699,24 @@ class Port(object):
 
     @memoized
     def skipped_perf_tests(self):
-        return self._expectations_from_skipped_files([self.perf_tests_dir()])
+        filename = self._filesystem.join(self.perf_tests_dir(), "Skipped")
+        if not self._filesystem.exists(filename):
+            _log.debug("Skipped does not exist: %s" % filename)
+            return []
+
+        skipped_file_contents = self._filesystem.read_text_file(filename)
+        tests_to_skip = []
+        for line_number, line in enumerate(skipped_file_contents.split('\n')):
+            match = re.match(r'^\s*(\[(?P<platforms>[\w ]*?)\])?\s*(?P<test>[\w\-\/\.]+?)?\s*(?P<comment>\#.*)?$', line)
+            if not match:
+                _log.error("Syntax error at line %d in %s: %s" % (line_number + 1, filename, line))
+            else:
+                platform_names = filter(lambda token: token, match.group('platforms').lower().split(' ')) if match.group('platforms') else []
+                test_name = match.group('test')
+                if test_name and (not platform_names or self.port_name in platform_names or self._name in platform_names):
+                    tests_to_skip.append(test_name)
+
+        return tests_to_skip
 
     def skips_perf_test(self, test_name):
         for test_or_category in self.skipped_perf_tests():
index 6f7ab3f7db912a0e7c3a52adee6972b19cb76b12..32fdca08d9fae30948fbbd9c7ba55c5e3030a912 100755 (executable)
@@ -147,8 +147,8 @@ class PortTest(unittest.TestCase):
         add_text_file('inspector', 'test2.html')
         add_text_file('inspector/resources', 'resource_file.html')
         add_text_file('unsupported', 'unsupported_test2.html')
-        add_text_file('', 'Skipped', '\n'.join(['Layout', '', 'SunSpider', 'Supported/some-test.html']))
-        self.assertEqual(port.skipped_perf_tests(), ['Layout', 'SunSpider', 'Supported/some-test.html'])
+        add_text_file('', 'Skipped', '\n'.join(['Layout', '', 'SunSpider', 'Supported/some-test.html', '[ExoticPort] UnskippedTest.html', '[baseport] SkippedTest.html']))
+        self.assertEqual(port.skipped_perf_tests(), ['Layout', 'SunSpider', 'Supported/some-test.html', 'SkippedTest.html'])
 
     def test_get_option__set(self):
         options, args = optparse.OptionParser().parse_args([])