2010-11-22 Hayato Ito <hayato@chromium.org>
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Nov 2010 22:52:30 +0000 (22:52 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Nov 2010 22:52:30 +0000 (22:52 +0000)
        Reviewed by Shinichiro Hamaji.

        Ignore reference files which will be used by reftests when collecting
        test cases.
        https://bugs.webkit.org/show_bug.cgi?id=49835

        * Scripts/webkitpy/layout_tests/port/test_files.py:
        * Scripts/webkitpy/layout_tests/port/test_files_unittest.py:

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

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/port/test_files.py
WebKitTools/Scripts/webkitpy/layout_tests/port/test_files_unittest.py

index ddd0f84..51c7009 100644 (file)
@@ -1,3 +1,14 @@
+2010-11-22  Hayato Ito  <hayato@chromium.org>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Ignore reference files which will be used by reftests when collecting
+        test cases.
+        https://bugs.webkit.org/show_bug.cgi?id=49835
+
+        * Scripts/webkitpy/layout_tests/port/test_files.py:
+        * Scripts/webkitpy/layout_tests/port/test_files_unittest.py:
+
 2010-11-22  Adam Roben  <aroben@apple.com>
 
         Use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops files
index 3fa0fb3..2c0a7b6 100644 (file)
@@ -78,7 +78,7 @@ def find(port, paths):
     # Now walk all the paths passed in on the command line and get filenames
     test_files = set()
     for path in paths_to_walk:
-        if os.path.isfile(path) and _has_supported_extension(path):
+        if os.path.isfile(path) and _is_test_file(path):
             test_files.add(os.path.normpath(path))
             continue
 
@@ -95,7 +95,7 @@ def find(port, paths):
                     dirs.remove(directory)
 
             for filename in files:
-                if _has_supported_extension(filename):
+                if _is_test_file(filename):
                     filename = os.path.join(root, filename)
                     filename = os.path.normpath(filename)
                     test_files.add(filename)
@@ -111,3 +111,18 @@ def _has_supported_extension(filename):
     test on."""
     extension = os.path.splitext(filename)[1]
     return extension in _supported_file_extensions
+
+
+def _is_reference_html_file(filename):
+    """Return true if the filename points to a reference HTML file."""
+    if (filename.endswith('-expected.html') or
+        filename.endswith('-expected-mismatch.html')):
+        _log.warn("Reftests are not supported - ignoring %s" % filename)
+        return True
+    return False
+
+
+def _is_test_file(filename):
+    """Return true if the filename points to a test file."""
+    return (_has_supported_extension(filename) and
+            not _is_reference_html_file(filename))
index c37eb92..83525c8 100644 (file)
@@ -63,6 +63,13 @@ class TestFilesTest(unittest.TestCase):
         tests = test_files.find(port, ['userscripts/resources'])
         self.assertEqual(tests, set([]))
 
+    def test_is_test_file(self):
+        self.assertTrue(test_files._is_test_file('foo.html'))
+        self.assertTrue(test_files._is_test_file('foo.shtml'))
+        self.assertFalse(test_files._is_test_file('foo.png'))
+        self.assertFalse(test_files._is_test_file('foo-expected.html'))
+        self.assertFalse(test_files._is_test_file('foo-expected-mismatch.html'))
+
 
 if __name__ == '__main__':
     unittest.main()