Modified: trunk/Tools/ChangeLog (229780 => 229781)
--- trunk/Tools/ChangeLog 2018-03-21 00:36:13 UTC (rev 229780)
+++ trunk/Tools/ChangeLog 2018-03-21 01:09:36 UTC (rev 229781)
@@ -1,3 +1,27 @@
+2018-03-20 Basuke Suzuki <basuke.suz...@sony.com>
+
+ [WinCairo] Fix to run-webkit-httpd from native Windows.
+ https://bugs.webkit.org/show_bug.cgi?id=183605
+
+ Reviewed by Daniel Bates.
+
+ This fix is to run Apache HTTP server from native Windows. The environment is different
+ from cygwin, which is used for AppleWin, in following points:
+ - A temporary file behaves differently. It cannot reopen by anybody when indicated as
+ delete on close. To solve this situation, filesystem.mkdtemp() is used instead.
+ - It's not unix so that `tail` command is not available. Replaced with python equivalent
+ function.
+
+ * Scripts/webkitpy/common/system/filesystem.py:
+ (FileSystem.mkdtemp.TemporaryDirectory.__init__):
+ (FileSystem.mkdtemp.TemporaryDirectory.__exit__): The existing contents would be deleted.
+ (FileSystem.mkdtemp):
+ * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
+ (parse_args):
+ (run_server):
+ (run_server_with_log_file):
+ (follow_file):
+
2018-03-20 Brady Eidson <beid...@apple.com>
First piece of process swapping on navigation.
Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem.py (229780 => 229781)
--- trunk/Tools/Scripts/webkitpy/common/system/filesystem.py 2018-03-21 00:36:13 UTC (rev 229780)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem.py 2018-03-21 01:09:36 UTC (rev 229781)
@@ -176,7 +176,8 @@
methods. If you need a string, coerce the object to a string and go from there.
"""
class TemporaryDirectory(object):
- def __init__(self, **kwargs):
+ def __init__(self, filesystem, **kwargs):
+ self._filesystem = filesystem
self._kwargs = kwargs
self._directory_path = tempfile.mkdtemp(**self._kwargs)
@@ -187,14 +188,11 @@
return self._directory_path
def __exit__(self, type, value, traceback):
- # Only self-delete if necessary.
+ if self._filesystem.exists(self._directory_path):
+ self._filesystem.rmtree(self._directory_path)
- # FIXME: Should we delete non-empty directories?
- if os.path.exists(self._directory_path):
- os.rmdir(self._directory_path)
+ return TemporaryDirectory(self, **kwargs)
- return TemporaryDirectory(**kwargs)
-
def maybe_make_directory(self, *path):
"""Create the specified directory if it doesn't already exist."""
try:
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py (229780 => 229781)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py 2018-03-21 00:36:13 UTC (rev 229780)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py 2018-03-21 01:09:36 UTC (rev 229781)
@@ -32,11 +32,12 @@
import optparse
import subprocess
import sys
-import tempfile
+import time
from webkitpy.common.host import Host
from webkitpy.layout_tests.servers import web_platform_test_server
from webkitpy.layout_tests.run_webkit_tests import EXCEPTIONAL_EXIT_STATUS
+from webkitpy.port import platform_options
def parse_args(args):
@@ -47,6 +48,11 @@
parser.add_option("--no-wpt", help="Do not start web-platform-tests server", action="" default=True, dest="web_platform_test_server")
parser.add_option("-D", "--additional-dir", help="Additional directory and alias", action="" default=[], type="string", nargs=2, dest="additional_dirs")
parser.add_option("-u", "--open-url", help="Open an URL", action="" default=[], type="string", dest="url")
+
+ option_group = optparse.OptionGroup(parser, "Platform options")
+ option_group.add_options(platform_options())
+ parser.add_option_group(option_group)
+
return parser.parse_args(args)
@@ -57,11 +63,15 @@
def run_server(options, args, stdout, stderr):
host = Host()
- log_file = tempfile.NamedTemporaryFile()
- options.http_access_log = log_file.name
- options.http_error_log = log_file.name
- options.platform = None
+ with host.filesystem.mkdtemp(prefix='webkit-httpd-') as temporary_directory:
+ log_file = host.filesystem.join(temporary_directory, 'access_log')
+ run_server_with_log_file(host, options, stdout, stderr, log_file)
+
+def run_server_with_log_file(host, options, stdout, stderr, log_file):
+ options.http_access_log = log_file
+ options.http_error_log = log_file
+
try:
port = host.port_factory.get(options.platform, options)
except NotImplementedError as e:
@@ -90,9 +100,8 @@
subprocess.Popen(['open', options.url], stdout=subprocess.PIPE)
try:
- tail = subprocess.Popen(['tail', '-F', log_file.name], stdout=subprocess.PIPE)
- while True:
- sys.stdout.write(tail.stdout.readline())
+ for line in follow_file(log_file):
+ stdout.write(line)
except KeyboardInterrupt:
if options.web_platform_test_server:
port.stop_web_platform_test_server()
@@ -101,5 +110,16 @@
port.stop_websocket_server()
+def follow_file(path):
+ """Python equivalent of TAIL(1)"""
+ with open(path) as file_handle:
+ while True:
+ line = file_handle.readline()
+ if not line:
+ time.sleep(0.1)
+ continue
+ yield line
+
+
if __name__ == '__main__':
sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))