Title: [203400] trunk
Revision
203400
Author
[email protected]
Date
2016-07-19 00:38:55 -0700 (Tue, 19 Jul 2016)

Log Message

Add new aliases to http test server
https://bugs.webkit.org/show_bug.cgi?id=159878

Patch by Youenn Fablet <[email protected]> on 2016-07-19
Reviewed by Darin Adler.

Tools:

Adding testharness.css, testharness.js and testharnessreport.js new aliases to http test servers.
Adding explicitly these links to perl script.
Extracting default alias in an aliases.json file.
Reading that file from python scripts to initialize aliases from that file.

Python script changes covered by unit tests and changed layout test.

* Scripts/webkitperl/httpd.pm:
(getDefaultConfigForTestDirectory): Adding 3 new aliases
* Scripts/webkitpy/layout_tests/servers/aliases.json: Added.
* Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
(LayoutTestApacheHttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
Adding -c directives for each alias.
* Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py:
(TestLayoutTestApacheHttpd.test_start_cmd): Adding aliases.json mock-up file.
* Scripts/webkitpy/layout_tests/servers/http_server.py:
(Lighttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
Adding alias directive for each alias.
(Lighttpd._prepare_config):
* Scripts/webkitpy/layout_tests/servers/http_server_base.py:
(HttpServerBase.__init__): Adding tests_dir member with a default value being layout tests directory.
(HttpServerBase.aliases): Computing of alias from the json file, paths to the real files being relative to
layout tests directory.
* Scripts/webkitpy/layout_tests/servers/http_server_unittest.py:
(TestHttpServer.test_start_cmd): Adding aliases.json mock-up file and updating test expectation.
(TestHttpServer.test_win32_start_and_stop): Adding aliases.json mock-up file.

LayoutTests:

* http/tests/xmlhttprequest/set-bad-headervalue.html: Updating testharness.js and testharnessreport.js links to
ensure these new links are working on test servers.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203399 => 203400)


--- trunk/LayoutTests/ChangeLog	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/LayoutTests/ChangeLog	2016-07-19 07:38:55 UTC (rev 203400)
@@ -1,3 +1,13 @@
+2016-07-19  Youenn Fablet  <[email protected]>
+
+        Add new aliases to http test server
+        https://bugs.webkit.org/show_bug.cgi?id=159878
+
+        Reviewed by Darin Adler.
+
+        * http/tests/xmlhttprequest/set-bad-headervalue.html: Updating testharness.js and testharnessreport.js links to
+        ensure these new links are working on test servers.
+
 2016-07-18  Chris Dumez  <[email protected]>
 
         input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as "null"

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/set-bad-headervalue.html (203399 => 203400)


--- trunk/LayoutTests/http/tests/xmlhttprequest/set-bad-headervalue.html	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/set-bad-headervalue.html	2016-07-19 07:38:55 UTC (rev 203400)
@@ -3,8 +3,8 @@
   <head>
     <meta charset="utf-8">
     <title>XMLHttpRequest: setRequestHeader() value argument checks</title>
-    <script src=""
-    <script src=""
+    <script src=""
+    <script src=""
     <!-- Test based on http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/setrequestheader-bogus-value.htm This test should be removed once wpt XMLHttpRequest is imported if both tests are in sync -->
   </head>
   <body>

Modified: trunk/Tools/ChangeLog (203399 => 203400)


--- trunk/Tools/ChangeLog	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/ChangeLog	2016-07-19 07:38:55 UTC (rev 203400)
@@ -1,3 +1,37 @@
+2016-07-19  Youenn Fablet  <[email protected]>
+
+        Add new aliases to http test server
+        https://bugs.webkit.org/show_bug.cgi?id=159878
+
+        Reviewed by Darin Adler.
+
+        Adding testharness.css, testharness.js and testharnessreport.js new aliases to http test servers.
+        Adding explicitly these links to perl script.
+        Extracting default alias in an aliases.json file.
+        Reading that file from python scripts to initialize aliases from that file.
+
+        Python script changes covered by unit tests and changed layout test.
+
+        * Scripts/webkitperl/httpd.pm:
+        (getDefaultConfigForTestDirectory): Adding 3 new aliases
+        * Scripts/webkitpy/layout_tests/servers/aliases.json: Added.
+        * Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
+        (LayoutTestApacheHttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
+        Adding -c directives for each alias.
+        * Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py:
+        (TestLayoutTestApacheHttpd.test_start_cmd): Adding aliases.json mock-up file.
+        * Scripts/webkitpy/layout_tests/servers/http_server.py:
+        (Lighttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
+        Adding alias directive for each alias.
+        (Lighttpd._prepare_config):
+        * Scripts/webkitpy/layout_tests/servers/http_server_base.py:
+        (HttpServerBase.__init__): Adding tests_dir member with a default value being layout tests directory.
+        (HttpServerBase.aliases): Computing of alias from the json file, paths to the real files being relative to
+        layout tests directory.
+        * Scripts/webkitpy/layout_tests/servers/http_server_unittest.py:
+        (TestHttpServer.test_start_cmd): Adding aliases.json mock-up file and updating test expectation.
+        (TestHttpServer.test_win32_start_and_stop): Adding aliases.json mock-up file.
+
 2016-07-18  Aakash Jain  <[email protected]>
 
         EWS console logs doesn't go to log file

Modified: trunk/Tools/Scripts/webkitperl/httpd.pm (203399 => 203400)


--- trunk/Tools/Scripts/webkitperl/httpd.pm	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitperl/httpd.pm	2016-07-19 07:38:55 UTC (rev 203400)
@@ -112,8 +112,14 @@
 
     my $httpdConfig = getHTTPDConfigPathForTestDirectory($testDirectory);
     my $documentRoot = File::Spec->catfile($testDirectory, "http", "tests");
+
+    # Aliases should be kept synchronized with Tools/Scripts/webkitpy/layout_tests/servers/aliases.json.
     my $jsTestResourcesDirectory = File::Spec->catfile($testDirectory, "resources");
     my $mediaResourcesDirectory = File::Spec->catfile($testDirectory, "media");
+    my $testharnesscssDirectory = File::Spec->catfile($testDirectory, "resources", "testharness.css");
+    my $testharnessjsDirectory = File::Spec->catfile($testDirectory, "resources", "testharness.js");
+    my $testharnessreportjsDirectory = File::Spec->catfile($testDirectory, "resources", "testharnessreport.js");
+
     my $typesConfig = File::Spec->catfile($testDirectory, "http", "conf", "mime.types");
     my $httpdLockFile = File::Spec->catfile($httpdPidDir, "httpd.lock");
     my $httpdScoreBoardFile = File::Spec->catfile($httpdPidDir, "httpd.scoreboard");
@@ -124,6 +130,9 @@
         # Setup a link to where the js test templates are stored, use -c so that mod_alias will already be loaded.
         "-c", "Alias /js-test-resources \"$jsTestResourcesDirectory\"",
         "-c", "Alias /media-resources \"$mediaResourcesDirectory\"",
+        "-c", "Alias /testharness.css \"$testharnesscssDirectory\"",
+        "-c", "Alias /testharness.js \"$testharnessjsDirectory\"",
+        "-c", "Alias /testharnessreport.js \"$testharnessreportjsDirectory\"",
         "-c", "TypesConfig \"$typesConfig\"",
         # Apache wouldn't run CGIs with permissions==700 otherwise
         "-c", "PidFile \"$httpdPidFile\"",

Added: trunk/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json (0 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json	2016-07-19 07:38:55 UTC (rev 203400)
@@ -0,0 +1,7 @@
+[
+    ["/js-test-resources", "resources"],
+    ["/media-resources", "media"],
+    ["/resources/testharness.css", "resources/testharness.css"],
+    ["/resources/testharness.js", "resources/testharness.js"],
+    ["/resources/testharnessreport.js", "resources/testharnessreport.js"]
+]

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py (203399 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py	2016-07-19 07:38:55 UTC (rev 203400)
@@ -34,7 +34,6 @@
 import os
 import re
 import socket
-import sys
 
 from webkitpy.layout_tests.servers import http_server_base
 
@@ -65,8 +64,6 @@
 
         self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
 
-        test_dir = self._port_obj.layout_tests_dir()
-
         if port_obj.host.platform.is_win():
             # Convert to MSDOS file naming:
             precompiledBuildbot = re.compile('^/home/buildbot')
@@ -73,17 +70,15 @@
             precompiledDrive = re.compile('^/cygdrive/[cC]')
             output_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", output_dir)
             output_dir = precompiledDrive.sub("C:", output_dir)
-            test_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", test_dir)
-            test_dir = precompiledDrive.sub("C:", test_dir)
+            self.tests_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", self.tests_dir)
+            self.tests_dir = precompiledDrive.sub("C:", self.tests_dir)
             self._pid_file = self._filesystem.join("C:/xampp/apache/logs", '%s.pid' % self._name)
 
-        js_test_resources_dir = self._filesystem.join(test_dir, "resources")
-        media_resources_dir = self._filesystem.join(test_dir, "media")
-        mime_types_path = self._filesystem.join(test_dir, "http", "conf", "mime.types")
-        cert_file = self._filesystem.join(test_dir, "http", "conf", "webkit-httpd.pem")
+        mime_types_path = self._filesystem.join(self.tests_dir, "http", "conf", "mime.types")
+        cert_file = self._filesystem.join(self.tests_dir, "http", "conf", "webkit-httpd.pem")
         access_log = self._filesystem.join(output_dir, "access_log.txt")
         error_log = self._filesystem.join(output_dir, "error_log.txt")
-        document_root = self._filesystem.join(test_dir, "http", "tests")
+        document_root = self._filesystem.join(self.tests_dir, "http", "tests")
 
         if port_obj.get_option('http_access_log'):
             access_log = port_obj.get_option('http_access_log')
@@ -95,10 +90,8 @@
         executable = self._port_obj._path_to_apache()
 
         start_cmd = [executable,
-            '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_dir),
+            '-f', "\"%s\"" % self._get_apache_config_file_path(self.tests_dir, output_dir),
             '-C', "\'DocumentRoot \"%s\"\'" % document_root,
-            '-c', "\'Alias /js-test-resources \"%s\"'" % js_test_resources_dir,
-            '-c', "\'Alias /media-resources \"%s\"'" % media_resources_dir,
             '-c', "\'TypesConfig \"%s\"\'" % mime_types_path,
             '-c', "\'CustomLog \"%s\" common\'" % access_log,
             '-c', "\'ErrorLog \"%s\"\'" % error_log,
@@ -105,6 +98,9 @@
             '-c', "\'PidFile %s'" % self._pid_file,
             '-k', "start"]
 
+        for alias in self.aliases():
+            start_cmd.extend(['-c', "\'Alias %s \"%s\"'" % (alias[0], alias[1])])
+
         if not port_obj.host.platform.is_win():
             start_cmd.extend(['-C', "\'User \"%s\"\'" % os.environ.get("USERNAME", os.environ.get("USER", ""))])
 
@@ -143,7 +139,7 @@
                         '-c', "\'</Location>\'"]
 
         stop_cmd = [executable,
-            '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_dir),
+            '-f', "\"%s\"" % self._get_apache_config_file_path(self.tests_dir, output_dir),
             '-c', "\'PidFile %s'" % self._pid_file,
             '-k', "stop"]
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py (203399 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py	2016-07-19 07:38:55 UTC (rev 203400)
@@ -26,7 +26,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import re
 import sys
 import unittest
 
@@ -35,7 +34,6 @@
 from webkitpy.common.host_mock import MockHost
 from webkitpy.port import test
 from webkitpy.layout_tests.servers.apache_http_server import LayoutTestApacheHttpd
-from webkitpy.layout_tests.servers.http_server_base import ServerError
 
 
 class TestLayoutTestApacheHttpd(unittest.TestCase):
@@ -52,6 +50,8 @@
         host.executive = MockExecutive(should_log=True)
         test_port = test.TestPort(host)
         host.filesystem.write_text_file(test_port._path_to_apache_config_file(), '')
+        host.filesystem.write_text_file(
+            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
 
         server = LayoutTestApacheHttpd(test_port, "/mock/output_dir")
         server._check_that_all_ports_are_available = lambda: True

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py (203399 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py	2016-07-19 07:38:55 UTC (rev 203400)
@@ -54,7 +54,8 @@
         self._root = root
         self._run_background = run_background
         self._additional_dirs = additional_dirs
-        self._layout_tests_dir = layout_tests_dir
+        if layout_tests_dir:
+            self.tests_dir = layout_tests_dir
 
         self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
 
@@ -61,13 +62,8 @@
         if self._port:
             self._port = int(self._port)
 
-        if not self._layout_tests_dir:
-            self._layout_tests_dir = self._port_obj.layout_tests_dir()
+        self._webkit_tests = os.path.join(self.tests_dir, 'http', 'tests')
 
-        self._webkit_tests = os.path.join(self._layout_tests_dir, 'http', 'tests')
-        self._js_test_resource = os.path.join(self._layout_tests_dir, 'resources')
-        self._media_resource = os.path.join(self._layout_tests_dir, 'media')
-
         # Self generated certificate for SSL server (for client cert get
         # <base-path>\chrome\test\data\ssl\certs\root_ca_cert.crt)
         self._pem_file = os.path.join(
@@ -126,18 +122,16 @@
         # does POST.
         f.write(('server.upload-dirs = ( "%s" )\n\n') % (self._output_dir))
 
-        # Setup a link to where the js test templates are stored
-        f.write(('alias.url = ( "/js-test-resources" => "%s" )\n\n') %
-                    (self._js_test_resource))
+        # Setup a link to where the js test templates and media resources are stored.
+        operator = "="
+        for alias in self.aliases():
+            f.write(('alias.url %s ( "%s" => "%s" )\n\n') % (operator, alias[0], alias[1]))
+            operator = "+="
 
         if self._additional_dirs:
             for alias, path in self._additional_dirs.iteritems():
                 f.write(('alias.url += ( "%s" => "%s" )\n\n') % (alias, path))
 
-        # Setup a link to where the media resources are stored.
-        f.write(('alias.url += ( "/media-resources" => "%s" )\n\n') %
-                    (self._media_resource))
-
         # dump out of virtual host config at the bottom.
         if self._root:
             if self._port:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py (203399 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py	2016-07-19 07:38:55 UTC (rev 203400)
@@ -29,6 +29,7 @@
 """Base class with common routines between the Apache, Lighttpd, and websocket servers."""
 
 import errno
+import json
 import logging
 import socket
 import sys
@@ -54,6 +55,7 @@
         self._pid = None
         self._pid_file = None
         self._port_obj = port_obj
+        self.tests_dir = self._port_obj.layout_tests_dir()
 
         # We need a non-checkout-dependent place to put lock files, etc. We
         # don't use the Python default on the Mac because it defaults to a
@@ -154,6 +156,13 @@
 
     # Utility routines.
 
+    def aliases(self):
+        json_data = self._filesystem.read_text_file(self._port_obj.path_from_webkit_base("Tools", "Scripts", "webkitpy", "layout_tests", "servers", "aliases.json"))
+        results = []
+        for item in json.loads(json_data):
+            results.append([item[0], self._port_obj._filesystem.join(self.tests_dir, item[1])])
+        return results
+
     def _remove_pid_file(self):
         if self._filesystem.exists(self._pid_file):
             self._filesystem.remove(self._pid_file)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py (203399 => 203400)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py	2016-07-19 06:50:49 UTC (rev 203399)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py	2016-07-19 07:38:55 UTC (rev 203400)
@@ -47,6 +47,8 @@
         host.filesystem.write_text_file(
             "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/lighttpd.conf", "Mock Config\n")
         host.filesystem.write_text_file(
+            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
+        host.filesystem.write_text_file(
             "/usr/lib/lighttpd/liblightcomp.dylib", "Mock dylib")
 
         server = Lighttpd(test_port, "/mock/output_dir",
@@ -58,9 +60,10 @@
         config_file = host.filesystem.read_text_file("/mock/output_dir/lighttpd.conf")
         self.assertEqual(re.findall(r"alias.url.+", config_file), [
             'alias.url = ( "/js-test-resources" => "/test.checkout/LayoutTests/resources" )',
+            'alias.url += ( "/media-resources" => "/test.checkout/LayoutTests/media" )',
+            'alias.url += ( "/test/test.file" => "/test.checkout/LayoutTests/resources/testfile" )',
             'alias.url += ( "/mock/one-additional-dir" => "/mock-checkout/one-additional-dir" )',
             'alias.url += ( "/mock/another-additional-dir" => "/mock-checkout/one-additional-dir" )',
-            'alias.url += ( "/media-resources" => "/test.checkout/LayoutTests/media" )',
         ])
 
     def test_win32_start_and_stop(self):
@@ -70,6 +73,8 @@
             "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/lighttpd.conf", "Mock Config\n")
         host.filesystem.write_text_file(
             "/usr/lib/lighttpd/liblightcomp.dylib", "Mock dylib")
+        host.filesystem.write_text_file(
+            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
 
         host.platform.is_win = lambda: True
         host.platform.is_cygwin = lambda: False
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to