Changeset 203400 in webkit


Ignore:
Timestamp:
Jul 19, 2016 12:38:55 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Youenn Fablet <youenn@apple.com> 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.

Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203394 r203400  
     12016-07-19  Youenn Fablet  <youenn@apple.com>
     2
     3        Add new aliases to http test server
     4        https://bugs.webkit.org/show_bug.cgi?id=159878
     5
     6        Reviewed by Darin Adler.
     7
     8        * http/tests/xmlhttprequest/set-bad-headervalue.html: Updating testharness.js and testharnessreport.js links to
     9        ensure these new links are working on test servers.
     10
    1112016-07-18  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/LayoutTests/http/tests/xmlhttprequest/set-bad-headervalue.html

    r188333 r203400  
    44    <meta charset="utf-8">
    55    <title>XMLHttpRequest: setRequestHeader() value argument checks</title>
    6     <script src="/js-test-resources/testharness.js"></script>
    7     <script src="/js-test-resources/testharnessreport.js"></script>
     6    <script src="/resources/testharness.js"></script>
     7    <script src="/resources/testharnessreport.js"></script>
    88    <!-- 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 -->
    99  </head>
  • trunk/Tools/ChangeLog

    r203386 r203400  
     12016-07-19  Youenn Fablet  <youenn@apple.com>
     2
     3        Add new aliases to http test server
     4        https://bugs.webkit.org/show_bug.cgi?id=159878
     5
     6        Reviewed by Darin Adler.
     7
     8        Adding testharness.css, testharness.js and testharnessreport.js new aliases to http test servers.
     9        Adding explicitly these links to perl script.
     10        Extracting default alias in an aliases.json file.
     11        Reading that file from python scripts to initialize aliases from that file.
     12
     13        Python script changes covered by unit tests and changed layout test.
     14
     15        * Scripts/webkitperl/httpd.pm:
     16        (getDefaultConfigForTestDirectory): Adding 3 new aliases
     17        * Scripts/webkitpy/layout_tests/servers/aliases.json: Added.
     18        * Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
     19        (LayoutTestApacheHttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
     20        Adding -c directives for each alias.
     21        * Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py:
     22        (TestLayoutTestApacheHttpd.test_start_cmd): Adding aliases.json mock-up file.
     23        * Scripts/webkitpy/layout_tests/servers/http_server.py:
     24        (Lighttpd.__init__): Setting upper class tests_dir member if needed and according constructor parameter.
     25        Adding alias directive for each alias.
     26        (Lighttpd._prepare_config):
     27        * Scripts/webkitpy/layout_tests/servers/http_server_base.py:
     28        (HttpServerBase.__init__): Adding tests_dir member with a default value being layout tests directory.
     29        (HttpServerBase.aliases): Computing of alias from the json file, paths to the real files being relative to
     30        layout tests directory.
     31        * Scripts/webkitpy/layout_tests/servers/http_server_unittest.py:
     32        (TestHttpServer.test_start_cmd): Adding aliases.json mock-up file and updating test expectation.
     33        (TestHttpServer.test_win32_start_and_stop): Adding aliases.json mock-up file.
     34
    1352016-07-18  Aakash Jain  <aakash_jain@apple.com>
    236
  • trunk/Tools/Scripts/webkitperl/httpd.pm

    r179405 r203400  
    113113    my $httpdConfig = getHTTPDConfigPathForTestDirectory($testDirectory);
    114114    my $documentRoot = File::Spec->catfile($testDirectory, "http", "tests");
     115
     116    # Aliases should be kept synchronized with Tools/Scripts/webkitpy/layout_tests/servers/aliases.json.
    115117    my $jsTestResourcesDirectory = File::Spec->catfile($testDirectory, "resources");
    116118    my $mediaResourcesDirectory = File::Spec->catfile($testDirectory, "media");
     119    my $testharnesscssDirectory = File::Spec->catfile($testDirectory, "resources", "testharness.css");
     120    my $testharnessjsDirectory = File::Spec->catfile($testDirectory, "resources", "testharness.js");
     121    my $testharnessreportjsDirectory = File::Spec->catfile($testDirectory, "resources", "testharnessreport.js");
     122
    117123    my $typesConfig = File::Spec->catfile($testDirectory, "http", "conf", "mime.types");
    118124    my $httpdLockFile = File::Spec->catfile($httpdPidDir, "httpd.lock");
     
    125131        "-c", "Alias /js-test-resources \"$jsTestResourcesDirectory\"",
    126132        "-c", "Alias /media-resources \"$mediaResourcesDirectory\"",
     133        "-c", "Alias /testharness.css \"$testharnesscssDirectory\"",
     134        "-c", "Alias /testharness.js \"$testharnessjsDirectory\"",
     135        "-c", "Alias /testharnessreport.js \"$testharnessreportjsDirectory\"",
    127136        "-c", "TypesConfig \"$typesConfig\"",
    128137        # Apache wouldn't run CGIs with permissions==700 otherwise
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py

    r196778 r203400  
    3535import re
    3636import socket
    37 import sys
    3837
    3938from webkitpy.layout_tests.servers import http_server_base
     
    6665        self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
    6766
    68         test_dir = self._port_obj.layout_tests_dir()
    69 
    7067        if port_obj.host.platform.is_win():
    7168            # Convert to MSDOS file naming:
     
    7471            output_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", output_dir)
    7572            output_dir = precompiledDrive.sub("C:", output_dir)
    76             test_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", test_dir)
    77             test_dir = precompiledDrive.sub("C:", test_dir)
     73            self.tests_dir = precompiledBuildbot.sub("C:/cygwin/home/buildbot", self.tests_dir)
     74            self.tests_dir = precompiledDrive.sub("C:", self.tests_dir)
    7875            self._pid_file = self._filesystem.join("C:/xampp/apache/logs", '%s.pid' % self._name)
    7976
    80         js_test_resources_dir = self._filesystem.join(test_dir, "resources")
    81         media_resources_dir = self._filesystem.join(test_dir, "media")
    82         mime_types_path = self._filesystem.join(test_dir, "http", "conf", "mime.types")
    83         cert_file = self._filesystem.join(test_dir, "http", "conf", "webkit-httpd.pem")
     77        mime_types_path = self._filesystem.join(self.tests_dir, "http", "conf", "mime.types")
     78        cert_file = self._filesystem.join(self.tests_dir, "http", "conf", "webkit-httpd.pem")
    8479        access_log = self._filesystem.join(output_dir, "access_log.txt")
    8580        error_log = self._filesystem.join(output_dir, "error_log.txt")
    86         document_root = self._filesystem.join(test_dir, "http", "tests")
     81        document_root = self._filesystem.join(self.tests_dir, "http", "tests")
    8782
    8883        if port_obj.get_option('http_access_log'):
     
    9691
    9792        start_cmd = [executable,
    98             '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_dir),
     93            '-f', "\"%s\"" % self._get_apache_config_file_path(self.tests_dir, output_dir),
    9994            '-C', "\'DocumentRoot \"%s\"\'" % document_root,
    100             '-c', "\'Alias /js-test-resources \"%s\"'" % js_test_resources_dir,
    101             '-c', "\'Alias /media-resources \"%s\"'" % media_resources_dir,
    10295            '-c', "\'TypesConfig \"%s\"\'" % mime_types_path,
    10396            '-c', "\'CustomLog \"%s\" common\'" % access_log,
     
    10598            '-c', "\'PidFile %s'" % self._pid_file,
    10699            '-k', "start"]
     100
     101        for alias in self.aliases():
     102            start_cmd.extend(['-c', "\'Alias %s \"%s\"'" % (alias[0], alias[1])])
    107103
    108104        if not port_obj.host.platform.is_win():
     
    144140
    145141        stop_cmd = [executable,
    146             '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_dir),
     142            '-f', "\"%s\"" % self._get_apache_config_file_path(self.tests_dir, output_dir),
    147143            '-c', "\'PidFile %s'" % self._pid_file,
    148144            '-k', "stop"]
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py

    r192944 r203400  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 import re
    3029import sys
    3130import unittest
     
    3635from webkitpy.port import test
    3736from webkitpy.layout_tests.servers.apache_http_server import LayoutTestApacheHttpd
    38 from webkitpy.layout_tests.servers.http_server_base import ServerError
    3937
    4038
     
    5351        test_port = test.TestPort(host)
    5452        host.filesystem.write_text_file(test_port._path_to_apache_config_file(), '')
     53        host.filesystem.write_text_file(
     54            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
    5555
    5656        server = LayoutTestApacheHttpd(test_port, "/mock/output_dir")
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py

    r196778 r203400  
    5555        self._run_background = run_background
    5656        self._additional_dirs = additional_dirs
    57         self._layout_tests_dir = layout_tests_dir
     57        if layout_tests_dir:
     58            self.tests_dir = layout_tests_dir
    5859
    5960        self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
     
    6263            self._port = int(self._port)
    6364
    64         if not self._layout_tests_dir:
    65             self._layout_tests_dir = self._port_obj.layout_tests_dir()
    66 
    67         self._webkit_tests = os.path.join(self._layout_tests_dir, 'http', 'tests')
    68         self._js_test_resource = os.path.join(self._layout_tests_dir, 'resources')
    69         self._media_resource = os.path.join(self._layout_tests_dir, 'media')
     65        self._webkit_tests = os.path.join(self.tests_dir, 'http', 'tests')
    7066
    7167        # Self generated certificate for SSL server (for client cert get
     
    127123        f.write(('server.upload-dirs = ( "%s" )\n\n') % (self._output_dir))
    128124
    129         # Setup a link to where the js test templates are stored
    130         f.write(('alias.url = ( "/js-test-resources" => "%s" )\n\n') %
    131                     (self._js_test_resource))
     125        # Setup a link to where the js test templates and media resources are stored.
     126        operator = "="
     127        for alias in self.aliases():
     128            f.write(('alias.url %s ( "%s" => "%s" )\n\n') % (operator, alias[0], alias[1]))
     129            operator = "+="
    132130
    133131        if self._additional_dirs:
    134132            for alias, path in self._additional_dirs.iteritems():
    135133                f.write(('alias.url += ( "%s" => "%s" )\n\n') % (alias, path))
    136 
    137         # Setup a link to where the media resources are stored.
    138         f.write(('alias.url += ( "/media-resources" => "%s" )\n\n') %
    139                     (self._media_resource))
    140134
    141135        # dump out of virtual host config at the bottom.
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py

    r192944 r203400  
    3030
    3131import errno
     32import json
    3233import logging
    3334import socket
     
    5556        self._pid_file = None
    5657        self._port_obj = port_obj
     58        self.tests_dir = self._port_obj.layout_tests_dir()
    5759
    5860        # We need a non-checkout-dependent place to put lock files, etc. We
     
    154156
    155157    # Utility routines.
     158
     159    def aliases(self):
     160        json_data = self._filesystem.read_text_file(self._port_obj.path_from_webkit_base("Tools", "Scripts", "webkitpy", "layout_tests", "servers", "aliases.json"))
     161        results = []
     162        for item in json.loads(json_data):
     163            results.append([item[0], self._port_obj._filesystem.join(self.tests_dir, item[1])])
     164        return results
    156165
    157166    def _remove_pid_file(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py

    r192944 r203400  
    4848            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/lighttpd.conf", "Mock Config\n")
    4949        host.filesystem.write_text_file(
     50            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
     51        host.filesystem.write_text_file(
    5052            "/usr/lib/lighttpd/liblightcomp.dylib", "Mock dylib")
    5153
     
    5961        self.assertEqual(re.findall(r"alias.url.+", config_file), [
    6062            'alias.url = ( "/js-test-resources" => "/test.checkout/LayoutTests/resources" )',
     63            'alias.url += ( "/media-resources" => "/test.checkout/LayoutTests/media" )',
     64            'alias.url += ( "/test/test.file" => "/test.checkout/LayoutTests/resources/testfile" )',
    6165            'alias.url += ( "/mock/one-additional-dir" => "/mock-checkout/one-additional-dir" )',
    6266            'alias.url += ( "/mock/another-additional-dir" => "/mock-checkout/one-additional-dir" )',
    63             'alias.url += ( "/media-resources" => "/test.checkout/LayoutTests/media" )',
    6467        ])
    6568
     
    7174        host.filesystem.write_text_file(
    7275            "/usr/lib/lighttpd/liblightcomp.dylib", "Mock dylib")
     76        host.filesystem.write_text_file(
     77            "/mock-checkout/Tools/Scripts/webkitpy/layout_tests/servers/aliases.json", '[["/js-test-resources", "resources"], ["/media-resources", "media"], ["/test/test.file", "resources/testfile"]]')
    7378
    7479        host.platform.is_win = lambda: True
Note: See TracChangeset for help on using the changeset viewer.