summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-09 13:10:58 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-09 13:10:58 +0000
commit84cf76334d4175b3673d88bdbe431ee604face96 (patch)
tree77d651c8e271023c2612ca7fac819288cea39e20
parent02b5d70b745ae19dd1990086034def0ba64846e5 (diff)
downloadchromium_src-84cf76334d4175b3673d88bdbe431ee604face96.zip
chromium_src-84cf76334d4175b3673d88bdbe431ee604face96.tar.gz
chromium_src-84cf76334d4175b3673d88bdbe431ee604face96.tar.bz2
Changes to get the layout test harness running on mac.
Review URL: http://codereview.chromium.org/5614 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3095 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/lighttpd/README.GOOGLE29
-rw-r--r--webkit/tools/layout_tests/layout_package/http_server.py16
-rw-r--r--webkit/tools/layout_tests/layout_package/path_utils.py18
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils.py2
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_mac.py130
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_win.py39
-rw-r--r--webkit/tools/test_shell/mac/main.mm24
7 files changed, 232 insertions, 26 deletions
diff --git a/third_party/lighttpd/README.GOOGLE b/third_party/lighttpd/README.GOOGLE
index 637d6fb..9a5adb3 100644
--- a/third_party/lighttpd/README.GOOGLE
+++ b/third_party/lighttpd/README.GOOGLE
@@ -10,3 +10,32 @@ Modifications to the base install:
LightTPD is licensed under the "revised BSD license" (see COPYING.LIGHTTPD)
PHP is licensed under the PHP license (http://www.php.net/license/)
+
+******
+
+The Mac version of LigHTTPd is built on intel from LightTPD 1.4.20 with the
+following configure options defined:
+ --with-open-ssl
+ --prefix=/tmp/lighttpd so a "make install" bundles it
+ correctly
+
+We then use install_name_tool to fix up the hardcoded library defined that
+wants to look in /usr/local/lib
+
+ $ install_name_tool -change /usr/local/lib/liblightcomp.dylib @executable_path/../lib/liblightcomp.dylib /tmp/lighttpd/sbin/lighttpd
+
+This also needs to be done for many of the mac/lib/mod_* libraries.
+
+The Mac version of php-cgi is built from PHP 5.2.6 with the following
+configure options:
+
+ --prefix=/tmp/php
+ --enable-fastcgi
+ --enable-sockets
+ --enable-libxml
+ --enable-force-cgi-redirect
+
+The resulting libraries and executables are then copied into the third_party
+dir in the source tree to mirror where the windows executables live. It's
+unfortunate that we can't build this all from source as part of the build
+process, but the source isn't checked in for windows, so.... \ No newline at end of file
diff --git a/webkit/tools/layout_tests/layout_package/http_server.py b/webkit/tools/layout_tests/layout_package/http_server.py
index 8c30d24..7e3aeab 100644
--- a/webkit/tools/layout_tests/layout_package/http_server.py
+++ b/webkit/tools/layout_tests/layout_package/http_server.py
@@ -9,6 +9,7 @@
import logging
import optparse
import os
+import platform_utils
import subprocess
import sys
import time
@@ -82,11 +83,12 @@ class Lighttpd:
# Write out our cgi handlers. Run perl through env so that it processes
# the #! line and runs perl with the proper command line arguments.
# Emulate apache's mod_asis with a cat cgi handler.
+ platform_util = platform_utils.PlatformUtility('')
f.write(('cgi.assign = ( ".cgi" => "/usr/bin/env",\n'
' ".pl" => "/usr/bin/env",\n'
' ".asis" => "/usr/bin/cat",\n'
' ".php" => "%s" )\n\n') %
- PathFromBase('third_party', 'lighttpd', 'win', 'php5', 'php-cgi.exe'))
+ platform_util.LigHTTPdPHPPath())
# Setup log files
f.write(('server.errorlog = "%s"\n'
@@ -105,11 +107,13 @@ class Lighttpd:
'}\n\n') % (mapping['port'], mapping['docroot']))
f.close()
- start_cmd = [ PathFromBase('third_party', 'lighttpd', 'win', 'LightTPD.exe'),
+ executable = platform_util.LigHTTPdExecutablePath()
+ module_path = platform_util.LigHTTPdModulePath()
+ start_cmd = [ executable,
# Newly written config file
'-f', PathFromBase(self._output_dir, 'lighttpd.conf'),
# Where it can find its module dynamic libraries
- '-m', PathFromBase('third_party', 'lighttpd', 'win', 'lib'),
+ '-m', module_path,
# Don't background
'-D' ]
@@ -164,10 +168,8 @@ class Lighttpd:
return
logging.info('Shutting down http server')
-
- subprocess.Popen(('taskkill.exe', '/f', '/im', 'LightTPD.exe'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
+ platform_util = platform_utils.PlatformUtility('')
+ platform_util.ShutDownHTTPServer(self._process)
if self._process:
self._process.wait()
diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py
index 05fe8fd..d7316ce 100644
--- a/webkit/tools/layout_tests/layout_package/path_utils.py
+++ b/webkit/tools/layout_tests/layout_package/path_utils.py
@@ -7,6 +7,7 @@
import errno
import os
+import platform_utils
import subprocess
import sys
@@ -128,20 +129,17 @@ def ExpectedFilename(filename, suffix, custom_result_id):
# Failed to find the results anywhere, return default path anyway
return os.path.join(results_dirs[0], results_filename)
-def TestShellBinary():
- """Returns the name of the test_shell executable."""
- return 'test_shell.exe'
-
def TestShellBinaryPath(target):
"""Gets the full path to the test_shell binary for the target build
configuration. Raises PathNotFound if the file doesn't exist"""
- full_path = os.path.join(WebKitRoot(), target, TestShellBinary())
+ platform_util = platform_utils.PlatformUtility('')
+ full_path = os.path.join(WebKitRoot(), target,
+ platform_util.TestShellBinary())
+ if not os.path.exists(full_path):
+ # try output directory from either Xcode or chrome.sln
+ full_path = platform_util.TestShellBinaryPath(target)
if not os.path.exists(full_path):
- # try chrome's output directory in case test_shell was built by chrome.sln
- full_path = google.path_utils.FindUpward(WebKitRoot(), 'chrome', target,
- TestShellBinary())
- if not os.path.exists(full_path):
- raise PathNotFound('unable to find test_shell at %s' % full_path)
+ raise PathNotFound('unable to find test_shell at %s' % full_path)
return full_path
def RelativeTestFilename(filename):
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils.py b/webkit/tools/layout_tests/layout_package/platform_utils.py
index a48a506..5bbcdf8 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils.py
@@ -18,5 +18,7 @@ import sys
# included in any case so we don't get an import error.
if sys.platform in ('cygwin', 'win32'):
from platform_utils_win import *
+elif sys.platform == 'darwin':
+ from platform_utils_mac import *
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
new file mode 100644
index 0000000..36ca48c
--- /dev/null
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
@@ -0,0 +1,130 @@
+#!/usr/bin/python
+# Copyright (c) 2008 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Platform-specific utility methods shared by several scripts."""
+
+import os
+import re
+import subprocess
+import sys
+
+import google.path_utils
+
+import layout_package.path_utils
+
+# This will be a native path to the directory this file resides in.
+# It can either be relative or absolute depending how it's executed.
+THISDIR = os.path.dirname(os.path.abspath(__file__))
+def PathFromBase(*pathies):
+ return google.path_utils.FindUpward(THISDIR, *pathies)
+
+class PlatformUtility(object):
+ def __init__(self, base_dir):
+ """Args:
+ base_dir: a directory above which third_party/cygwin can be found,
+ used to locate the cygpath executable for path conversions.
+ """
+ self._cygwin_root = None
+ self._base_dir = base_dir
+
+ LAYOUTTEST_HTTP_DIR = "LayoutTests/http/tests/"
+ PENDING_HTTP_DIR = "pending/http/tests/"
+
+ def GetAbsolutePath(self, path, force=False):
+ """Returns an absolute UNIX path."""
+ return os.path.abspath(path)
+
+ # TODO(pinkerton): would be great to get rid of the duplication with
+ # platform_utils_win.py for the next two functions, but the inheritance
+ # from tools/python/google on the windows side makes that a bit difficult.
+
+ def _FilenameToUri(self, path, use_http=False, use_ssl=False, port=8000):
+ """Convert a Windows style path to a URI.
+
+ Args:
+ path: For an http URI, the path relative to the httpd server's
+ DocumentRoot; for a file URI, the full path to the file.
+ use_http: if True, returns a URI of the form http://127.0.0.1:8000/.
+ If False, returns a file:/// URI.
+ use_ssl: if True, returns HTTPS URL (https://127.0.0.1:8000/).
+ This parameter is ignored if use_http=False.
+ port: The port number to append when returning an HTTP URI
+ """
+ if use_http:
+ protocol = 'http'
+ if use_ssl:
+ protocol = 'https'
+ path = path.replace("\\", "/")
+ return "%s://127.0.0.1:%s/%s" % (protocol, str(port), path)
+ return "file:///" + self.GetAbsolutePath(path)
+
+ def FilenameToUri(self, full_path):
+ relative_path = layout_package.path_utils.RelativeTestFilename(full_path)
+ port = None
+ use_ssl = False
+
+ # LayoutTests/http/tests/ run off port 8000 and ssl/ off 8443
+ if relative_path.startswith(self.LAYOUTTEST_HTTP_DIR):
+ relative_path = relative_path[len(self.LAYOUTTEST_HTTP_DIR):]
+ port = 8000
+ # pending/http/tests/ run off port 9000 and ssl/ off 9443
+ elif relative_path.startswith(self.PENDING_HTTP_DIR):
+ relative_path = relative_path[len(self.PENDING_HTTP_DIR):]
+ port = 9000
+ # chrome/http/tests run off of port 8081 with the full path
+ elif relative_path.find("/http/") >= 0:
+ print relative_path
+ port = 8081
+
+ # We want to run off of the http server
+ if port:
+ if relative_path.startswith("ssl/"):
+ port += 443
+ use_ssl = True
+ return PlatformUtility._FilenameToUri(self,
+ relative_path,
+ use_http=True,
+ use_ssl=use_ssl,
+ port=port)
+
+ # Run off file://
+ return PlatformUtility._FilenameToUri(self, full_path, use_http=False,
+ use_ssl=False, port=0)
+
+ def LigHTTPdExecutablePath(self):
+ """Returns the executable path to start LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'mac', 'bin', 'lighttpd')
+
+ def LigHTTPdModulePath(self):
+ """Returns the library module path for LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'mac', 'lib')
+
+ def LigHTTPdPHPPath(self):
+ """Returns the PHP executable path for LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'mac', 'bin', 'php-cgi')
+
+ def ShutDownHTTPServer(self, server_process):
+ """Shut down the lighttpd web server. Blocks until it's fully shut down.
+
+ Args:
+ server_process: The subprocess object representing the running server
+ """
+ subprocess.Popen(('kill', '-TERM', '%d' % server_process.pid),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).wait()
+
+ def TestShellBinary(self):
+ """The name of the binary for TestShell."""
+ return 'TestShell'
+
+ def TestShellBinaryPath(self, target):
+ """Return the platform-specific binary path for our TestShell.
+
+ Args:
+ target: Build target mode (debug or release)
+ """
+ # TODO(pinkerton): make |target| happy with case-sensitive file systems.
+ return PathFromBase('xcodebuild', target, 'TestShell.app',
+ 'Contents', 'MacOS', self.TestShellBinary())
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_win.py b/webkit/tools/layout_tests/layout_package/platform_utils_win.py
index f3566a4..bc69f15 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_win.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_win.py
@@ -21,6 +21,11 @@ import google.platform_utils_win
import layout_package.path_utils
+# This will be a native path to the directory this file resides in.
+# It can either be relative or absolute depending how it's executed.
+THISDIR = os.path.dirname(os.path.abspath(__file__))
+def PathFromBase(*pathies):
+ return google.path_utils.FindUpward(THISDIR, *pathies)
class PlatformUtility(google.platform_utils_win.PlatformUtility):
"""Overrides base PlatformUtility methods as needed for layout tests."""
@@ -142,3 +147,37 @@ class PlatformUtility(google.platform_utils_win.PlatformUtility):
mime_types_path,
apache2=apache2)
+ def LigHTTPdExecutablePath(self):
+ """Returns the executable path to start LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'win', 'LightTPD.exe')
+
+ def LigHTTPdModulePath(self):
+ """Returns the library module path for LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'win', 'lib')
+
+ def LigHTTPdPHPPath(self):
+ """Returns the PHP executable path for LigHTTPd"""
+ return PathFromBase('third_party', 'lighttpd', 'win', 'php5', 'php-cgi.exe')
+
+ def ShutDownHTTPServer(self, server_process):
+ """Shut down the lighttpd web server. Blocks until it's fully shut down.
+
+ Args:
+ server_process: The subprocess object representing the running server.
+ Unused in this implementation of the method.
+ """
+ subprocess.Popen(('taskkill.exe', '/f', '/im', 'LightTPD.exe'),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).wait()
+
+ def TestShellBinary(self):
+ """The name of the binary for TestShell."""
+ return 'test_shell.exe'
+
+ def TestShellBinaryPath(self, target):
+ """Return the platform-specific binary path for our TestShell.
+
+ Args:
+ target: Build target mode (debug or release)
+ """
+ return PathFromBase('chrome', target, self.TestShellBinary())
diff --git a/webkit/tools/test_shell/mac/main.mm b/webkit/tools/test_shell/mac/main.mm
index 552da77..2758373f 100644
--- a/webkit/tools/test_shell/mac/main.mm
+++ b/webkit/tools/test_shell/mac/main.mm
@@ -110,16 +110,19 @@ int main(const int argc, const char *argv[]) {
std::wstring javascript_flags =
parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags);
+ // Test shell always exposes the GC.
+ CommandLine::AppendSwitch(&javascript_flags, L"expose-gc");
+ webkit_glue::SetJavaScriptFlags(javascript_flags);
+#if NOT_YET
//TODO: record/playback modes
- /*
bool playback_mode =
parsed_command_line.HasSwitch(test_shell::kPlaybackMode);
bool record_mode =
parsed_command_line.HasSwitch(test_shell::kRecordMode);
bool no_events = parsed_command_line.HasSwitch(test_shell::kNoEvents);
- */
+#endif
bool dump_stats_table =
parsed_command_line.HasSwitch(test_shell::kDumpStatsTable);
@@ -148,13 +151,11 @@ int main(const int argc, const char *argv[]) {
// Config the network module so it has access to a limited set of resources.
// NetModule::SetResourceProvider(NetResourceProvider);
- // if we have loose arguments, interpret the next one as a URL
+ // Treat the first loose value as the initial URL to open.
std::wstring uri;
- if (parsed_command_line.GetLooseValueCount() > 0) {
- CommandLine::LooseValueIterator iter =
- parsed_command_line.GetLooseValuesBegin();
- uri = *iter;
- } else {
+
+ // Default to a homepage if we're interactive
+ if (interactive) {
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSString *testShellPath =
[resourcePath stringByAppendingPathComponent:@"test_shell/index.html"];
@@ -165,6 +166,12 @@ int main(const int argc, const char *argv[]) {
uri = UTF8ToWide([testShellURL UTF8String]);
}
+ if (parsed_command_line.GetLooseValueCount() > 0) {
+ CommandLine::LooseValueIterator iter =
+ parsed_command_line.GetLooseValuesBegin();
+ uri = *iter;
+ }
+
TestShell* shell;
if (TestShell::CreateNewWindow(uri, &shell)) {
#ifdef NOTYET
@@ -221,7 +228,6 @@ int main(const int argc, const char *argv[]) {
}
if (no_tree)
params.dump_tree = false;
-
if (uri.length() == 0) {
// Watch stdin for URLs.
char filenameBuffer[2048];