Title: [109429] trunk/Tools
Revision
109429
Author
[email protected]
Date
2012-03-01 14:41:33 -0800 (Thu, 01 Mar 2012)

Log Message

nrwt: test_isfile, test_isdir, and test_exists don't work for virtual tests
https://bugs.webkit.org/show_bug.cgi?id=80048

Reviewed by Adam Barth.

* Scripts/webkitpy/layout_tests/port/base.py:
(Port.test_isfile):
(Port.test_isdir):
(Port):
(Port.test_exists):
* Scripts/webkitpy/layout_tests/port/base_unittest.py:
(PortTest.test_test_exists):
(PortTest):
(PortTest.test_test_isfile):
(PortTest.test_test_isdir):
* Scripts/webkitpy/layout_tests/port/test.py:
(TestPort.virtual_test_suites):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(MainTest.test_virtual):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (109428 => 109429)


--- trunk/Tools/ChangeLog	2012-03-01 22:41:09 UTC (rev 109428)
+++ trunk/Tools/ChangeLog	2012-03-01 22:41:33 UTC (rev 109429)
@@ -1,3 +1,25 @@
+2012-03-01  Dirk Pranke  <[email protected]>
+
+        nrwt: test_isfile, test_isdir, and test_exists don't work for virtual tests
+        https://bugs.webkit.org/show_bug.cgi?id=80048
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.test_isfile):
+        (Port.test_isdir):
+        (Port):
+        (Port.test_exists):
+        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+        (PortTest.test_test_exists):
+        (PortTest):
+        (PortTest.test_test_isfile):
+        (PortTest.test_test_isdir):
+        * Scripts/webkitpy/layout_tests/port/test.py:
+        (TestPort.virtual_test_suites):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (MainTest.test_virtual):
+
 2012-03-01  Kalev Lember  <[email protected]>
 
         [GTK] Avoid building any parts of WebKitTestRunner when WK2 is disabled

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (109428 => 109429)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-03-01 22:41:09 UTC (rev 109428)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-03-01 22:41:33 UTC (rev 109429)
@@ -506,22 +506,26 @@
     def test_isfile(self, test_name):
         """Return True if the test name refers to a directory of tests."""
         # Used by test_expectations.py to apply rules to whole directories.
-        test_path = self.abspath_for_test(test_name)
-        return self._filesystem.isfile(test_path)
+        if self._filesystem.isfile(self.abspath_for_test(test_name)):
+            return True
+        base = self.lookup_virtual_test_base(test_name)
+        return base and self._filesystem.isfile(self.abspath_for_test(base))
 
     @memoized
     def test_isdir(self, test_name):
         """Return True if the test name refers to a directory of tests."""
         # Used by test_expectations.py to apply rules to whole directories.
-        test_path = self.abspath_for_test(test_name)
-        return self._filesystem.isdir(test_path)
+        if self._filesystem.isdir(self.abspath_for_test(test_name)):
+            return True
+        base = self.lookup_virtual_test_base(test_name)
+        return base and self._filesystem.isdir(self.abspath_for_test(base))
 
+    @memoized
     def test_exists(self, test_name):
         """Return True if the test name refers to an existing test or baseline."""
         # Used by test_expectations.py to determine if an entry refers to a
         # valid test and by printing.py to determine if baselines exist.
-        test_path = self.abspath_for_test(test_name)
-        return self._filesystem.exists(test_path)
+        return self.test_isfile(test_name) or self.test_isdir(test_name)
 
     def split_test(self, test_name):
         """Splits a test name into the 'directory' part and the 'basename' part."""

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py (109428 => 109429)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py	2012-03-01 22:41:09 UTC (rev 109428)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py	2012-03-01 22:41:33 UTC (rev 109429)
@@ -406,6 +406,38 @@
         self.assertVirtual(port._path_to_lighttpd_php)
         self.assertVirtual(port._path_to_wdiff)
 
+    def test_test_exists(self):
+        port = self.make_port(with_tests=True)
+        self.assertTrue(port.test_exists('passes'))
+        self.assertTrue(port.test_exists('passes/text.html'))
+        self.assertFalse(port.test_exists('passes/does_not_exist.html'))
 
+        self.assertTrue(port.test_exists('virtual'))
+        self.assertFalse(port.test_exists('virtual/does_not_exist.html'))
+        self.assertTrue(port.test_exists('virtual/passes/text.html'))
+
+    def test_test_isfile(self):
+        port = self.make_port(with_tests=True)
+        self.assertFalse(port.test_isfile('passes'))
+        self.assertTrue(port.test_isfile('passes/text.html'))
+        self.assertFalse(port.test_isfile('passes/does_not_exist.html'))
+
+        self.assertFalse(port.test_isfile('virtual'))
+        self.assertTrue(port.test_isfile('virtual/passes/text.html'))
+        self.assertFalse(port.test_isfile('virtual/does_not_exist.html'))
+
+    def test_test_isdir(self):
+        port = self.make_port(with_tests=True)
+        self.assertTrue(port.test_isdir('passes'))
+        self.assertFalse(port.test_isdir('passes/text.html'))
+        self.assertFalse(port.test_isdir('passes/does_not_exist.html'))
+        self.assertFalse(port.test_isdir('passes/does_not_exist/'))
+
+        self.assertTrue(port.test_isdir('virtual'))
+        self.assertFalse(port.test_isdir('virtual/does_not_exist.html'))
+        self.assertFalse(port.test_isdir('virtual/does_not_exist/'))
+        self.assertFalse(port.test_isdir('virtual/passes/text.html'))
+
+
 if __name__ == '__main__':
     unittest.main()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (109428 => 109429)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-03-01 22:41:09 UTC (rev 109428)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-03-01 22:41:33 UTC (rev 109429)
@@ -306,7 +306,7 @@
         add_file(test, '-expected.txt', test.expected_text)
         add_file(test, '-expected.png', test.expected_image)
 
-    filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'args-expected.txt'), 'args-txt --virtual-arg')
+    filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'passes', 'args-expected.txt'), 'args-txt --virtual-arg')
     # Clear the list of written files so that we can watch what happens during testing.
     filesystem.clear_written_files()
 
@@ -494,7 +494,8 @@
 
     def virtual_test_suites(self):
         return [
-            VirtualTestSuite('virtual', 'passes', ['--virtual-arg']),
+            VirtualTestSuite('virtual/passes', 'passes', ['--virtual-arg']),
+            VirtualTestSuite('virtual/failures', 'failures/expected', ['--virtual-arg']),
         ]
 
 class TestDriver(Driver):

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (109428 => 109429)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-03-01 22:41:09 UTC (rev 109428)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-03-01 22:41:33 UTC (rev 109429)
@@ -754,7 +754,7 @@
 
     def test_virtual(self):
         self.assertTrue(passing_run(['passes/text.html', 'passes/args.html',
-                                     'virtual/text.html', 'virtual/args.html']))
+                                     'virtual/passes/text.html', 'virtual/passes/args.html']))
 
     def test_worker_model__inline(self):
         self.assertTrue(passing_run(['--worker-model', 'inline']))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to