Changeset 109429 in webkit


Ignore:
Timestamp:
Mar 1, 2012 2:41:33 PM (12 years ago)
Author:
dpranke@chromium.org
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):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r109396 r109429  
     12012-03-01  Dirk Pranke  <dpranke@chromium.org>
     2
     3        nrwt: test_isfile, test_isdir, and test_exists don't work for virtual tests
     4        https://bugs.webkit.org/show_bug.cgi?id=80048
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/layout_tests/port/base.py:
     9        (Port.test_isfile):
     10        (Port.test_isdir):
     11        (Port):
     12        (Port.test_exists):
     13        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
     14        (PortTest.test_test_exists):
     15        (PortTest):
     16        (PortTest.test_test_isfile):
     17        (PortTest.test_test_isdir):
     18        * Scripts/webkitpy/layout_tests/port/test.py:
     19        (TestPort.virtual_test_suites):
     20        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     21        (MainTest.test_virtual):
     22
    1232012-03-01  Kalev Lember  <kalevlember@gmail.com>
    224
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r109266 r109429  
    507507        """Return True if the test name refers to a directory of tests."""
    508508        # Used by test_expectations.py to apply rules to whole directories.
    509         test_path = self.abspath_for_test(test_name)
    510         return self._filesystem.isfile(test_path)
     509        if self._filesystem.isfile(self.abspath_for_test(test_name)):
     510            return True
     511        base = self.lookup_virtual_test_base(test_name)
     512        return base and self._filesystem.isfile(self.abspath_for_test(base))
    511513
    512514    @memoized
     
    514516        """Return True if the test name refers to a directory of tests."""
    515517        # Used by test_expectations.py to apply rules to whole directories.
    516         test_path = self.abspath_for_test(test_name)
    517         return self._filesystem.isdir(test_path)
    518 
     518        if self._filesystem.isdir(self.abspath_for_test(test_name)):
     519            return True
     520        base = self.lookup_virtual_test_base(test_name)
     521        return base and self._filesystem.isdir(self.abspath_for_test(base))
     522
     523    @memoized
    519524    def test_exists(self, test_name):
    520525        """Return True if the test name refers to an existing test or baseline."""
    521526        # Used by test_expectations.py to determine if an entry refers to a
    522527        # valid test and by printing.py to determine if baselines exist.
    523         test_path = self.abspath_for_test(test_name)
    524         return self._filesystem.exists(test_path)
     528        return self.test_isfile(test_name) or self.test_isdir(test_name)
    525529
    526530    def split_test(self, test_name):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py

    r109266 r109429  
    407407        self.assertVirtual(port._path_to_wdiff)
    408408
     409    def test_test_exists(self):
     410        port = self.make_port(with_tests=True)
     411        self.assertTrue(port.test_exists('passes'))
     412        self.assertTrue(port.test_exists('passes/text.html'))
     413        self.assertFalse(port.test_exists('passes/does_not_exist.html'))
     414
     415        self.assertTrue(port.test_exists('virtual'))
     416        self.assertFalse(port.test_exists('virtual/does_not_exist.html'))
     417        self.assertTrue(port.test_exists('virtual/passes/text.html'))
     418
     419    def test_test_isfile(self):
     420        port = self.make_port(with_tests=True)
     421        self.assertFalse(port.test_isfile('passes'))
     422        self.assertTrue(port.test_isfile('passes/text.html'))
     423        self.assertFalse(port.test_isfile('passes/does_not_exist.html'))
     424
     425        self.assertFalse(port.test_isfile('virtual'))
     426        self.assertTrue(port.test_isfile('virtual/passes/text.html'))
     427        self.assertFalse(port.test_isfile('virtual/does_not_exist.html'))
     428
     429    def test_test_isdir(self):
     430        port = self.make_port(with_tests=True)
     431        self.assertTrue(port.test_isdir('passes'))
     432        self.assertFalse(port.test_isdir('passes/text.html'))
     433        self.assertFalse(port.test_isdir('passes/does_not_exist.html'))
     434        self.assertFalse(port.test_isdir('passes/does_not_exist/'))
     435
     436        self.assertTrue(port.test_isdir('virtual'))
     437        self.assertFalse(port.test_isdir('virtual/does_not_exist.html'))
     438        self.assertFalse(port.test_isdir('virtual/does_not_exist/'))
     439        self.assertFalse(port.test_isdir('virtual/passes/text.html'))
     440
    409441
    410442if __name__ == '__main__':
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py

    r109266 r109429  
    307307        add_file(test, '-expected.png', test.expected_image)
    308308
    309     filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'args-expected.txt'), 'args-txt --virtual-arg')
     309    filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'passes', 'args-expected.txt'), 'args-txt --virtual-arg')
    310310    # Clear the list of written files so that we can watch what happens during testing.
    311311    filesystem.clear_written_files()
     
    495495    def virtual_test_suites(self):
    496496        return [
    497             VirtualTestSuite('virtual', 'passes', ['--virtual-arg']),
     497            VirtualTestSuite('virtual/passes', 'passes', ['--virtual-arg']),
     498            VirtualTestSuite('virtual/failures', 'failures/expected', ['--virtual-arg']),
    498499        ]
    499500
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r109266 r109429  
    755755    def test_virtual(self):
    756756        self.assertTrue(passing_run(['passes/text.html', 'passes/args.html',
    757                                      'virtual/text.html', 'virtual/args.html']))
     757                                     'virtual/passes/text.html', 'virtual/passes/args.html']))
    758758
    759759    def test_worker_model__inline(self):
Note: See TracChangeset for help on using the changeset viewer.