Remove virtual test support from webkitpy
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Dec 2014 20:50:16 +0000 (20:50 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Dec 2014 20:50:16 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139427

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-12-09
Reviewed by Alexey Proskuryakov.

It seems that the only concrete client of virtual tests is the unit tests :D

This patch tries to clean as much useless code as possible.

* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(RunTest.test_tolerance):
(RunTest.test_virtual): Deleted.
* Scripts/webkitpy/layout_tests/views/printing.py:
(Printer._print_test_trace):
* Scripts/webkitpy/port/base.py:
(Port.expected_filename):
(Port.tests):
(Port.test_isfile):
(Port.test_isdir):
(Port.sample_process):
(Port.find_system_pid):
(Port.test_expectations_file_position):
(Port.virtual_test_suites): Deleted.
(Port): Deleted.
(Port.populated_virtual_test_suites): Deleted.
(Port._virtual_tests): Deleted.
(Port.lookup_virtual_test_base): Deleted.
(Port.lookup_virtual_test_args): Deleted.
(VirtualTestSuite): Deleted.
(VirtualTestSuite.__init__): Deleted.
(VirtualTestSuite.__repr__): Deleted.
* Scripts/webkitpy/port/base_unittest.py:
(PortTest.test_test_exists):
(PortTest.test_test_isfile):
(PortTest.test_test_isdir):
(PortTest.test_tests):
* Scripts/webkitpy/port/driver.py:
(DriverProxy.run_test): Deleted.
* Scripts/webkitpy/port/test.py:
(TestPort._skipped_tests_for_unsupported_features):
(TestPort.all_baseline_variants):
(TestPort.virtual_test_suites): Deleted.
* Scripts/webkitpy/tool/commands/queries.py:
(PrintBaselines.__init__):
(PrintBaselines.execute):
* Scripts/webkitpy/tool/commands/queries_unittest.py:
(PrintBaselinesTest.test_basic):
(PrintBaselinesTest.test_multiple):
(PrintBaselinesTest.test_csv):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py
Tools/Scripts/webkitpy/layout_tests/views/printing.py
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/base_unittest.py
Tools/Scripts/webkitpy/port/driver.py
Tools/Scripts/webkitpy/port/test.py
Tools/Scripts/webkitpy/tool/commands/queries.py
Tools/Scripts/webkitpy/tool/commands/queries_unittest.py

index 98370f6d9fa8404fe5701e80335677733cec0c40..e01a9590cf7ea359d405e9677ec6f0d06dc71f7a 100644 (file)
@@ -1,3 +1,55 @@
+2014-12-09  Benjamin Poulain  <bpoulain@apple.com>
+
+        Remove virtual test support from webkitpy
+        https://bugs.webkit.org/show_bug.cgi?id=139427
+
+        Reviewed by Alexey Proskuryakov.
+
+        It seems that the only concrete client of virtual tests is the unit tests :D
+
+        This patch tries to clean as much useless code as possible.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (RunTest.test_tolerance):
+        (RunTest.test_virtual): Deleted.
+        * Scripts/webkitpy/layout_tests/views/printing.py:
+        (Printer._print_test_trace):
+        * Scripts/webkitpy/port/base.py:
+        (Port.expected_filename):
+        (Port.tests):
+        (Port.test_isfile):
+        (Port.test_isdir):
+        (Port.sample_process):
+        (Port.find_system_pid):
+        (Port.test_expectations_file_position):
+        (Port.virtual_test_suites): Deleted.
+        (Port): Deleted.
+        (Port.populated_virtual_test_suites): Deleted.
+        (Port._virtual_tests): Deleted.
+        (Port.lookup_virtual_test_base): Deleted.
+        (Port.lookup_virtual_test_args): Deleted.
+        (VirtualTestSuite): Deleted.
+        (VirtualTestSuite.__init__): Deleted.
+        (VirtualTestSuite.__repr__): Deleted.
+        * Scripts/webkitpy/port/base_unittest.py:
+        (PortTest.test_test_exists):
+        (PortTest.test_test_isfile):
+        (PortTest.test_test_isdir):
+        (PortTest.test_tests):
+        * Scripts/webkitpy/port/driver.py:
+        (DriverProxy.run_test): Deleted.
+        * Scripts/webkitpy/port/test.py:
+        (TestPort._skipped_tests_for_unsupported_features):
+        (TestPort.all_baseline_variants):
+        (TestPort.virtual_test_suites): Deleted.
+        * Scripts/webkitpy/tool/commands/queries.py:
+        (PrintBaselines.__init__):
+        (PrintBaselines.execute):
+        * Scripts/webkitpy/tool/commands/queries_unittest.py:
+        (PrintBaselinesTest.test_basic):
+        (PrintBaselinesTest.test_multiple):
+        (PrintBaselinesTest.test_csv):
+
 2014-12-09  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Blink Merge: Remove 'http_lock' code from webkitpy
index 0e12afd3c5c132a4a834b6cd224f6c8bb8c29a85..f88c1a299cf03c7b82160e29ff58017f9afb1893 100644 (file)
@@ -716,10 +716,6 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
         test_port = get_port_for_run(base_args)
         self.assertEqual(None, test_port.tolerance_used_for_diff_image)
 
-    def test_virtual(self):
-        self.assertTrue(passing_run(['passes/text.html', 'passes/args.html',
-                                     'virtual/passes/text.html', 'virtual/passes/args.html']))
-
     def test_reftest_run(self):
         tests_run = get_tests_run(['passes/reftest.html'])
         self.assertEqual(['passes/reftest.html'], tests_run)
index 2e9ac9474207ec706e8a0b0a968c2731b50d3d20..1c652c75980e2e7a9747697af874b4be1d38f74d 100644 (file)
@@ -350,12 +350,6 @@ class Printer(object):
         test_name = result.test_name
         self._print_default(self._test_status_line(test_name, ''))
 
-        base = self._port.lookup_virtual_test_base(test_name)
-        if base:
-            args = ' '.join(self._port.lookup_virtual_test_args(test_name))
-            self._print_default(' base: %s' % base)
-            self._print_default(' args: %s' % args)
-
         for extension in ('.txt', '.png', '.wav', '.webarchive'):
             self._print_baseline(test_name, extension)
 
index 9d5e53149d1807c5f77b49e92671aee827811369..e483b2187755bb18a855a690e2612e175a803e59 100644 (file)
@@ -424,10 +424,6 @@ class Port(object):
         if platform_dir:
             return self._filesystem.join(platform_dir, baseline_filename)
 
-        actual_test_name = self.lookup_virtual_test_base(test_name)
-        if actual_test_name:
-            return self.expected_filename(actual_test_name, suffix)
-
         if return_default:
             return self._filesystem.join(self.layout_tests_dir(), baseline_filename)
         return None
@@ -514,9 +510,7 @@ class Port(object):
     def tests(self, paths):
         """Return the list of tests found. Both generic and platform-specific tests matching paths should be returned."""
         expanded_paths = self._expanded_paths(paths)
-        tests = self._real_tests(expanded_paths)
-        tests.extend(self._virtual_tests(expanded_paths, self.populated_virtual_test_suites()))
-        return tests
+        return self._real_tests(expanded_paths)
 
     def _expanded_paths(self, paths):
         expanded_paths = []
@@ -599,19 +593,13 @@ class Port(object):
     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.
-        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))
+        return self._filesystem.isfile(self.abspath_for_test(test_name))
 
     @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.
-        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))
+        return self._filesystem.isdir(self.abspath_for_test(test_name))
 
     @memoized
     def test_exists(self, test_name):
@@ -1194,52 +1182,10 @@ class Port(object):
     def sample_process(self, name, pid):
         pass
 
-    def virtual_test_suites(self):
-        return []
-
     def find_system_pid(self, name, pid):
         # This is only overridden on Windows
         return pid
 
-    @memoized
-    def populated_virtual_test_suites(self):
-        suites = self.virtual_test_suites()
-
-        # Sanity-check the suites to make sure they don't point to other suites.
-        suite_dirs = [suite.name for suite in suites]
-        for suite in suites:
-            assert suite.base not in suite_dirs
-
-        for suite in suites:
-            base_tests = self._real_tests([suite.base])
-            suite.tests = {}
-            for test in base_tests:
-                suite.tests[test.replace(suite.base, suite.name, 1)] = test
-        return suites
-
-    def _virtual_tests(self, paths, suites):
-        virtual_tests = list()
-        for suite in suites:
-            if paths:
-                for test in suite.tests:
-                    if any(test.startswith(p) for p in paths):
-                        virtual_tests.append(test)
-            else:
-                virtual_tests.extend(suite.tests.keys())
-        return virtual_tests
-
-    def lookup_virtual_test_base(self, test_name):
-        for suite in self.populated_virtual_test_suites():
-            if test_name.startswith(suite.name):
-                return test_name.replace(suite.name, suite.base, 1)
-        return None
-
-    def lookup_virtual_test_args(self, test_name):
-        for suite in self.populated_virtual_test_suites():
-            if test_name.startswith(suite.name):
-                return suite.args
-        return []
-
     def should_run_as_pixel_test(self, test_input):
         if not self._options.pixel_tests:
             return False
@@ -1392,13 +1338,3 @@ class Port(object):
     def test_expectations_file_position(self):
         # By default baseline search path schema is i.e. port-wk2 -> wk2 -> port -> generic, so port expectations file is at second to last position.
         return 1
-
-class VirtualTestSuite(object):
-    def __init__(self, name, base, args, tests=None):
-        self.name = name
-        self.base = base
-        self.args = args
-        self.tests = tests or set()
-
-    def __repr__(self):
-        return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self.args)
index 65e8737b8f0bfed3309d6417a67dea2524a9b12d..6f7ab3f7db912a0e7c3a52adee6972b19cb76b12 100755 (executable)
@@ -350,20 +350,12 @@ class PortTest(unittest.TestCase):
         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'))
@@ -371,28 +363,13 @@ class PortTest(unittest.TestCase):
         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'))
-
     def test_tests(self):
         port = self.make_port(with_tests=True)
         tests = port.tests([])
         self.assertIn('passes/text.html', tests)
-        self.assertIn('virtual/passes/text.html', tests)
 
         tests = port.tests(['passes'])
         self.assertIn('passes/text.html', tests)
-        self.assertIn('passes/passes/test-virtual-passes.html', tests)
-        self.assertNotIn('virtual/passes/text.html', tests)
-
-        tests = port.tests(['virtual/passes'])
-        self.assertNotIn('passes/text.html', tests)
-        self.assertIn('virtual/passes/test-virtual-passes.html', tests)
-        self.assertIn('virtual/passes/passes/test-virtual-passes.html', tests)
-        self.assertNotIn('virtual/passes/test-virtual-virtual/passes.html', tests)
-        self.assertNotIn('virtual/passes/virtual/passes/test-virtual-passes.html', tests)
 
     def test_build_path(self):
         port = self.make_port(options=optparse.Values({'build_directory': '/my-build-directory/'}))
index 8422433eb2fa397219ffec72543cddf2eaca92db..81a478da0e9c143eec1f148125e67cccee9024a0 100644 (file)
@@ -573,13 +573,6 @@ class DriverProxy(object):
         return self._driver.uri_to_test(uri)
 
     def run_test(self, driver_input, stop_when_done):
-        base = self._port.lookup_virtual_test_base(driver_input.test_name)
-        if base:
-            virtual_driver_input = copy.copy(driver_input)
-            virtual_driver_input.test_name = base
-            virtual_driver_input.args = self._port.lookup_virtual_test_args(driver_input.test_name)
-            return self.run_test(virtual_driver_input, stop_when_done)
-
         pixel_tests_needed = driver_input.should_run_pixel_test
         cmd_line_key = self._cmd_line_as_key(pixel_tests_needed, driver_input.args)
         if cmd_line_key != self._driver_cmd_line:
index 26f39c3fdf85c06d733f8dcd54c95f2a9d09a51f..3ac14a5f5fdd1a90460c5a04f97cbf1f37c7e169 100644 (file)
@@ -31,7 +31,6 @@ import sys
 import time
 
 from webkitpy.port import Port, Driver, DriverOutput
-from webkitpy.port.base import VirtualTestSuite
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.crashlogs import CrashLogs
@@ -100,7 +99,7 @@ class TestList(object):
 #
 # These numbers may need to be updated whenever we add or delete tests.
 #
-TOTAL_TESTS = 107
+TOTAL_TESTS = 71
 TOTAL_SKIPS = 28
 TOTAL_RETRIES = 14
 
@@ -254,11 +253,6 @@ layer at (0,0) size 800x34
         actual_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
         expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-png')
 
-    # For testing that virtual test suites don't expand names containing themselves
-    # See webkit.org/b/97925 and base_unittest.PortTest.test_tests().
-    tests.add('passes/test-virtual-passes.html')
-    tests.add('passes/passes/test-virtual-passes.html')
-
     return tests
 
 
@@ -343,7 +337,6 @@ Bug(test) passes/skipped/skip.html [ Skip ]
         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', '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()
 
@@ -445,8 +438,7 @@ class TestPort(Port):
 
     def _skipped_tests_for_unsupported_features(self, test_list):
         return set(['failures/expected/skip_text.html',
-                    'failures/unexpected/skip_pass.html',
-                    'virtual/skipped'])
+                    'failures/unexpected/skip_pass.html'])
 
     def name(self):
         return self._name
@@ -525,13 +517,6 @@ class TestPort(Port):
     def all_baseline_variants(self):
         return self.ALL_BASELINE_VARIANTS
 
-    def virtual_test_suites(self):
-        return [
-            VirtualTestSuite('virtual/passes', 'passes', ['--virtual-arg']),
-            VirtualTestSuite('virtual/skipped', 'failures/expected', ['--virtual-arg2']),
-        ]
-
-
 class TestDriver(Driver):
     """Test/Dummy implementation of the DumpRenderTree interface."""
     next_pid = 1
index beeebdd7f88a402ebad2200fa7ff4cab86d2df32..557a526fd01d8e6db730921d49fad59af91ef705 100644 (file)
@@ -539,8 +539,6 @@ class PrintBaselines(Command):
                         help='display the baselines for *all* tests'),
             make_option('--csv', action='store_true', default=False,
                         help='Print a CSV-style report that includes the port name, test_name, test platform, baseline type, baseline location, and baseline platform'),
-            make_option('--include-virtual-tests', action='store_true',
-                        help='Include virtual tests'),
         ] + platform_options(use_globs=True)
         Command.__init__(self, options=options)
         self._platform_regexp = re.compile('platform/([^\/]+)/(.+)')
@@ -558,11 +556,8 @@ class PrintBaselines(Command):
         else:
             port_names = [default_port.name()]
 
-        if options.include_virtual_tests:
-            tests = sorted(default_port.tests(args))
-        else:
-            # FIXME: make real_tests() a public method.
-            tests = sorted(default_port._real_tests(args))
+        # FIXME: make real_tests() a public method.
+        tests = sorted(default_port._real_tests(args))
 
         for port_name in port_names:
             if port_name != port_names[0]:
index 138c1ef9b00620a16f9b6ddf3847a93775c55496..6ae010039b1e58d5230210a37f2db76088bea3da 100644 (file)
@@ -262,7 +262,7 @@ class PrintBaselinesTest(unittest.TestCase):
         command = PrintBaselines()
         command.bind_to_tool(self.tool)
         self.capture_output()
-        command.execute(MockOptions(all=False, include_virtual_tests=False, csv=False, platform=None), ['passes/text.html'], self.tool)
+        command.execute(MockOptions(all=False, csv=False, platform=None), ['passes/text.html'], self.tool)
         stdout, _, _ = self.restore_output()
         self.assertMultiLineEqual(stdout,
                           ('// For test-win-xp\n'
@@ -273,7 +273,7 @@ class PrintBaselinesTest(unittest.TestCase):
         command = PrintBaselines()
         command.bind_to_tool(self.tool)
         self.capture_output()
-        command.execute(MockOptions(all=False, include_virtual_tests=False, csv=False, platform='test-win-*'), ['passes/text.html'], self.tool)
+        command.execute(MockOptions(all=False, csv=False, platform='test-win-*'), ['passes/text.html'], self.tool)
         stdout, _, _ = self.restore_output()
         self.assertMultiLineEqual(stdout,
                           ('// For test-win-vista\n'
@@ -292,7 +292,7 @@ class PrintBaselinesTest(unittest.TestCase):
         command = PrintBaselines()
         command.bind_to_tool(self.tool)
         self.capture_output()
-        command.execute(MockOptions(all=False, platform='*xp', csv=True, include_virtual_tests=False), ['passes/text.html'], self.tool)
+        command.execute(MockOptions(all=False, platform='*xp', csv=True), ['passes/text.html'], self.tool)
         stdout, _, _ = self.restore_output()
         self.assertMultiLineEqual(stdout,
                           ('test-win-xp,passes/text.html,None,png,passes/text-expected.png,None\n'