Title: [91136] trunk/Tools
Revision
91136
Author
[email protected]
Date
2011-07-15 18:10:59 -0700 (Fri, 15 Jul 2011)

Log Message

[NRWT] Add support for --no-http
https://bugs.webkit.org/show_bug.cgi?id=64564

Reviewed by Dirk Pranke.

Added support for --no-http, which disables both HTTP and websockets tests.
It also matches the old-run-webkit-tests behavior if --force is used.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
Fixed HTTP_SUBDIR and WEBSOCKET_SUBDIR as tests do not start with a leading separator.
We check if --no-http is set and add the HTTP / websockets tests to the skipped list prior to looking
at the expectation file. Fixed the  _test_requires_lock function to use the same code path to determine
what is worth have an HTTP lock as --no-http to avoid badness.

* Scripts/webkitpy/layout_tests/port/test.py: Added 2 new tests to our mock filesystem to validate that
we do skip properly HTTP / websocket tests inside platform/.

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
Added tests that we properly skip all the tests.

* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
Added checks for the command line arguments.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (91135 => 91136)


--- trunk/Tools/ChangeLog	2011-07-16 00:27:02 UTC (rev 91135)
+++ trunk/Tools/ChangeLog	2011-07-16 01:10:59 UTC (rev 91136)
@@ -1,3 +1,28 @@
+2011-07-15  Julien Chaffraix  <[email protected]>
+
+        [NRWT] Add support for --no-http
+        https://bugs.webkit.org/show_bug.cgi?id=64564
+
+        Reviewed by Dirk Pranke.
+
+        Added support for --no-http, which disables both HTTP and websockets tests.
+        It also matches the old-run-webkit-tests behavior if --force is used.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        Fixed HTTP_SUBDIR and WEBSOCKET_SUBDIR as tests do not start with a leading separator.
+        We check if --no-http is set and add the HTTP / websockets tests to the skipped list prior to looking
+        at the expectation file. Fixed the  _test_requires_lock function to use the same code path to determine
+        what is worth have an HTTP lock as --no-http to avoid badness.
+
+        * Scripts/webkitpy/layout_tests/port/test.py: Added 2 new tests to our mock filesystem to validate that
+        we do skip properly HTTP / websocket tests inside platform/.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        Added tests that we properly skip all the tests.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        Added checks for the command line arguments.
+
 2011-07-13  Jon Honeycutt  <[email protected]>
 
         Focus and selection events are not fired when a <select>'s selection

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (91135 => 91136)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2011-07-16 00:27:02 UTC (rev 91135)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2011-07-16 01:10:59 UTC (rev 91136)
@@ -279,8 +279,8 @@
         self._message_broker = None
         self._expectations = None
 
-        self.HTTP_SUBDIR = port.TEST_PATH_SEPARATOR + 'http' + port.TEST_PATH_SEPARATOR
-        self.WEBSOCKET_SUBDIR = port.TEST_PATH_SEPARATOR + 'websocket' + port.TEST_PATH_SEPARATOR
+        self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR
+        self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR
         self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
         self._has_http_lock = False
 
@@ -356,6 +356,12 @@
             self._options.lint_test_files,
             port.test_expectations_overrides())
 
+    def _is_http_test(self, test):
+        return self.HTTP_SUBDIR in test or self.WEBSOCKET_SUBDIR in test
+
+    def _http_tests(self):
+        return set(test for test in self._test_files if self._is_http_test(test))
+
     def parse_expectations(self):
         """Parse the expectations from the test_list files and return a data
         structure holding them. Throws an error if the test_list files have
@@ -385,15 +391,18 @@
             return None
 
         skipped = set()
+
+        if not self._options.http:
+            skipped = skipped.union(self._http_tests())
+
         if num_all_test_files > 1 and not self._options.force:
-            skipped = self._expectations.get_tests_with_result_type(
-                           test_expectations.SKIP)
-            self._test_files -= skipped
+            skipped = skipped.union(self._expectations.get_tests_with_result_type(test_expectations.SKIP))
             if self._options.skip_failing_tests:
-                failing = self._expectations.get_tests_with_result_type(
-                               test_expectations.FAIL)
+                failing = self._expectations.get_tests_with_result_type(test_expectations.FAIL)
                 self._test_files -= failing
 
+        self._test_files -= skipped
+
         # Create a sorted list of test files so the subset chunk,
         # if used, contains alphabetically consecutive tests.
         self._test_files_list = list(self._test_files)
@@ -537,8 +546,7 @@
     def _test_requires_lock(self, test_file):
         """Return True if the test needs to be locked when
         running multiple copies of NRWTs."""
-        split_path = test_file.split(self._port.TEST_PATH_SEPARATOR)
-        return 'http' in split_path or 'websocket' in split_path
+        return self._is_http_test(test_file)
 
     def _test_is_slow(self, test_file):
         return self._expectations.has_modifier(test_file, test_expectations.SLOW)
@@ -935,6 +943,7 @@
         return unexpected_results['num_regressions']
 
     def start_servers_with_lock(self):
+        assert(self._options.http)
         self._printer.print_update('Acquiring http lock ...')
         self._port.acquire_http_lock()
         self._printer.print_update('Starting HTTP server ...')

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2011-07-16 00:27:02 UTC (rev 91135)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2011-07-16 01:10:59 UTC (rev 91136)
@@ -177,6 +177,11 @@
     # FIXME: Add a reftest which crashes.
 
     tests.add('websocket/tests/passes/text.html')
+
+    # For --no-http tests, test that platform specific HTTP tests are properly skipped.
+    tests.add('platform/test-snow-leopard/http/test.html')
+    tests.add('platform/test-snow-leopard/websocket/test.html')
+
     return tests
 
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (91135 => 91136)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-07-16 00:27:02 UTC (rev 91135)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-07-16 01:10:59 UTC (rev 91136)
@@ -153,6 +153,10 @@
             normalized_platform_directories.append(port.filesystem.normpath(path))
         options.additional_platform_directory = normalized_platform_directories
 
+    if not options.http and options.force:
+        warnings.append("--no-http is ignored since --force is also provided")
+        options.http = True
+
     return warnings
 
 
@@ -317,9 +321,10 @@
         optparse.make_option("--no-record-results", action=""
             default=True, dest="record_results",
             help="Don't record the results."),
-        # old-run-webkit-tests also has HTTP toggle options:
-        # --[no-]http                     Run (or do not run) http tests
-        #                                 (default: run)
+        optparse.make_option("--http", action="" dest="http",
+            default=True, help="Run HTTP and WebSocket tests (default)"),
+        optparse.make_option("--no-http", action="" dest="http",
+            help="Don't run HTTP and WebSocket tests"),
     ]
 
     test_options = [

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (91135 => 91136)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2011-07-16 00:27:02 UTC (rev 91135)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2011-07-16 01:10:59 UTC (rev 91136)
@@ -650,7 +650,28 @@
         res, buildbot_output, regular_output, user = logging_run(['--additional-platform-directory', 'foo'])
         self.assertTrue('--additional-platform-directory=foo is ignored since it is not absolute\n' in regular_output.get())
 
+    def test_no_http_and_force(self):
+        # See test_run_force, using --force raises an exception.
+        # FIXME: We would like to check the warnings generated.
+        self.assertRaises(ValueError, logging_run, ['--force', '--no-http'])
 
+    @staticmethod
+    def has_test_of_type(tests, type):
+        return [test for test in tests if type in test]
+
+    def test_no_http_tests(self):
+        batch_tests_dryrun = get_tests_run(['LayoutTests/http', 'websocket/'], flatten_batches=True)
+        self.assertTrue(MainTest.has_test_of_type(batch_tests_dryrun, 'http'))
+        self.assertTrue(MainTest.has_test_of_type(batch_tests_dryrun, 'websocket'))
+
+        batch_tests_run_no_http = get_tests_run(['--no-http', 'LayoutTests/http', 'websocket/'], flatten_batches=True)
+        self.assertFalse(MainTest.has_test_of_type(batch_tests_run_no_http, 'http'))
+        self.assertFalse(MainTest.has_test_of_type(batch_tests_run_no_http, 'websocket'))
+
+        batch_tests_run_http = get_tests_run(['--http', 'LayoutTests/http', 'websocket/'], flatten_batches=True)
+        self.assertTrue(MainTest.has_test_of_type(batch_tests_run_http, 'http'))
+        self.assertTrue(MainTest.has_test_of_type(batch_tests_run_http, 'websocket'))
+
 MainTest = skip_if(MainTest, sys.platform == 'cygwin' and compare_version(sys, '2.6')[0] < 0, 'new-run-webkit-tests tests hang on Cygwin Python 2.5.2')
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to